Copied wb_1master back from quad radio
[debian/gnuradio] / usrp2 / fpga / control_lib / fifo_2clock_casc.v
1
2 module fifo_2clock_casc
3   #(parameter DWIDTH=32, AWIDTH=9)
4     (input wclk, input [DWIDTH-1:0] datain, input write, output full, output [AWIDTH-1:0] level_wclk,
5      input rclk, output [DWIDTH-1:0] dataout, input read, output empty, output [AWIDTH-1:0] level_rclk,
6      input arst);
7
8    wire    full_int, empty_int, full_int2, empty_int2, transfer, transfer2;
9    wire [DWIDTH-1:0] data_int, data_int2;
10    
11    shortfifo #(.WIDTH(DWIDTH)) shortfifo
12      (.clk(wclk), .rst(arst), .clear(0),
13       .datain(datain), .write(write), .full(full),
14       .dataout(data_int), .read(transfer), .empty(empty_int) );
15
16    assign  transfer = ~full_int & ~empty_int;
17    
18    fifo_2clock #(.DWIDTH(DWIDTH),.AWIDTH(AWIDTH)) fifo_2clock
19      (.wclk(wclk), .datain(data_int), .write(transfer), .full(full_int), .level_wclk(level_wclk),
20       .rclk(rclk), .dataout(data_int2), .read(transfer2), .empty(empty_int2), .level_rclk(level_rclk),
21       .arst(arst) );
22
23    assign  transfer2 = ~full_int2 & ~empty_int2;
24
25    shortfifo #(.WIDTH(DWIDTH)) shortfifo2
26      (.clk(rclk), .rst(arst), .clear(0),
27       .datain(data_int2), .write(transfer2), .full(full_int2),
28       .dataout(dataout), .read(read), .empty(empty) );
29    
30 endmodule // fifo_2clock_casc
31