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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [basal/] [src/] [FIFOs/] [CummingsSNUG2002SJ_FIFO1/] [fifomem.v] - Blame information for rev 35

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 qaztronic
// --------------------------------------------------------------------
2
//
3
 
4
 
5
module
6
  fifomem
7
  #(
8
    parameter DATASIZE = 8,   // Memory data word width
9
    parameter ADDRSIZE = 4    // Number of mem address bits
10
  )
11
  (
12
    output [DATASIZE-1:0] rdata,
13
    input [DATASIZE-1:0]  wdata,
14
    input [ADDRSIZE-1:0]  waddr,
15
    input [ADDRSIZE-1:0]  raddr,
16
    input wclken,
17
    input wfull,
18
    input wclk
19
  );
20
 
21
`ifdef VENDORRAM
22
  // instantiation of a vendor's dual-port RAM
23
  vendor_ram
24
    mem
25
    (
26
      .dout(rdata),
27
      .din(wdata),
28
      .waddr(waddr),
29
      .raddr(raddr),
30
      .wclken(wclken),
31
      .wclken_n(wfull),
32
      .clk(wclk)
33
    );
34
`else
35
  // RTL Verilog memory model
36
  localparam DEPTH = 1<<ADDRSIZE;
37
  reg [DATASIZE-1:0] mem [0:DEPTH-1];
38
  assign rdata = mem[raddr];
39
 
40
  always @(posedge wclk)
41
    if(wclken && !wfull)
42
      mem[waddr] <= wdata;
43
 
44
`endif
45
 
46
endmodule
47
 

powered by: WebSVN 2.1.0

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