Download presentation
Presentation is loading. Please wait.
Published byDustin Eaton Modified over 9 years ago
1
VHDL Symbolic simulator in OCaml Florent Ouchet florent.ouchet@imag.frflorent.ouchet@imag.fr TIMA Labs – GINP – UJF – CNRS – VDS group OCaml Meeting 2009 Grenoble – France 04/02/2009
2
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 2 Outline VSYML – Vhdl Symbolic Simulator in ocaML: Symbolic simulation goals Why OCaml? Application structure and limitations of OCaml in this context Perspectives Conclusion
3
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 FME 3 ) analysis of error consequences using formal methods.
4
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 4 Symbolic simulation goals Integrated circuit synthesis flow: Modeling level Register Transfert Level Gate Level Layout Chips FSM, complex types Explicit time,behavioral Boolean type Drawing of transistors and wires Manual refinements Automatic synthesis Placing and routing Manufacturing
5
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 5 Symbolic simulation goals Existing symbolic simulators: Modeling level Register Transfert Level Gate Level Layout Chips FSM, complex types Explicit time,behavioral Boolean type Drawing of transistors and wires VOSS/Forte (Intel CAD Labs)
6
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 6 Symbolic simulation goals Existing symbolic simulators: Modeling level Register Transfert Level Gate Level Layout Chips FSM, complex types Explicit time,behavioral Boolean type Drawing of transistors and wires VSYML
7
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 7 Symbolic simulation goals Integrated Circuit Description Design Under Test (DUT) X t=0 ns X t=1 ns … Y t=0 ns Y t=1 ns … X t=0 + Y t=1 ? Description written in VHDL (IEEE Std 1076.1 TM – 2007) Symbolic values depend on the time.
8
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)
9
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) | …
10
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.
11
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 11 Why OCaml? Process A Process B Process C The next value of each signal is computed from current values. DUT
12
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 12 Why OCaml? Process A Process B Process C The processes are executed until the design is stabilized. DUT
13
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 13 Why OCaml? Process A Process B Process C The processes are executed until the design is stabilized. DUT
14
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 14 Why OCaml? Process A Process B Process C The processes are executed until the design is stabilized. DUT
15
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 15 Why OCaml? Process A Process B Process C The processes are executed until the design is stabilized. DUT
16
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 16 Why OCaml? Process A Process B Process C The processes are executed until the design is stabilized. DUT
17
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 17 Why OCaml? Process A Process B Process C The processes are executed until the design is stabilized. DUT
18
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#).
19
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 19 Application structure VSYML VHDL source files Design model parameters Standalone and automated application.
20
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…)
21
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
22
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 22 Application structure Some basic functions are missing in OCaml standard libraries Issue 4662 closed as « won’t fix » Abstract syntax tree Design elaboration Simulation structure tree
23
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
24
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 24 Application structure Unbounded integers in VHDL (32 bits at least - "Time" requires 64 bits) Simulation of design on n bits Big_int Abstract syntax tree Design elaboration Simulation structure tree
25
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 25 Application structure Big_int is an abstract type (=) ( ) on Big_int raise runtime exceptions Associative list functions based on (=) Abstract syntax tree Design elaboration Simulation structure tree
26
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 26 Application structure Many executions of the functional structure with different evaluation contexts Simulation structure tree Simulation algorithm Simulation results
27
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 27 Application structure Signature of process simulation function: process -> structure_context -> evaluation_context -> changed_object list
28
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 28 Prototype of process simulation function: process -> structure_context -> evaluation_context -> changed_object list Functors for efficiency (+50%) Application structure
29
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
30
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 30 Application structure Some timings: FIR filter simulation, 1000 clock cycles. Parsing + elab. SimulationOutputProcess memory GC bytes assoc40 ms9.60 s1.20 s2.4 Mo1189 Mo array40 ms1.82 s1.20 s2.4 Mo910 Mo hashtbl40 ms2.00 s1.17 s2.3 Mo921 Mo ref40 ms1.76 s1.25 s2.3 Mo899 Mo
31
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 31 Application structure Process A Process B Process C DUT Load averaging for a multi-thread simulation. Communication efficiency for a distributed simulation.
32
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…
33
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 33 Conclusion Development for project FME 3 is now finished. Research prototype for parallel computations? Release to the public? CeCill Licence?
34
Florent Ouchet – OCaml meeting 2009 – Grenoble – France 34 Questions? Thanks for your attention
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.