source: HDLQ/TestBenches/TBMLoop.v @ 1

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

upload iniziale

  • Property svn:executable set to *
Line 
1`timescale 1ns/100ps
2module test_bench_memloop;
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_LSW2;
18reg oldvalue;
19reg [1:0] zone1,zone2,zone3,zone4;
20wire out;
21assign m17=oldvalue;
22parameter [1:0]
23        switch=1,
24        hold=2,
25        rele=3,
26        relax=0;
27       
28Wire_4 W1(
29          .A(write),
30          .B(m0),
31          .status(zone1)
32          );
33         
34Fanout_A4 FNO1(
35                .A (write),
36                .B (m1), 
37                .C (m2), 
38                .status(zone1),
39                .fault(fault_FNO1)
40                );
41Wire_4 W8(
42          .A(d_in),
43          .B(m12),
44          .status(zone1)
45          );
46
47Wire_4 W2(
48          .A(m2),
49          .B(m3),
50          .status(zone1));
51
52Wire_4 W3(
53          .A(m1),
54          .B(m4),
55          .status(zone1));
56                               
57LShapedWire_4 LSW1(
58                .A(m4), 
59                .B(m5), 
60                .status(zone1),
61                .fault(fault_LSW1)
62                );             
63               
64Inverter_4 INV1 (
65                .A(m5),
66                .B(m6),
67                .status(zone1),
68                .fault(fault_INV1)
69        );
70
71MajorityVoter_4 MV2 (
72                .A(m6), 
73                .B(m14), 
74                .C(1'b1), 
75                .Zp(m7),
76                .status(zone2),
77                .fault1(fault1_MV2), 
78                .fault0(fault0_MV2)
79                );
80
81LShapedWire_4 LSW2(
82                .A(m7), 
83                .B(m8), 
84                .status(zone3),
85                .fault(fault_LSW2)
86                );
87               
88Wire_4 W5(
89                .A(m11),
90                .B(m14),
91                .status(zone2)
92                );
93
94Wire_4 W9(
95                .A(m8),
96                .B(m9),
97                .status(zone3)
98                );             
99
100Fanout_C4 FNO2(
101                .C (m12),
102                .B (m11), 
103                .A (m13), 
104                .status(zone2),
105                .fault(fault_FNO2)
106                );
107
108               
109MajorityVoter_4 MV1 (
110                .A(m3), 
111                .B(1'b0), 
112                .C(m13), 
113                .Zp(m16),
114                .status(zone2),
115                .fault1(fault1_MV1), 
116                .fault0(fault0_MV1)
117                );             
118
119       
120Wire_4 W4(.A(m16), 
121          .B(m15), 
122          .status(zone3)
123          );   
124         
125                         
126MajorityVoter_4 MV3 (
127                .A(m15), 
128                .B(m21), 
129                .C(m9), 
130                .Zp(m17),
131                .status(zone4),
132                .fault1(fault1_MV3), 
133                .fault0(fault0_MV3)
134                );             
135       
136LShapedWire_4 LSW3(
137                .A(m20), 
138                .B(m21), 
139                .status(zone3),
140                .fault(fault_LSW3)
141                );             
142
143Wire_4 W6(.A(m19), 
144          .B(m20), 
145          .status(zone3)
146          );                   
147
148Wire_4 W7(.A(m17), 
149          .B(m18), 
150          .status(zone1)
151          );   
152         
153Fanout_A4 FNO3(
154                .A (m18),
155                .B (out), 
156                .C (m10), 
157                .status(zone2),
158                .fault(fault_FNO3)
159                );
160
161LShapedWire_4 LSW4(
162                .A(m10), 
163                .B(m19), 
164                .status(zone2),
165                .fault(fault_LSW5)
166                );
167initial 
168begin     
169                fault_FNO1 <=0;
170                fault_LSW1 <=0;
171                fault_INV1 <=0;
172                fault1_MV2 <=0;
173                fault0_MV2 <=0;
174                fault_FNO2 <=0;
175                fault_LSW2 <=0;
176                fault_FNO3 <=0;
177                fault_LSW5 <=0;
178                fault_LSW3 <=0;
179                fault1_MV3 <=0;
180                fault0_MV3 <=0;
181                fault1_MV1 <=0;
182                fault0_MV1 <=0;
183                oldvalue<=0;
184                write<=1;
185                d_in<=1;
186                zone1<=switch;
187                zone2<=relax;
188                zone3<=rele;
189                zone4<=hold;
190                #30 oldvalue=1'bz;
191end     
192
193always
194        begin 
195        #80 write <=0;
196        #40 d_in  <=0;
197        #70 write<=1;
198        #100write <=0;
199        end     
200
201always@(zone1)
202        begin
203                #25 zone1 <= zone1 +1;
204        end     
205                       
206always@(zone2)
207        begin
208                #25  zone2 <= zone2 +1 ;
209        end     
210                       
211always@(zone3)
212        begin
213                #25 zone3  <=  zone3 +1;
214        end     
215always@(zone4)
216        begin
217                #25 zone4  <=  zone4 +1;
218        end
219       
220endmodule
221
222
Note: See TracBrowser for help on using the repository browser.