source: HDLQ/Library/Crosswire4.v @ 1

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

upload iniziale

Line 
1module CrossWire_4 (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        input A,B;
9        output  D,E;
10        reg loadedB,loadedE;
11        wor A,B,D,E;
12
13assign B =  (status == 2'b10) ? loadedB :
14            (status == 2'b01) ? (fault0 ? ((~fault1) ?  ~A : A) :A)  : 1'bz;
15
16assign E =  (status == 2'b10) ? loadedE :
17            (status == 2'b01) ? (fault1 ? (~fault0 ?  ~D : D) :D)   : 1'bz;
18           
19initial
20begin
21        loadedB <=1'bz;
22        loadedE <=1'bz;
23end
24always @ (posedge status[1])
25        begin
26                if (status[0]==0)
27                        begin
28                                loadedB <= (B===1'bx)? 1'bz: B;
29                                loadedE <= (E===1'bx)? 1'bz: E;
30                        end
31        end
32endmodule
Note: See TracBrowser for help on using the repository browser.