From 09951ed9ba4758cc7cced26c1f673545284c5cf3 Mon Sep 17 00:00:00 2001 From: Matt Ettus Date: Wed, 2 Sep 2009 17:56:26 -0700 Subject: major cleanup of 2 clock fifos --- control_lib/newfifo/.gitignore | 1 + control_lib/newfifo/fifo_2clock.v | 32 +++--- control_lib/newfifo/fifo_2clock_cascade.v | 44 +++++---- control_lib/newfifo/fifo_new_tb.v | 158 ------------------------------ control_lib/newfifo/fifo_tb.v | 158 ++++++++++++++++++++++++++++++ 5 files changed, 206 insertions(+), 187 deletions(-) create mode 100644 control_lib/newfifo/.gitignore delete mode 100644 control_lib/newfifo/fifo_new_tb.v create mode 100644 control_lib/newfifo/fifo_tb.v diff --git a/control_lib/newfifo/.gitignore b/control_lib/newfifo/.gitignore new file mode 100644 index 000000000..cba7efc8e --- /dev/null +++ b/control_lib/newfifo/.gitignore @@ -0,0 +1 @@ +a.out diff --git a/control_lib/newfifo/fifo_2clock.v b/control_lib/newfifo/fifo_2clock.v index 23a6f693c..40c479db7 100644 --- a/control_lib/newfifo/fifo_2clock.v +++ b/control_lib/newfifo/fifo_2clock.v @@ -1,23 +1,31 @@ -module newfifo_2clock - #(parameter DWIDTH=32, AWIDTH=9) - (input wclk, input [DWIDTH-1:0] datain, input src_rdy_i, output dst_rdy_o, output reg [AWIDTH-1:0] level_wclk, - input rclk, output [DWIDTH-1:0] dataout, output src_rdy_o, input dst_rdy_i, output reg [AWIDTH-1:0] level_rclk, - input arst); +// FIXME ignores the AWIDTH (fifo size) parameter - wire full, empty, write, read; +module fifo_2clock + #(parameter WIDTH=32, SIZE=9) + (input wclk, input [WIDTH-1:0] datain, input src_rdy_i, output dst_rdy_o, output [15:0] space, + input rclk, output [WIDTH-1:0] dataout, output src_rdy_o, input dst_rdy_i, output [15:0] occupied, + input arst); + + wire [SIZE-1:0] level_rclk, level_wclk; + wire full, empty, write, read; assign dst_rdy_o = ~full; assign src_rdy_o = ~empty; assign write = src_rdy_i & dst_rdy_o; assign read = src_rdy_o & dst_rdy_i; - -//`define USE_XLNX_FIFO 1 -`ifdef USE_XLNX_FIFO + fifo_xlnx_512x36_2clk mac_tx_fifo_2clk (.rst(rst), - .wr_clk(wclk),.din(datain),.full(full),.wr_en(write),.wr_data_count(fifo_occupied[8:0]), - .rd_clk(rclk),.dout(dataout),.empty(empty),.rd_en(read),.rd_data_count() ); + .wr_clk(wclk),.din(datain),.full(full),.wr_en(write),.wr_data_count(level_wclk), + .rd_clk(rclk),.dout(dataout),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) ); + + assign occupied = {{(16-SIZE){1'b0}},level_rclk}; + assign space = ((1<