source: vis_dev/vis-2.3/models/arbiter/arbiter.mv @ 31

Last change on this file since 31 was 28, checked in by cecile, 13 years ago

exemples de test

File size: 10.4 KB
RevLine 
[28]1# vl2mv arbiter.v
2# version: 2.1
3# date:    10:46:52 03/10/2011 (CET)
4.model main
5# I/O ports
6.outputs ackA
7.outputs ackB
8.outputs ackC
9.mv sel 4 A B C X
10# assign active  = pass_tokenA  || pass_tokenB  || pass_tokenC
11# pass_tokenA  || pass_tokenB
12.names pass_tokenA pass_tokenB _n1
13.def 1
140 0 0
15# pass_tokenA  || pass_tokenB  || pass_tokenC
16.names _n1 pass_tokenC _n2
17.def 1
180 0 0
19.names _n2 active$raw_n0
20- =_n2
21.mv _n3 4 A B C X
22.names _n3
23A
24.subckt controller controllerA req=reqA  ack=ackA  sel=sel  pass_token=pass_tokenA  id=_n3
25.mv _n4 4 A B C X
26.names _n4
27B
28.subckt controller controllerB req=reqB  ack=ackB  sel=sel  pass_token=pass_tokenB  id=_n4
29.mv _n5 4 A B C X
30.names _n5
31C
32.subckt controller controllerC req=reqC  ack=ackC  sel=sel  pass_token=pass_tokenC  id=_n5
33.subckt arbiter arbiter sel=sel  active=active 
34.subckt client clientA req=reqA  ack=ackA 
35.subckt client clientB req=reqB  ack=ackB 
36.subckt client clientC req=reqC  ack=ackC 
37# conflict arbitrators
38.names active$raw_n0  active
390 0
401 1
41# non-blocking assignments
42# latches
43# quasi-continuous assignment
44.end
45.model controller
46# I/O ports
47.inputs sel
48.inputs req
49.outputs pass_token
50.outputs ack
51.inputs id
52.mv sel 4 A B C X
53.mv state 3 IDLE READY BUSY
54.mv id 4 A B C X
55# state  = 0
56.mv state$raw_n6 3 IDLE READY BUSY
57.names state$raw_n6
58IDLE
59# non-blocking assignments for initial
60# ack  = 0
61.names ack$raw_n7
620
63# non-blocking assignments for initial
64# pass_token  = 1
65.names pass_token$raw_n8
661
67# non-blocking assignments for initial
68# assign is_selected  = (sel  == id )
69# sel  == id
70.names sel id _na
71.def 0
72- =sel 1
73.names _na is_selected$raw_n9
74- =_na
75.mv _nd 3 IDLE READY BUSY
76.names _nd
77IDLE
78.names state _nd _nc
79.def 0
80- =state 1
81.names _nc  _nb
82.def 1
830 0
84.names is_selected _ne
85- =is_selected
86.names req _nf
87- =req
88# state  = 1
89.mv state$req_n10$true 3 IDLE READY BUSY
90.names state$req_n10$true
91READY
92# pass_token  = 0
93.names pass_token$req_n11$true
940
95# pass_token  = 1
96.names pass_token$req_n12$false
971
98# if/else (req )
99.names req pass_token$req_n11$true pass_token$req_n12$false pass_token$req$raw_n15
100.def 0
1011 1 - 1
1020 - 1 1
103.mv state$req$raw_n19 3 IDLE READY BUSY
104.names req state$req_n10$true state state$req$raw_n19
1050 - - =state
1061 - - =state$req_n10$true
107# pass_token  = 0
108.names pass_token$is_selected_n1b$false
1090
110# if/else (is_selected )
111.names is_selected pass_token$req$raw_n15 pass_token$is_selected_n1b$false pass_token$is_selected$raw_n1f
112.def 0
1131 1 - 1
1140 - 1 1
115.mv state$is_selected$raw_n21 3 IDLE READY BUSY
116.names is_selected state$req$raw_n19 state state$is_selected$raw_n21
1170 - - =state
1181 - - =state$req$raw_n19
119.mv _n26 3 IDLE READY BUSY
120.names _n26
121READY
122.names state _n26 _n25
123.def 0
124- =state 1
125.names _n25  _n24
126.def 1
1270 0
128# state  = 2
129.mv state$_n24_n27$true 3 IDLE READY BUSY
130.names state$_n24_n27$true
131BUSY
132# ack  = 1
133.names ack$_n24_n28$true
1341
135.mv _n2b 3 IDLE READY BUSY
136.names _n2b
137BUSY
138.names state _n2b _n2a
139.def 0
140- =state 1
141.names _n2a  _n29
142.def 1
1430 0
144.names req _n2c
1450 1 
1461 0 
147.names _n2c _n2d
148- =_n2c
149# state  = 0
150.mv state$_n2c_n2e$true 3 IDLE READY BUSY
151.names state$_n2c_n2e$true
152IDLE
153# ack  = 0
154.names ack$_n2c_n2f$true
1550
156# pass_token  = 1
157.names pass_token$_n2c_n30$true
1581
159# if/else (!req )
160.names _n2c pass_token$_n2c_n30$true pass_token pass_token$_n2c$raw_n37
161.def 0
1621 1 - 1
1630 - 1 1
164.mv state$_n2c$raw_n39 3 IDLE READY BUSY
165.names _n2c state$_n2c_n2e$true state state$_n2c$raw_n39
1660 - - =state
1671 - - =state$_n2c_n2e$true
168.names _n2c ack$_n2c_n2f$true ack ack$_n2c$raw_n3a
169.def 0
1701 1 - 1
1710 - 1 1
172# case (state )
173.mv state$_n29$raw_n42 3 IDLE READY BUSY
174.names _n29 state$_n2c$raw_n39 state state$_n29$raw_n42
1750 - - =state
1761 - - =state$_n2c$raw_n39
177.names _n29 pass_token$_n2c$raw_n37 pass_token pass_token$_n29$raw_n43
178.def 0
1791 1 - 1
1800 - 1 1
181.names _n29 ack$_n2c$raw_n3a ack ack$_n29$raw_n45
182.def 0
1831 1 - 1
1840 - 1 1
185.mv state$_n24$raw_n47 3 IDLE READY BUSY
186.names _n24 state$_n24_n27$true state$_n29$raw_n42 state$_n24$raw_n47
1870 - - =state$_n29$raw_n42
1881 - - =state$_n24_n27$true
189.names _n24 ack$_n24_n28$true ack$_n29$raw_n45 ack$_n24$raw_n48
190.def 0
1911 1 - 1
1920 - 1 1
193.names _n24 pass_token pass_token$_n29$raw_n43 pass_token$_n24$raw_n4f
194.def 0
1951 1 - 1
1960 - 1 1
197.mv state$_nb$raw_n52 3 IDLE READY BUSY
198.names _nb state$is_selected$raw_n21 state$_n24$raw_n47 state$_nb$raw_n52
1990 - - =state$_n24$raw_n47
2001 - - =state$is_selected$raw_n21
201.names _nb pass_token$is_selected$raw_n1f pass_token$_n24$raw_n4f pass_token$_nb$raw_n53
202.def 0
2031 1 - 1
2040 - 1 1
205.names _nb ack ack$_n24$raw_n48 ack$_nb$raw_n5b
206.def 0
2071 1 - 1
2080 - 1 1
209# conflict arbitrators
210.names is_selected$raw_n9  is_selected
2110 0
2121 1
213.names _nb _ne _nf _n24 _n29 _n2d _n5d
214.def 0
215 1 1 1 - - - 1
216 0 - - 1 - - 1
217 0 - - 0 1 1 1
218.mv _n5e 3 IDLE READY BUSY
219.names _n5d state$_nb$raw_n52 state _n5e
2201 - - =state$_nb$raw_n52
2210 - - =state
222.names _nb _ne _nf _n24 _n29 _n2d _n62
223.def 0
224 1 1 1 - - - 1
225 1 1 0 - - - 1
226 1 0 - - - - 1
227 0 - - 0 1 1 1
228.names _n62 pass_token$_nb$raw_n53 pass_token _n63
2291 0 - 0
2301 1 - 1
2310 - 0 0
2320 - 1 1
233.names _nb _n24 _n29 _n2d _n64
234.def 0
235 0 1 - - 1
236 0 0 1 1 1
237.names _n64 ack$_nb$raw_n5b ack _n65
2381 0 - 0
2391 1 - 1
2400 - 0 0
2410 - 1 1
242# non-blocking assignments
243# latches
244.r pass_token$raw_n8 pass_token
2450 0
2461 1
247.latch _n63 pass_token
248.r state$raw_n6 state
249- =state$raw_n6
250.latch _n5e state
251.r ack$raw_n7 ack
2520 0
2531 1
254.latch _n65 ack
255# quasi-continuous assignment
256.end
257.model arbiter
258# I/O ports
259.outputs sel
260.inputs active
261.mv sel 4 A B C X
262.mv state 4 A B C X
263# state  = 0
264.mv state$raw_n66 4 A B C X
265.names state$raw_n66
266A
267# non-blocking assignments for initial
268# assign sel  = active  ? state  : 3
269.mv sel$raw_n67 4 A B C X
270.mv _n68 4 A B C X
271.names _n68
272X
273# active  ? state  : 3
274.mv _n69 4 A B C X
275.names active state _n68 _n69
2760 - - =_n68
2771 - - =state
278.names _n69 sel$raw_n67
279- =_n69
280.names active _n6a
281- =active
282.mv _n6d 4 A B C X
283.names _n6d
284A
285.names state _n6d _n6c
286.def 0
287- =state 1
288.names _n6c  _n6b
289.def 1
2900 0
291# state  = 1
292.mv state$_n6b_n6e$true 4 A B C X
293.names state$_n6b_n6e$true
294B
295.mv _n71 4 A B C X
296.names _n71
297B
298.names state _n71 _n70
299.def 0
300- =state 1
301.names _n70  _n6f
302.def 1
3030 0
304# state  = 2
305.mv state$_n6f_n72$true 4 A B C X
306.names state$_n6f_n72$true
307C
308.mv _n75 4 A B C X
309.names _n75
310C
311.names state _n75 _n74
312.def 0
313- =state 1
314.names _n74  _n73
315.def 1
3160 0
317# state  = 0
318.mv state$_n73_n76$true 4 A B C X
319.names state$_n73_n76$true
320A
321# case (state )
322.mv state$_n73$raw_n79 4 A B C X
323.names _n73 state$_n73_n76$true state state$_n73$raw_n79
3240 - - =state
3251 - - =state$_n73_n76$true
326.mv state$_n6f$raw_n7a 4 A B C X
327.names _n6f state$_n6f_n72$true state$_n73$raw_n79 state$_n6f$raw_n7a
3280 - - =state$_n73$raw_n79
3291 - - =state$_n6f_n72$true
330.mv state$_n6b$raw_n7e 4 A B C X
331.names _n6b state$_n6b_n6e$true state$_n6f$raw_n7a state$_n6b$raw_n7e
3320 - - =state$_n6f$raw_n7a
3331 - - =state$_n6b_n6e$true
334# if/else (active )
335.mv state$active$raw_n84 4 A B C X
336.names active state$_n6b$raw_n7e state state$active$raw_n84
3370 - - =state
3381 - - =state$_n6b$raw_n7e
339# conflict arbitrators
340.names sel$raw_n67  sel
341- =sel$raw_n67
342.names _n6a _n6b _n6f _n73 _n85
343.def 0
344 1 1 - - 1
345 1 0 1 - 1
346 1 0 0 1 1
347.mv _n86 4 A B C X
348.names _n85 state$active$raw_n84 state _n86
3491 - - =state$active$raw_n84
3500 - - =state
351# non-blocking assignments
352# latches
353.r state$raw_n66 state
354- =state$raw_n66
355.latch _n86 state
356# quasi-continuous assignment
357.end
358.model client
359# I/O ports
360.outputs req
361.inputs ack
362.mv state 3 NO_REQ REQ HAVE_TOKEN
363# req  = 0
364.names req$raw_n89
3650
366# non-blocking assignments for initial
367# state  = 0
368.mv state$raw_n8a 3 NO_REQ REQ HAVE_TOKEN
369.names state$raw_n8a
370NO_REQ
371# non-blocking assignments for initial
372# assign rand_choice  = $ND ( 0,1 )
373.names rand_choice
3740
3751
376.mv _n8f 3 NO_REQ REQ HAVE_TOKEN
377.names _n8f
378NO_REQ
379.names state _n8f _n8e
380.def 0
381- =state 1
382.names _n8e  _n8d
383.def 1
3840 0
385.names rand_choice _n90
386- =rand_choice
387# req  = 1
388.names req$rand_choice_n91$true
3891
390# state  = 1
391.mv state$rand_choice_n92$true 3 NO_REQ REQ HAVE_TOKEN
392.names state$rand_choice_n92$true
393REQ
394# if/else (rand_choice )
395.names rand_choice req$rand_choice_n91$true req req$rand_choice$raw_n97
396.def 0
3971 1 - 1
3980 - 1 1
399.mv state$rand_choice$raw_n99 3 NO_REQ REQ HAVE_TOKEN
400.names rand_choice state$rand_choice_n92$true state state$rand_choice$raw_n99
4010 - - =state
4021 - - =state$rand_choice_n92$true
403.mv _n9c 3 NO_REQ REQ HAVE_TOKEN
404.names _n9c
405REQ
406.names state _n9c _n9b
407.def 0
408- =state 1
409.names _n9b  _n9a
410.def 1
4110 0
412.names ack _n9d
413- =ack
414# state  = 2
415.mv state$ack_n9e$true 3 NO_REQ REQ HAVE_TOKEN
416.names state$ack_n9e$true
417HAVE_TOKEN
418# if/else (ack )
419.mv state$ack$raw_na1 3 NO_REQ REQ HAVE_TOKEN
420.names ack state$ack_n9e$true state state$ack$raw_na1
4210 - - =state
4221 - - =state$ack_n9e$true
423.mv _na4 3 NO_REQ REQ HAVE_TOKEN
424.names _na4
425HAVE_TOKEN
426.names state _na4 _na3
427.def 0
428- =state 1
429.names _na3  _na2
430.def 1
4310 0
432.names rand_choice _na5
433- =rand_choice
434# req  = 0
435.names req$rand_choice_na6$true
4360
437# state  = 0
438.mv state$rand_choice_na7$true 3 NO_REQ REQ HAVE_TOKEN
439.names state$rand_choice_na7$true
440NO_REQ
441# if/else (rand_choice )
442.names rand_choice req$rand_choice_na6$true req req$rand_choice$raw_nac
443.def 0
4441 1 - 1
4450 - 1 1
446.mv state$rand_choice$raw_nae 3 NO_REQ REQ HAVE_TOKEN
447.names rand_choice state$rand_choice_na7$true state state$rand_choice$raw_nae
4480 - - =state
4491 - - =state$rand_choice_na7$true
450# case (state )
451.names _na2 req$rand_choice$raw_nac req req$_na2$raw_nb3
452.def 0
4531 1 - 1
4540 - 1 1
455.mv state$_na2$raw_nb5 3 NO_REQ REQ HAVE_TOKEN
456.names _na2 state$rand_choice$raw_nae state state$_na2$raw_nb5
4570 - - =state
4581 - - =state$rand_choice$raw_nae
459.mv state$_n9a$raw_nb6 3 NO_REQ REQ HAVE_TOKEN
460.names _n9a state$ack$raw_na1 state$_na2$raw_nb5 state$_n9a$raw_nb6
4610 - - =state$_na2$raw_nb5
4621 - - =state$ack$raw_na1
463.names _n9a req req$_na2$raw_nb3 req$_n9a$raw_nb9
464.def 0
4651 1 - 1
4660 - 1 1
467.names _n8d req$rand_choice$raw_n97 req$_n9a$raw_nb9 req$_n8d$raw_nbc
468.def 0
4691 1 - 1
4700 - 1 1
471.mv state$_n8d$raw_nbe 3 NO_REQ REQ HAVE_TOKEN
472.names _n8d state$rand_choice$raw_n99 state$_n9a$raw_nb6 state$_n8d$raw_nbe
4730 - - =state$_n9a$raw_nb6
4741 - - =state$rand_choice$raw_n99
475# conflict arbitrators
476.names _n8d _n90 _n9a _na2 _na5 _nc5
477.def 0
478 1 1 - - - 1
479 0 - 0 1 1 1
480.names _nc5 req$_n8d$raw_nbc req _nc6
4811 0 - 0
4821 1 - 1
4830 - 0 0
4840 - 1 1
485.names _n8d _n90 _n9a _n9d _na2 _na5 _nc7
486.def 0
487 1 1 - - - - 1
488 0 - 1 1 - - 1
489 0 - 0 - 1 1 1
490.mv _nc8 3 NO_REQ REQ HAVE_TOKEN
491.names _nc7 state$_n8d$raw_nbe state _nc8
4921 - - =state$_n8d$raw_nbe
4930 - - =state
494# non-blocking assignments
495# latches
496.r req$raw_n89 req
4970 0
4981 1
499.latch _nc6 req
500.r state$raw_n8a state
501- =state$raw_n8a
502.latch _nc8 state
503# quasi-continuous assignment
504.end
Note: See TracBrowser for help on using the repository browser.