1 / 34

VHDL Symbolic simulator in OCaml

VHDL Symbolic simulator in OCaml. Florent Ouchet florent.ouchet@imag.fr TIMA Labs – GINP – UJF – CNRS – VDS group. OCaml Meeting 2009 Grenoble – France 04/02/2009. Outline. VSYML – Vhdl Symbolic Simulator in ocaML: Symbolic simulation goals Why OCaml?

Download Presentation

VHDL Symbolic simulator in OCaml

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VHDL Symbolic simulator in OCaml Florent Ouchet florent.ouchet@imag.fr TIMA Labs – GINP – UJF – CNRS – VDS group OCaml Meeting 2009 Grenoble – France 04/02/2009

  2. Outline VSYML – Vhdl Symbolic Simulator in ocaML: • Symbolic simulation goals • Why OCaml? • Application structure and limitations of OCaml in this context • Perspectives • Conclusion Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  3. Symbolic simulation goals Model is needed for: • Model checking: equivalence of IC implementation and specification; • Other formal methods based on the model: (ANR project FME3) analysis of error consequences using formal methods. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  4. Symbolic simulation goals Integrated circuit synthesis flow: Modeling level Explicit time,behavioral Manual refinements Register Transfert Level FSM, complex types Automatic synthesis Gate Level Boolean type Placing and routing Drawing of transistors and wires Layout Manufacturing Chips Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  5. Symbolic simulation goals Existing symbolic simulators: Modeling level Explicit time,behavioral Register Transfert Level FSM, complex types VOSS/Forte (Intel CAD Labs) Gate Level Boolean type Drawing of transistors and wires Layout Chips Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  6. Symbolic simulation goals Existing symbolic simulators: Modeling level Explicit time,behavioral Register Transfert Level VSYML FSM, complex types Gate Level Boolean type Drawing of transistors and wires Layout Chips Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  7. Symbolic simulation goals Xt=0 ns Xt=1 ns … Integrated Circuit Description Design Under Test (DUT) Xt=0 + Yt=1 ? Yt=0 ns Yt=1 ns … Description written in VHDL (IEEE Std 1076.1TM – 2007) Symbolic values depend on the time. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  8. Why OCaml? Expression patterns: • X@1ns • 1 • unary_operator X (not – abs) • X assoc_operator Y (+ * and or xor xnor) • X binary_operator Y (nand nor ^ = /= < > <= >=) • X other_operator Y (mod rem / -) • … (total of 28 patterns) Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  9. Why OCaml? type formula = | FormulaSymbol of symbol | FormulaImmediateInt of big_int | FormulaUnaryOperator of (unary_operator*formula) | FormulaAssociativeOperator of (assoc_operator*formula list) | FormulaBinaryOperator of (binary_operator*formula*formula) | FormulaOtherOperator of (other_operator*formula*formula list) | … Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  10. Why OCaml? • Known expression patterns are rewritten (numeric evaluation); • As in the standard, the simulation algorithm is intrinsically free of side effects. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  11. Why OCaml? DUT Process A Process C Process B The next value of each signal is computed from current values. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  12. Why OCaml? DUT Process A Process C Process B The processes are executed until the design is stabilized. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  13. Why OCaml? DUT Process A Process C Process B The processes are executed until the design is stabilized. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  14. Why OCaml? DUT Process A Process C Process B The processes are executed until the design is stabilized. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  15. Why OCaml? DUT Process A Process C Process B The processes are executed until the design is stabilized. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  16. Why OCaml? DUT Process A Process C Process B The processes are executed until the design is stabilized. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  17. Why OCaml? DUT Process A Process C Process B The processes are executed until the design is stabilized. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  18. Why OCaml? • Strong type checking (compared to C, Pascal…): confidence in computations; • Lexer/parser generator; • « Free » software, its ancestor was written in Mathematica; • Lightweight and easy to redist (Java, C#, F#). Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  19. Application structure VHDL source files Design model VSYML parameters Standalone and automated application. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  20. Application structure • Some facts: • Over 26500 lines of code • 24 dedicated modules (types, basics, lexer, parser, resources, evaluators, converters, volume extrusion, top-level…) Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  21. Application structure • Straightforward conversion from BNF rules (language spec) • No syntax for optional tokens • Debugging conflicts is a nightmare VHDL source files (thousands lines) Lexer (59 states, 1058 transitions) Parser (695 grammar rules,1318 states) Abstract syntax tree Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  22. Some basic functions are missing in OCaml standard libraries Issue 4662 closed as « won’t fix » Application structure Abstract syntax tree Design elaboration Simulation structure tree Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  23. Application structure • A function to map a list of functions to the same parameter: (‘a -> ‘b) list -> ‘a -> ‘b list • A function to remove the n first list elements: ‘a list -> int -> ‘a list Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  24. Unbounded integers in VHDL (32 bits at least -"Time" requires 64 bits) Simulation of design on n bits  Big_int Application structure Abstract syntax tree Design elaboration Simulation structure tree Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  25. Big_int is an abstract type (=) (<) (>) on Big_int raise runtime exceptions Associative list functions based on (=) Application structure Abstract syntax tree Design elaboration Simulation structure tree Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  26. Many executions of the functional structure with different evaluation contexts Application structure Simulation structure tree Simulation algorithm Simulation results Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  27. Application structure • Signature of process simulation function: process -> structure_context -> evaluation_context -> changed_object list Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  28. Application structure • Prototype of process simulation function: process -> structure_context -> evaluation_context -> changed_object list • Functors for efficiency (+50%) Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  29. Application structure • Prototype of process simulation function: process -> structure_context -> evaluation_context -> changed_signal list • evaluation_context = { simulation_time: Big_int; currentvalues: (signal*formula) list; … } • Test with array, hashtbl and references Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  30. Application structure • Some timings: FIR filter simulation, 1000 clock cycles. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  31. Application structure DUT Process A Process C Process B Load averaging for a multi-thread simulation. Communication efficiency for a distributed simulation. Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  32. Perspectives • Spread the simulation over cores and computers: an integrated circuit is a fixed finite set of concurrent process •  concurrent simulation but: • lots of rendez-vous and communications • Irregular load • Mathematics: loop invariants… Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  33. Conclusion • Development for project FME3 is now finished. • Research prototype for parallel computations? • Release to the public? CeCill Licence? Florent Ouchet – OCaml meeting 2009 – Grenoble – France

  34. Questions? Thanks for your attention Florent Ouchet – OCaml meeting 2009 – Grenoble – France

More Related