source: HDLQ/Library/FanoutC4.v @ 1

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

upload iniziale

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