Revision 1,
1.3 KB
checked in by ttvmrc00, 14 years ago
(diff) |
upload iniziale
|
Line | |
---|
1 | module MajorityVoter_bi4 (A, B, Zp, Z,status, fault1, fault0); |
---|
2 | //Z and Zp are bidirectional. |
---|
3 | |
---|
4 | input [1:0] status; //status 00=relax, 01=switch, 10=hold, 11=release |
---|
5 | inout A,B; |
---|
6 | input fault1, fault0; |
---|
7 | inout Z,Zp; |
---|
8 | wor wi1, wi2, wi3; |
---|
9 | wor wi1p, wi2p, wi3p; |
---|
10 | wor Z,Zp; |
---|
11 | reg latchZ, latchZp; |
---|
12 | // fault1=0 fault0=0 output fault free |
---|
13 | // fault1=1 fault0=0 output S a B |
---|
14 | // fault1=0(1) fault0=1 output Maj(A',B,C') |
---|
15 | assign wi1 = ((A & B) | (B & Z) | (A & Z)); |
---|
16 | assign wi1p= ((A & B) | (B & Zp) | (A & Zp)); |
---|
17 | assign wi3 = ((~A & B) | (B & ~Z) | (~A & ~Z)); |
---|
18 | assign wi3p= ((~A & B) | (B & ~Zp) | (~A & ~Zp)); |
---|
19 | assign wi2 = (fault1)? B : wi1; |
---|
20 | assign wi2p = (fault1)? B : wi1p; |
---|
21 | assign A=1'bz; |
---|
22 | assign B=1'bz; |
---|
23 | assign Zp = (status==2'b10) ? latchZp : |
---|
24 | (status==2'b01) ? ((fault0) ? ((wi3===1'bx) ? 1'bz: wi3) : ((wi2===1'bx) ? 1'bz : wi2) ): |
---|
25 | 1'bz; |
---|
26 | |
---|
27 | assign Z = (status==2'b10 ) ? latchZ: |
---|
28 | (status==2'b01 ) ? ((fault0) ? ((wi3p===1'bx )? 1'bz :wi3p) : ((wi2p===1'bx)? 1'bz : wi2p) ): |
---|
29 | 1'bz; |
---|
30 | initial |
---|
31 | begin |
---|
32 | latchZp =1'bZ; |
---|
33 | latchZ=1'bZ; |
---|
34 | end |
---|
35 | always@(posedge status[1]) |
---|
36 | begin |
---|
37 | latchZp <= Zp===1'bx ? 1'bz :Zp; |
---|
38 | latchZ <= Z===1'bx ? 1'bz :Z ; |
---|
39 | end |
---|
40 | always@(posedge status[0]) |
---|
41 | begin |
---|
42 | latchZp <= 1'bz; |
---|
43 | latchZ <= 1'bz ; |
---|
44 | end |
---|
45 | |
---|
46 | |
---|
47 | endmodule |
---|
Note: See
TracBrowser
for help on using the repository browser.