2015-04-14 23:56:00 -04:00
|
|
|
module fifo_async
|
|
|
|
(/*AUTOARG*/
|
2015-03-24 20:44:03 -04:00
|
|
|
// Outputs
|
2015-04-27 11:15:06 -04:00
|
|
|
full, prog_full, dout, empty, valid,
|
2015-03-24 20:44:03 -04:00
|
|
|
// Inputs
|
2015-05-07 23:50:34 -04:00
|
|
|
wr_rst, rd_rst, wr_clk, rd_clk, wr_en, din, rd_en
|
2015-03-24 20:44:03 -04:00
|
|
|
);
|
2015-04-14 23:56:00 -04:00
|
|
|
|
2015-11-02 16:16:10 -05:00
|
|
|
parameter DW = 104; //FIFO width
|
|
|
|
parameter DEPTH = 32; //FIFO depth
|
2015-11-04 20:01:31 -05:00
|
|
|
parameter TYPE = "XILINX";//"BASIC" or "XILINX" or "ALTERA"
|
2015-11-02 16:16:10 -05:00
|
|
|
|
2015-04-14 23:56:00 -04:00
|
|
|
//##########
|
2015-04-23 17:53:22 -04:00
|
|
|
//# RESET/CLOCK
|
2015-04-14 23:56:00 -04:00
|
|
|
//##########
|
2015-05-07 23:50:34 -04:00
|
|
|
input wr_rst; //write reset
|
|
|
|
input rd_rst; //read reset
|
2015-04-14 23:56:00 -04:00
|
|
|
input wr_clk; //write clock
|
2015-04-23 17:53:22 -04:00
|
|
|
input rd_clk; //read clock
|
|
|
|
|
|
|
|
//##########
|
|
|
|
//# FIFO WRITE
|
|
|
|
//##########
|
2015-05-07 23:50:34 -04:00
|
|
|
input wr_en;
|
2015-10-07 19:21:04 -04:00
|
|
|
input [DW-1:0] din;
|
2015-05-07 23:50:34 -04:00
|
|
|
output full;
|
|
|
|
output prog_full;
|
2015-04-14 23:56:00 -04:00
|
|
|
|
|
|
|
//###########
|
2015-04-23 17:53:22 -04:00
|
|
|
//# FIFO READ
|
2015-04-14 23:56:00 -04:00
|
|
|
//###########
|
2015-05-07 23:50:34 -04:00
|
|
|
input rd_en;
|
2015-07-02 16:59:38 -04:00
|
|
|
output [DW-1:0] dout;
|
2015-05-07 23:50:34 -04:00
|
|
|
output empty;
|
|
|
|
output valid;
|
2015-03-24 20:44:03 -04:00
|
|
|
|
2015-11-04 20:01:31 -05:00
|
|
|
|
|
|
|
generate
|
|
|
|
if(TYPE=="BASIC") begin : basic
|
2015-11-02 16:16:10 -05:00
|
|
|
fifo_async_model
|
|
|
|
#(.DEPTH(DEPTH),
|
|
|
|
.DW(DW))
|
|
|
|
fifo_model (.full (),
|
|
|
|
.prog_full (prog_full),
|
|
|
|
.almost_full (full),
|
|
|
|
/*AUTOINST*/
|
|
|
|
// Outputs
|
|
|
|
.dout (dout[DW-1:0]),
|
|
|
|
.empty (empty),
|
|
|
|
.valid (valid),
|
|
|
|
// Inputs
|
|
|
|
.wr_rst (wr_rst),
|
|
|
|
.rd_rst (rd_rst),
|
|
|
|
.wr_clk (wr_clk),
|
|
|
|
.rd_clk (rd_clk),
|
|
|
|
.wr_en (wr_en),
|
|
|
|
.din (din[DW-1:0]),
|
|
|
|
.rd_en (rd_en));
|
2015-11-04 20:01:31 -05:00
|
|
|
end
|
|
|
|
else if (TYPE=="XILINX") begin : xilinx
|
|
|
|
if((DW==104) & (DEPTH==32))
|
|
|
|
begin
|
|
|
|
fifo_async_104x32 fifo_async_104x32 (.full (),
|
|
|
|
.prog_full (prog_full),
|
|
|
|
.almost_full (full),
|
|
|
|
/*AUTOINST*/
|
|
|
|
// Outputs
|
|
|
|
.dout (dout[DW-1:0]),
|
|
|
|
.empty (empty),
|
|
|
|
.valid (valid),
|
|
|
|
// Inputs
|
|
|
|
.wr_rst (wr_rst),
|
|
|
|
.rd_rst (rd_rst),
|
|
|
|
.wr_clk (wr_clk),
|
|
|
|
.rd_clk (rd_clk),
|
|
|
|
.wr_en (wr_en),
|
|
|
|
.din (din[DW-1:0]),
|
|
|
|
.rd_en (rd_en));
|
|
|
|
|
|
|
|
end // if ((DW==104) & (DEPTH==32))
|
|
|
|
end // block: xilinx
|
|
|
|
endgenerate
|
2015-04-23 17:53:22 -04:00
|
|
|
|
2015-03-24 20:44:03 -04:00
|
|
|
endmodule // fifo_async
|
2015-04-14 23:56:00 -04:00
|
|
|
// Local Variables:
|
2015-11-04 20:01:31 -05:00
|
|
|
// verilog-library-directories:("." "../ip/xilinx/" "../dv")
|
2015-04-14 23:56:00 -04:00
|
|
|
// End:
|