source: HDLQ/TestBenches/TBEXOR.v @ 1

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

upload iniziale

  • Property svn:executable set to *
Line 
1module test_bench_EXOR;
2reg in1,in2;
3reg f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16;
4wire w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12,w13,w14,out,outFaultFree;
5
6Fanout Fanout1 (
7        .in (in1),
8        .out1(w9),
9        .out2(w1),
10        .fault(f1)
11        );
12Fanout Fanout2 (
13        .in (in2),
14        .out1(w4),
15        .out2(w5),
16        .fault(f6)
17        );
18LShapedWire LS1 (
19        .in (w9),
20        .out(w10),
21        .fault(f14)
22        );
23LShapedWire LS4 (
24        .in (w10),
25        .out(w11),
26        .fault(f15)
27        );
28LShapedWire LS3 (
29        .in (w4),
30        .out(w14),
31        .fault(f7)
32        );
33LShapedWire LS2 (
34        .in (w5),
35        .out(w6),
36        .fault(f10)
37        );
38LShapedWire LS5 (
39        .in (w3),
40        .out(w12),
41        .fault(f5)
42        );
43LShapedWire LS6 (
44        .in (w8),
45        .out(w13),
46        .fault(f16)
47        );
48
49Inverter INV1 (
50        .in (w1),
51        .out(w2),
52        .fault(f2)
53        );
54
55Inverter INV2 (
56        .in (w6),
57        .out(w7),
58        .fault(f11)
59        );
60
61MajorityVoter MV1 (
62        .A (w2),
63        .B (0),
64        .C (w14),
65        .out (w3),
66        .fault1 (f4),
67        .fault0 (f3)
68        );
69
70MajorityVoter MV2 (
71        .A (w7),
72        .B (0),
73        .C (w11),
74        .out (w8),
75        .fault1(f13),
76        .fault0 (f12)
77        );
78
79MajorityVoter MV3 (
80        .A (w12),
81        .B (1),
82        .C (w13),
83        .out (out),
84        .fault1 (f9),
85        .fault0 (f8)
86        );
87
88
89xor (outFaultFree, in1,in2);
90
91
92
93initial 
94begin     
95        in1 = 0;     
96        in2 = 0;     
97        f1 = 0;     
98        f2 = 0;     
99        f3 = 0;     
100        f4 = 0;     
101        f5 = 0;     
102        f6 = 0;     
103        f7 = 0;     
104        f8 = 0;     
105        f9 = 0;     
106        f10 = 0;     
107        f11 = 0;     
108        f12 = 0;     
109        f13 = 0;     
110        f14 = 0;     
111        f15 = 0;     
112        f16 = 0;     
113end     
114
115// exhaustive stimuli
116always
117     #5 in1 = !in1;
118always
119     #10 in2 = !in2;
120
121always
122     #20 f1 = !f1;
123always
124     #40 f2 = !f2;
125always
126     #80 f3 = !f3;
127always
128     #160 f4 = !f4;
129always
130     #320 f5 = !f5;
131always
132     #640 f6 = !f6;
133always
134     #1280 f7 = !f7;
135always
136     #2560 f8 = !f8;
137always
138     #5120 f9 = !f9;
139always
140     #10240 f10 = !f10;
141always
142     #20480 f11 = !f11;
143always
144     #40960 f12 = !f12;
145always
146     #81920 f13 = !f13;
147always
148     #163840 f14 = !f14;
149always
150     #327680 f15 = !f15;
151always
152     #655360 f16 = !f16;
153
154
155/* 2 faults stimuli TODO
156always
157     #5 in1 = !in1;
158always
159     #10 in2 = !in2;
160always
161     #20 f1 = !f1;
162always
163     #40 f2 = !f2;
164always
165     #80 f3 = !f3;
166always
167     #160 f4 = !f4;
168always
169     #320 f5 = !f5;
170always
171     #640 f6 = !f6;
172always
173     #1280 f7 = !f7;
174always
175     #2560 f8 = !f8;
176always
177     #5120 f9 = !f9;
178always
179     #10240 f10 = !f10;
180always
181     #20480 f11 = !f11;
182always
183     #40960 f12 = !f12;
184always
185     #81920 f13 = !f13;
186always
187     #163840 f14 = !f14;
188always
189     #327680 f15 = !f15;
190always
191     #655360 f16 = !f16;
192*/
193endmodule
194
195
196
197
198
199
200
201
Note: See TracBrowser for help on using the repository browser.