OpenCores
URL https://opencores.org/ocsvn/ethmac/ethmac/trunk

Subversion Repositories ethmac

[/] [ethmac/] [trunk/] [rtl/] [verilog/] [eth_fifo.v] - Diff between revs 94 and 100

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 94 Rev 100
Line 39... Line 39...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.2  2002/03/25 13:33:04  mohor
 
// When clear and read/write are active at the same time, cnt and pointers are
 
// set to 1.
 
//
// Revision 1.1  2002/02/05 16:44:39  mohor
// Revision 1.1  2002/02/05 16:44:39  mohor
// Both rx and tx part are finished. Tested with wb_clk_i between 10 and 200
// Both rx and tx part are finished. Tested with wb_clk_i between 10 and 200
// MHz. Statuses, overrun, control frame transmission and reception still  need
// MHz. Statuses, overrun, control frame transmission and reception still  need
// to be fixed.
// to be fixed.
//
//
//
//
 
 
 
`include "eth_defines.v"
`include "timescale.v"
`include "timescale.v"
 
 
module eth_fifo (data_in, data_out, clk, reset, write, read, clear, almost_full, full, almost_empty, empty);
module eth_fifo (data_in, data_out, clk, reset, write, read, clear, almost_full, full, almost_empty, empty, cnt);
 
 
parameter DATA_WIDTH    = 32;
parameter DATA_WIDTH    = 32;
parameter DEPTH         = 8;
parameter DEPTH         = 8;
parameter CNT_WIDTH     = 4;
parameter CNT_WIDTH     = 4;
 
 
Line 68... Line 73...
output  [DATA_WIDTH-1:0]  data_out;
output  [DATA_WIDTH-1:0]  data_out;
output                    almost_full;
output                    almost_full;
output                    full;
output                    full;
output                    almost_empty;
output                    almost_empty;
output                    empty;
output                    empty;
 
output  [CNT_WIDTH-1:0]   cnt;
 
 
 
`ifdef ETH_FIFO_XILINX
 
`else
reg     [DATA_WIDTH-1:0]  fifo  [0:DEPTH-1];
reg     [DATA_WIDTH-1:0]  fifo  [0:DEPTH-1];
 
`endif
 
 
reg     [CNT_WIDTH-1:0]   cnt;
reg     [CNT_WIDTH-1:0]   cnt;
reg     [CNT_WIDTH-2:0]   read_pointer;
reg     [CNT_WIDTH-2:0]   read_pointer;
reg     [CNT_WIDTH-2:0]   write_pointer;
reg     [CNT_WIDTH-2:0]   write_pointer;
 
 
 
 
Line 119... Line 129...
assign empty = ~(|cnt);
assign empty = ~(|cnt);
assign almost_empty = cnt == 1;
assign almost_empty = cnt == 1;
assign full  = cnt == DEPTH;
assign full  = cnt == DEPTH;
assign almost_full  = &cnt[CNT_WIDTH-2:0];
assign almost_full  = &cnt[CNT_WIDTH-2:0];
 
 
 
 
 
 
 
`ifdef ETH_FIFO_XILINX
 
  xilinx_dist_ram_16x32 fifo
 
  ( .data_out(data_out),
 
    .we(write & ~full),
 
    .data_in(data_in),
 
    .read_address( clear ? {CNT_WIDTH-1{1'b0}} : read_pointer),
 
    .write_address(clear ? {CNT_WIDTH-1{1'b0}} : write_pointer),
 
    .wclk(clk)
 
  );
 
`else
always @ (posedge clk)
always @ (posedge clk)
begin
begin
 
    if(write & clear)
 
      fifo[0] <=#Tp data_in;
 
    else
  if(write & ~full)
  if(write & ~full)
    fifo[write_pointer] <=#Tp data_in;
    fifo[write_pointer] <=#Tp data_in;
end
end
 
 
assign data_out = fifo[read_pointer];
  assign data_out = clear ? fifo[0] : fifo[read_pointer];
 
`endif
 
 
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.