source: HDLQ/TestBenches/TBMmix.v @ 1

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

upload iniziale

  • Property svn:executable set to *
Line 
1//`timescale 1ns/100ps
2module test_bench_memhyb;
3reg write,d_in;
4reg fault_FNO1, 
5                fault_LSW1,
6                fault_INV1, 
7                fault1_MV2,
8                fault0_MV2,
9                fault_FNO2,
10                fault_FNO3,
11                fault_LSW5,
12                fault_LSW3,
13                fault1_MV3,
14                fault0_MV3,
15                fault1_MV1,
16                fault0_MV1,
17                fault_FNO4,
18                fault_FNO5,
19                fault_FNO6,
20                fault_LSW2;
21               
22reg oldvalue;
23reg [1:0] zone1,zone2,zone3,zone4;
24wire out0,out1,out2,out3;
25//initialization -> all the outputs off zones 4 has to be initialized in the loop
26assign m17=oldvalue;
27assign m28=oldvalue;
28assign m19=oldvalue;
29assign m32=oldvalue;
30parameter [1:0]
31        switch=1,
32        hold=2,
33        rele=3,
34        relax=0;
35       
36Wire_4 W1(
37          .A(write),
38          .B(m0),
39          .status(zone1)
40          );
41         
42Fanout_A4 FNO1(
43                .A (write),
44                .B (m1), 
45                .C (m2), 
46                .status(zone1),
47                .fault(fault_FNO1)
48                );
49Wire_4 W8(
50          .A(d_in),
51          .B(m12),
52          .status(zone1)
53          );
54
55Wire_4 W2(
56          .A(m2),
57          .B(m3),
58          .status(zone1));
59
60Wire_4 W3(
61          .A(m1),
62          .B(m4),
63          .status(zone1));
64                               
65LShapedWire_4 LSW1(
66                .A(m4), 
67                .B(m5), 
68                .status(zone1),
69                .fault(fault_LSW1)
70                );             
71               
72Inverter_4 INV1 (
73                .A(m5),
74                .B(m6),
75                .status(zone1),
76                .fault(fault_INV1)
77        );
78
79MajorityVoter_4 MV2 (
80                .A(m6), 
81                .B(m14), 
82                .C(1'b1), 
83                .Zp(m7),
84                .status(zone2),
85                .fault1(fault1_MV2), 
86                .fault0(fault0_MV2)
87                );
88
89LShapedWire_4 LSW2(
90                .A(m7), 
91                .B(m8), 
92                .status(zone3),
93                .fault(fault_LSW2)
94                );
95               
96Wire_4 W5(
97                .A(m11),
98                .B(m14),
99                .status(zone2)
100                );
101
102Wire_4 W9(
103                .A(m8),
104                .B(m9),
105                .status(zone3)
106                );             
107
108Fanout_C4 FNO2(
109                .C (m12),
110                .B (m11), 
111                .A (m13), 
112                .status(zone2),
113                .fault(fault_FNO2)
114                );
115
116               
117MajorityVoter_4 MV1 (
118                .A(m3), 
119                .B(1'b0), 
120                .C(m13), 
121                .Zp(m16),
122                .status(zone2),
123                .fault1(fault1_MV1), 
124                .fault0(fault0_MV1)
125                );             
126
127       
128Wire_4 W4(.A(m16), 
129          .B(m15), 
130          .status(zone3)
131          );   
132         
133                         
134MajorityVoter_4 MV3 (
135                .A(m15), 
136                .B(m21), 
137                .C(m9), 
138                .Zp(m36),
139                .status(zone4),
140                .fault1(fault1_MV3), 
141                .fault0(fault0_MV3)
142                );             
143
144Fanout_A4 FNO4(
145                .A (m36),
146                .B (m17), 
147                .C (out3), 
148                .status(zone4),
149                .fault(fault_FNO4)
150                );
151                       
152LShapedWire_4 LSW3(
153                .A(m20), 
154                .B(m21), 
155                .status(zone3),
156                .fault(fault_LSW3)
157                );     
158                       
159Wire_4 W20(.A(m17), 
160          .B(m25), 
161          .status(zone1)
162          );   
163         
164Wire_4 W19(.A(m25), 
165          .B(m26), 
166          .status(zone2)
167          );   
168         
169Wire_4 W18(.A(m26), 
170          .B(m27), 
171          .status(zone3)
172          );
173
174Fanout_A4 FNO5(
175                .A (m27),
176                .B (m28), 
177                .C (out2), 
178                .status(zone4),
179                .fault(fault_FNO5)
180                );     
181       
182Wire_4 W16(.A(m28), 
183          .B(m29), 
184          .status(zone1)
185          );   
186Wire_4 W15(.A(m29), 
187          .B(m30), 
188          .status(zone2)
189          );   
190Wire_4 W14(.A(m30), 
191          .B(m18), 
192          .status(zone3)
193          );   
194
195Wire_4 W13(.A(m19), 
196          .B(m35), 
197          .status(zone1)
198          );   
199
200Wire_4 W12(.A(m35), 
201          .B(m34), 
202          .status(zone2)
203          );   
204
205Wire_4 W11(.A(m34), 
206          .B(m33), 
207          .status(zone3)
208          );   
209
210Fanout_A4 FNO6(
211                .A (m33),
212                .B (m32), 
213                .C (out0), 
214                .status(zone4),
215                .fault(fault_FNO4)
216                );
217
218Wire_4 W22(.A(m32), 
219          .B(m31), 
220          .status(zone1)
221          );   
222
223Wire_4 W21(.A(m31), 
224          .B(m20), 
225          .status(zone2)
226          );                   
227
228       
229         
230Fanout_A4 FNO3(
231                .A (m18),
232                .B (out1), 
233                .C (m10), 
234                .status(zone4),
235                .fault(fault_FNO3)
236                );
237
238LShapedWire_4 LSW4(
239                .A(m10), 
240                .B(m19), 
241                .status(zone4),
242                .fault(fault_LSW5)
243                );
244initial 
245begin     
246                fault_FNO1 <=0;
247                fault_LSW1 <=0;
248                fault_INV1 <=0;
249                fault1_MV2 <=0;
250                fault0_MV2 <=0;
251                fault_FNO2 <=0;
252                fault_LSW2 <=0;
253                fault_FNO3 <=0;
254                fault_FNO4 <=0;
255                fault_FNO5 <=0;
256                fault_FNO6 <=0;
257                fault_LSW5 <=0;
258                fault_LSW3 <=0;
259                fault1_MV3 <=0;
260                fault0_MV3 <=0;
261                fault1_MV1 <=0;
262                fault0_MV1 <=0;
263                oldvalue<=0;
264                write<=1;
265                d_in<=1;
266                zone1<=switch;
267                zone2<=relax;
268                zone3<=rele;
269                zone4<=hold;
270                #30 oldvalue=1'bz;
271end     
272
273always
274        begin 
275        #350 write <=0;
276        #10 d_in  <=0;
277        #70 write<=1;
278        #100write <=0;
279        end     
280
281always@(zone1)
282        begin
283                #25 zone1 <= zone1 +1;
284        end     
285                       
286always@(zone2)
287        begin
288                #25  zone2 <= zone2 +1 ;
289        end     
290                       
291always@(zone3)
292        begin
293                #25 zone3  <=  zone3 +1;
294        end     
295always@(zone4)
296        begin
297                #25 zone4  <=  zone4 +1;
298        end
299       
300endmodule
301
302
Note: See TracBrowser for help on using the repository browser.