Revision 1,
2.7 KB
checked in by ttvmrc00, 14 years ago
(diff) |
upload iniziale
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[1] | 1 | `timescale 1ns/100ps |
---|
| 2 | module test_bench_memory2; |
---|
| 3 | reg clk1,clk2,clk3,clk0,write,d_in; |
---|
| 4 | reg 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; |
---|
| 18 | reg m5l,i2l,m2l,m12l,m15l, m7l,m8l,m6l,m16l,m10l,m9l; |
---|
| 19 | wire out ; |
---|
| 20 | |
---|
| 21 | Fanout FNO1( |
---|
| 22 | .in (write), |
---|
| 23 | .out1 (m1), |
---|
| 24 | .out2 (m2), |
---|
| 25 | .fault(fault_FNO1) |
---|
| 26 | ); |
---|
| 27 | |
---|
| 28 | LShapedWire LSW1( |
---|
| 29 | .in(m1), |
---|
| 30 | .out(m4), |
---|
| 31 | .fault(fault_LSW1) |
---|
| 32 | ); |
---|
| 33 | |
---|
| 34 | Inverter INV1 ( |
---|
| 35 | .in (m4), |
---|
| 36 | .out(m5), |
---|
| 37 | .fault(fault_INV1) |
---|
| 38 | ); |
---|
| 39 | reg i3=1'b1; |
---|
| 40 | MajorityVoter MV2 ( |
---|
| 41 | .A(m5l), |
---|
| 42 | .B(m14), |
---|
| 43 | .C(i3), |
---|
| 44 | .out(m6), |
---|
| 45 | .fault1(fault1_MV2), |
---|
| 46 | .fault0(fault0_MV2) |
---|
| 47 | ); |
---|
| 48 | |
---|
| 49 | LShapedWire LSW2( |
---|
| 50 | .in(m6l), |
---|
| 51 | .out(m7), |
---|
| 52 | .fault(fault_LSW2) |
---|
| 53 | ); |
---|
| 54 | wire i2=d_in; |
---|
| 55 | Fanout FNO2( |
---|
| 56 | .in (i2l), |
---|
| 57 | .out1 (m14), |
---|
| 58 | .out2 (m13), |
---|
| 59 | .fault(fault_FNO2) |
---|
| 60 | ); |
---|
| 61 | |
---|
| 62 | MajorityVoter MV1 ( |
---|
| 63 | .A(m2l), |
---|
| 64 | .B(1'b0), |
---|
| 65 | .C(m13), |
---|
| 66 | .out(m12), |
---|
| 67 | .fault1(fault1_MV1), |
---|
| 68 | .fault0(fault0_MV1) |
---|
| 69 | ); |
---|
| 70 | wire m15=m12l; |
---|
| 71 | MajorityVoter MV3 ( |
---|
| 72 | .A(m15l), |
---|
| 73 | .B(m9l), |
---|
| 74 | .C(m7l), |
---|
| 75 | .out(m8), |
---|
| 76 | .fault1(fault1_MV3), |
---|
| 77 | .fault0(fault0_MV3) |
---|
| 78 | ); |
---|
| 79 | wire m16=m8l; |
---|
| 80 | LShapedWire LSW3( |
---|
| 81 | .in(m11), |
---|
| 82 | .out(m10), |
---|
| 83 | .fault(fault_LSW3) |
---|
| 84 | ); |
---|
| 85 | |
---|
| 86 | Fanout FNO3( |
---|
| 87 | .in (m16l), |
---|
| 88 | .out1 (out), |
---|
| 89 | .out2 (m11), |
---|
| 90 | .fault(fault_FNO3) |
---|
| 91 | ); |
---|
| 92 | |
---|
| 93 | LShapedWire LSW4( |
---|
| 94 | .in(m10l), |
---|
| 95 | .out(m9), |
---|
| 96 | .fault(fault_LSW5) |
---|
| 97 | ); |
---|
| 98 | initial |
---|
| 99 | begin |
---|
| 100 | fault_FNO1=0; |
---|
| 101 | fault_LSW1=0; |
---|
| 102 | fault_INV1=0; |
---|
| 103 | fault1_MV2=0; |
---|
| 104 | fault0_MV2=0; |
---|
| 105 | fault_FNO2=0; |
---|
| 106 | fault_LSW2=0; |
---|
| 107 | fault_FNO3=0; |
---|
| 108 | fault_LSW5=0; |
---|
| 109 | fault_LSW3=0; |
---|
| 110 | fault1_MV3=0; |
---|
| 111 | fault0_MV3=0; |
---|
| 112 | fault1_MV1=0; |
---|
| 113 | fault0_MV1=0; |
---|
| 114 | m5l=1'bz; |
---|
| 115 | i2l=1'bz; |
---|
| 116 | m2l=1'bz; |
---|
| 117 | m12l=1'bz; |
---|
| 118 | m15l=1'bz; |
---|
| 119 | m7l=1'bz; |
---|
| 120 | m8l=1'b0; |
---|
| 121 | m6l=1'bz; |
---|
| 122 | m16l=1'bz; |
---|
| 123 | m10l=1'bz; |
---|
| 124 | m9l=1'bz; |
---|
| 125 | write=0; |
---|
| 126 | d_in=0; |
---|
| 127 | /* clk1= 1'b0; |
---|
| 128 | clk2=1'b0; |
---|
| 129 | clk3=1'b0; |
---|
| 130 | clk0=1'b0;*/ |
---|
| 131 | #2.5 clk1 = 1; |
---|
| 132 | #2.5 clk2 = 1; |
---|
| 133 | #2.5 clk3 = 1; |
---|
| 134 | #2.5 clk0 = 1; |
---|
| 135 | end |
---|
| 136 | |
---|
| 137 | always |
---|
| 138 | begin |
---|
| 139 | #20 write=!write; |
---|
| 140 | #40 d_in=!d_in; |
---|
| 141 | end |
---|
| 142 | |
---|
| 143 | always@(posedge clk1) |
---|
| 144 | //violet! |
---|
| 145 | begin |
---|
| 146 | m5l=m5; |
---|
| 147 | i2l=i2; |
---|
| 148 | m2l=m2; |
---|
| 149 | m16l=m16; |
---|
| 150 | clk1 = #5 ~clk1; |
---|
| 151 | end |
---|
| 152 | always@(negedge clk1) |
---|
| 153 | begin |
---|
| 154 | m5l=1'bZ; |
---|
| 155 | m2l=1'bZ; |
---|
| 156 | i2l=1'bZ; |
---|
| 157 | m16l=1'bZ; |
---|
| 158 | clk1 = #5 ~clk1; |
---|
| 159 | end |
---|
| 160 | |
---|
| 161 | always@(posedge clk2) |
---|
| 162 | //blue |
---|
| 163 | begin |
---|
| 164 | m12l=m12; |
---|
| 165 | m6l=m6; |
---|
| 166 | m10l=m10; |
---|
| 167 | clk2 <= #5 ~clk2; |
---|
| 168 | end |
---|
| 169 | |
---|
| 170 | always@(negedge clk2) |
---|
| 171 | begin |
---|
| 172 | m12l=1'bZ; |
---|
| 173 | m6l=1'bZ; |
---|
| 174 | m10l=1'bZ; |
---|
| 175 | clk2 <= #5 ~clk2; |
---|
| 176 | end |
---|
| 177 | |
---|
| 178 | always@(posedge clk3) |
---|
| 179 | //white |
---|
| 180 | begin |
---|
| 181 | m7l=m7; |
---|
| 182 | m15l=m15; |
---|
| 183 | m9l=m9; |
---|
| 184 | clk3 <= #5 ~clk3; |
---|
| 185 | end |
---|
| 186 | |
---|
| 187 | always@(negedge clk3) |
---|
| 188 | begin |
---|
| 189 | m7l=1'bz; |
---|
| 190 | m15l=1'bz; |
---|
| 191 | m9l=1'bz; |
---|
| 192 | clk3 <= #5 ~clk3; |
---|
| 193 | end |
---|
| 194 | |
---|
| 195 | always@(posedge clk0) |
---|
| 196 | //green |
---|
| 197 | begin |
---|
| 198 | m8l=m8; |
---|
| 199 | clk0 <= #5 ~clk0; |
---|
| 200 | end |
---|
| 201 | |
---|
| 202 | always@(negedge clk0) |
---|
| 203 | begin |
---|
| 204 | m8l=1'bZ; |
---|
| 205 | clk0 <= #5 ~clk0; |
---|
| 206 | end |
---|
| 207 | |
---|
| 208 | |
---|
| 209 | |
---|
| 210 | endmodule |
---|
| 211 | |
---|
| 212 | |
---|
Note: See
TracBrowser
for help on using the repository browser.