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