source: HDLQ/TestBenches/TBMUX.v @ 1

Revision 1, 1.8 KB checked in by ttvmrc00, 13 years ago (diff)

upload iniziale

  • Property svn:executable set to *
Line 
1module test_bench_MUX;
2reg A,B,sel;
3reg f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15;
4wire w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12,w13,w14,out;
5
6Fanout Fanout1 (
7        .in (sel),
8        .out1(w6),
9        .out2(w7),
10        .fault(f5)
11        );
12LShapedWire LS1 (
13        .in (A),
14        .out(w1),
15        .fault(f1)
16        );
17LShapedWire LS4 (
18        .in (B),
19        .out(w12),
20        .fault(f13)
21        );
22LShapedWire LS3 (
23        .in (w8),
24        .out(w9),
25        .fault(f14)
26        );
27LShapedWire LS2 (
28        .in (w7),
29        .out(w8),
30        .fault(f15)
31        );
32LShapedWire LS5 (
33        .in (w5),
34        .out(w4),
35        .fault(f7)
36        );
37LShapedWire LS6 (
38        .in (w10),
39        .out(w11),
40        .fault(f10)
41        );
42LShapedWire LS7 (
43        .in (w2),
44        .out(w3),
45        .fault(f4)
46        );
47
48Inverter INV1 (
49        .in (w6),
50        .out(w5),
51        .fault(f6)
52        );
53
54MajorityVoter MV1 (
55        .A (w1),
56        .B (0),
57        .C (w4),
58        .out (w2),
59        .fault1 (f3),
60        .fault0 (f2)
61        );
62
63MajorityVoter MV2 (
64        .A (w9),
65        .B (0),
66        .C (w12),
67        .out (w10),
68        .fault1(f12),
69        .fault0 (f11)
70        );
71
72MajorityVoter MV3 (
73        .A (w3),
74        .B (1),
75        .C (w11),
76        .out (out),
77        .fault1 (f9),
78        .fault0 (f8)
79        );
80or (outFaultFree, w13,w14);
81and (w13, A,~sel);
82and (w14, B,sel);
83
84initial 
85begin     
86        A = 0;     
87        B = 0;     
88        sel = 0;
89        f1 = 0;     
90        f2 = 0;     
91        f3 = 0;     
92        f4 = 0;     
93        f5 = 0;     
94        f6 = 0;     
95        f7 = 0;     
96        f8 = 0;     
97        f9 = 0;     
98        f10 = 0;     
99        f11 = 0;     
100        f12 = 0;     
101        f13 = 0;     
102        f14 = 0;     
103        f15 = 0;     
104end     
105
106always
107     #5 A = !A;
108always
109     #10 B = !B;
110
111always
112     #20 sel = !sel;
113always
114     #40 f1 = !f1;
115always
116     #80 f2 = !f2;
117always
118     #160 f3 = !f3;
119always
120     #320 f4 = !f4;
121always
122     #640 f5 = !f5;
123always
124     #1280 f6 = !f6;
125always
126     #2560 f7 = !f7;
127always
128     #5120 f8 = !f8;
129always
130     #10240 f9 = !f9;
131always
132     #20480 f10 = !f10;
133always
134     #40960 f11 = !f11;
135always
136     #81920 f12 = !f12;
137always
138     #163840 f13 = !f13;
139always
140     #327680 f14 = !f14;
141always
142     #655360 f15 = !f15;
143
144endmodule
145
146
147
148
149
150
151
152
153
Note: See TracBrowser for help on using the repository browser.