Revision 1,
779 bytes
checked in by ttvmrc00, 14 years ago
(diff) |
upload iniziale
|
Line | |
---|
1 | module Inverter_new (A, B, status, fault); |
---|
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 | input fault; |
---|
7 | inout A,B; |
---|
8 | reg loadedA,loadedB; |
---|
9 | wor A,B,C,D,E; |
---|
10 | assign C = A; |
---|
11 | //assign C = B===1'bz ? 1'bz :!B; |
---|
12 | //assign D = B; |
---|
13 | //assign E = A; |
---|
14 | assign B = (status == 2'b10) ? loadedB : |
---|
15 | (status == 2'b01) ? (fault==0 ? !C : C): 1'bz; |
---|
16 | assign A = (status == 2'b10) ? loadedA : |
---|
17 | 1'bz; |
---|
18 | initial |
---|
19 | begin |
---|
20 | loadedA <=1'bz; |
---|
21 | loadedB <=1'bz; |
---|
22 | end |
---|
23 | |
---|
24 | //always@(posedge fault) |
---|
25 | //deassign (C); |
---|
26 | |
---|
27 | always@(posedge status[1]) |
---|
28 | begin |
---|
29 | loadedA <= (A===1'bx)? 1'bz: A; |
---|
30 | loadedB <= (B===1'bx)? 1'bz: ~A; |
---|
31 | end |
---|
32 | |
---|
33 | always@(posedge status[0]) |
---|
34 | begin |
---|
35 | loadedA <= 1'bz; |
---|
36 | loadedB <= 1'bz; |
---|
37 | end |
---|
38 | |
---|
39 | endmodule |
---|
Note: See
TracBrowser
for help on using the repository browser.