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