Lava. Mary Sheeran , Koen Claessen Chalmers University of Technology Satnam Singh, Xilinx. Lava. Not so much a hardware description language More a style of circuit description Emphasises connection patterns Think of Lego. f. g. Behaviour and Structure. f. g. f ->- g. g. f.
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
More Related Content
Presentation Transcript
Lava Mary Sheeran, Koen Claessen Chalmers University of Technology Satnam Singh, Xilinx
Lava Not so much a hardware description language More a style of circuit description Emphasises connection patterns Think of Lego
fa Full Adder in Xilinx Lava cout b sum a cin fa (cin, (a,b)) = (sum, cout) where part_sum = xor (a, b) sum = xorcy (part_sum, cin) cout = muxcy (part_sum, (a, cin))
Xilinx FPGA Implementation • 16-bit implementation on a XCV300 FPGA • Vertical layout required to exploit fast carry chain • No need to specify coordinates in HDL code
cout fa b sum a cin Full Adder in Chalmers Lava fa (cin, (a,b)) = (sum, cout) where part_sum = xor2 (a, b) sum = xor2 (part_sum, cin) cout = mux (part_sum, (a, cin))
import Lava fa (cin,(a,b)) = (sum,cout) where part_sum = xor2(a,b) sum = xor2(part_sum,cin) cout = mux(part_sum,(a,cin)) Main> simulate fa (high,(high,high)) (high,high)
import Lava import Patterns fa (cin,(a,b)) = (sum,cout) where part_sum = xor2(a,b) sum = xor2(part_sum,cin) cout = mux(part_sum,(a,cin)) add = row fa Main> simulate add (low,[(low,high),(high,low),(low,high)]) ([high,high,high],low)
import Lava import Arithmetic fa (cin,(a,b)) = (sum,cout) where … checkFullAdd ins = ok where out1 = fa ins out2 = fullAdd ins -- Lava built-in fullAdder ok = out1 <==> out2 Main> vis checkFullAdd Vis: ... (t=0.7) Valid.
import Lava import Arithmetic fa (cin,(a,b)) = (sum,cout) where … checkFullAdd ins = ok where out1 = fa ins out2 = fullAdd ins -- Lava built-in fullAdder ok = out1 <==> out2 Main> satzoo checkFullAdd Vis: ... (t=0.1) Valid.
In file Verify/circuit.cnf In file Verify/circuit.cnf.out c Generated by Lava2000 c c i0 : 6 c i1 : 7 c i2 : 8 p cnf 21 57 -5 6 7 0 -5 -6 -7 0 5 -6 7 0 5 -7 6 0 -4 5 8 0 -4 -5 -8 0 4 -5 8 0 4 -8 5 0 Parsing DIMACS Solving (randomize) 10000/38 (0.00 %). Computing static variable order. restarts : 0 conflicts : 10 learnt_clauses : 5 forgotten_clauses : 3 decisions : 10 propagations : 79 inspect_binary : 49 inspect_normal : 194 inspect_learnt : 2 CPU time : 0 s UNSATISFIABLE real 0.1 user 0.0 sys 0.0 ….. 11 -12 -21 0 -11 12 0 -11 21 0 1 -2 -11 0 -1 2 0 -1 11 0 -1 0
Checking equivalence anddel = and2 ->- delay low prop_Equivalent circ1 circ2 a = ok where out1 = circ1 a out2 = circ2 a ok = out1 <==> out2 Main> vis (prop_Equivalent deland anddel) Vis: ... (t=0.2) Valid. Main> smv (prop_Equivalent deland3 anddel) Smv: ... (t=0.4) Valid.
In Verify/circuit.smv DEFINE w5 := 0; DEFINE w6 := i0; ASSIGN init(w4) := w5; ASSIGN next(w4) := w6; DEFINE w8 := i1; ASSIGN init(w7) := w5; ASSIGN next(w7) := w8; DEFINE w3 := w4 & w7; DEFINE w10 := w6 & w8; ASSIGN init(w9) := w5; ASSIGN next(w9) := w10; DEFINE w2 := !(w3 <-> w9); DEFINE w1 := !(w2); SPEC AG w1 -- Generated by Lava2000 MODULE main VAR w1 : boolean; VAR w2 : boolean; VAR w3 : boolean; VAR w4 : boolean; VAR w5 : boolean; VAR w6 : boolean; VAR i0 : boolean; VAR w7 : boolean; VAR w8 : boolean; VAR i1 : boolean; VAR w9 : boolean; VAR w10 : boolean;
Many delays delayN 0 init = id delayN n init = delay init ->- delayN (n-1) init dAnd n = delayN n (low,low) ->- and2 andD n = and2 ->- delayN n low Main> smv (prop_Equivalent (dAnd 10) (andD 10)) Smv: ... (t=0.9) Valid. Main> smv (prop_Equivalent (dAnd 15) (andD 15)) Smv: ... (t=2:30.3) Valid. Same verification for 20 takes more than 35 minutes
Note Could be viewed as Lustre (or similar) embedded in Haskell Generic circuits and connection patterns easy to describe (the power of Haskell) Verify FIXED SIZE circuits (squeezing the problem down into an easy enough one)
Working on lists G F parl F G = halveList ->- (F -|- G) ->- append
Describe connection pattern Then plug in variety of components, including bit-serial etc. (see work of Vuillemin) Sorters and mergers verified using 0-1 principle and SAT-solver (see Knuth vol. 3) Used higher order functions and polymorphism