Revision 1,
1.2 KB
checked in by ttvmrc00, 14 years ago
(diff) |
upload iniziale
|
Rev | Line | |
---|
[1] | 1 | module CrossWire_bi4 (A, B, D, E, status, fault0, fault1); |
---|
| 2 | //forward =1 information goes A-> B D->E |
---|
| 3 | //status 00=relax,01=switch, 10=hold, 11=release |
---|
| 4 | // if ~fault1 && fault0 B(A) is ~A(~B) |
---|
| 5 | // if fault1 && ~fault0 E(~D) is ~D (~E) (interference) |
---|
| 6 | input [1:0] status; |
---|
| 7 | input fault1, fault0; |
---|
| 8 | inout A,B, D, E; |
---|
| 9 | reg loadedA,loadedB,loadedD,loadedE; |
---|
| 10 | wor A,B,C,D,E,F; |
---|
| 11 | assign C = A; |
---|
| 12 | assign C = B; |
---|
| 13 | assign F = D; |
---|
| 14 | assign F = E; |
---|
| 15 | assign B = (status == 2'b10) ? loadedB : |
---|
| 16 | (status == 2'b01) ? (fault0 ? ((~fault1) ? ~C : C) :C) : 1'bz; |
---|
| 17 | assign A = (status == 2'b10) ? loadedA : |
---|
| 18 | (status == 2'b01) ? (fault0 ? (~fault1 ? ~C : C) :C) : 1'bz; |
---|
| 19 | assign D = (status == 2'b10) ? loadedD : |
---|
| 20 | (status == 2'b01) ? (fault1 ? (~fault0 ? ~F : F) :F) : 1'bz; |
---|
| 21 | assign E = (status == 2'b10) ? loadedE : |
---|
| 22 | (status == 2'b01) ? (fault1 ? (~fault0 ? ~F : F) :F) : 1'bz; |
---|
| 23 | |
---|
| 24 | initial |
---|
| 25 | begin |
---|
| 26 | loadedA <=1'bz; |
---|
| 27 | loadedB <=1'bz; |
---|
| 28 | loadedD <=1'bz; |
---|
| 29 | loadedE <=1'bz; |
---|
| 30 | end |
---|
| 31 | always @ (posedge status[1]) |
---|
| 32 | begin |
---|
| 33 | if (status[0]==0) |
---|
| 34 | begin |
---|
| 35 | loadedA <= (A===1'bx)? 1'bz: A; |
---|
| 36 | loadedB <= (B===1'bx)? 1'bz: B; |
---|
| 37 | loadedD <= (D===1'bx)? 1'bz: D; |
---|
| 38 | loadedE <= (E===1'bx)? 1'bz: E; |
---|
| 39 | end |
---|
| 40 | end |
---|
| 41 | endmodule |
---|
Note: See
TracBrowser
for help on using the repository browser.