Revision 1,
961 bytes
checked in by ttvmrc00, 14 years ago
(diff) |
upload iniziale
|
Rev | Line | |
---|
[1] | 1 | module MajorityVoter_4 (A, B, C, Zp,status, fault1, fault0); |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | input [1:0] status; //status 00=relax, 01=switch, 10=hold, 11=release |
---|
| 5 | input A,B,C; |
---|
| 6 | input fault1, fault0; |
---|
| 7 | output Zp; |
---|
| 8 | wor wi1, wi2, wi3; |
---|
| 9 | |
---|
| 10 | wor Zp; |
---|
| 11 | reg 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 forward = (Z===1'bz && Zp!==1'bz) ? 1: (Zp===1'bz && Z!==1'bz) ? 0 : 1'bz; |
---|
| 16 | //assign latch_sig = ~status[0] & status[1]; |
---|
| 17 | assign wi1 = ((A & B) | (B & C) | (A & C)); |
---|
| 18 | |
---|
| 19 | assign wi3 = ((~A & B) | (B & ~C) | (~A & ~C)); |
---|
| 20 | |
---|
| 21 | assign wi2 = (fault1)? B : wi1; |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | assign Zp = (status==2'b10) ? latchZp : |
---|
| 25 | (status==2'b01) ? ((fault0) ? ((wi3===1'bx) ? 1'bz: wi3) : ((wi2===1'bx) ? 1'bz : wi2) ): |
---|
| 26 | 1'bz; |
---|
| 27 | |
---|
| 28 | initial |
---|
| 29 | begin |
---|
| 30 | latchZp =1'bZ; |
---|
| 31 | end |
---|
| 32 | always@(posedge status[1]) |
---|
| 33 | begin |
---|
| 34 | latchZp <= Zp===1'bx ? 1'bz :Zp; |
---|
| 35 | end |
---|
| 36 | always@(posedge status[1]) |
---|
| 37 | begin |
---|
| 38 | latchZp <= 1'bz; |
---|
| 39 | end |
---|
| 40 | |
---|
| 41 | endmodule |
---|
Note: See
TracBrowser
for help on using the repository browser.