source: HDLQ/Library/wirebi4.v @ 1

Revision 1, 747 bytes checked in by ttvmrc00, 13 years ago (diff)

upload iniziale

Line 
1module 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;
9assign C =  A;
10assign C = B;
11assign B =  (status == 2'b10) ? loadedB :
12            (status == 2'b01) ?  C  : 1'bz;
13assign A =  (status == 2'b10) ? loadedA :
14            (status == 2'b01) ?  C : 1'bz;
15initial
16begin
17        loadedA <=1'bz;
18        loadedB <=1'bz;
19end
20always @ (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*/     
37endmodule
38
Note: See TracBrowser for help on using the repository browser.