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

Subversion Repositories linkruncca

[/] [linkruncca/] [trunk/] [src/] [table_ram.v] - Blame information for rev 4

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

Line No. Rev Author Line
1 2 jaytang
// Quartus II Verilog Template
2
// Simple Dual Port RAM with separate read/write addresses and
3
// single read/write clock
4
/* verilator lint_off BLKSEQ */
5
 
6
module table_ram
7
#(parameter DATA_WIDTH=8, parameter ADDR_WIDTH=10)
8
(       clk,we,write_addr,data,read_addr,q);
9
 
10
        input [(DATA_WIDTH-1):0] data;
11
        input [(ADDR_WIDTH-1):0] read_addr, write_addr;
12
        input we, clk;
13
        output [(DATA_WIDTH-1):0] q;
14
 
15
        // Declare the RAM variable
16
        reg [DATA_WIDTH-1:0] ram[2**ADDR_WIDTH-1:0];
17
        reg [(ADDR_WIDTH-1):0] read_addr_reg;
18
        always @ (posedge clk)
19
        begin
20
 
21
                read_addr_reg=read_addr;
22
                // Write
23
                if (we)
24
                        ram[write_addr] = data;
25
 
26
        end
27
        assign q= ram[read_addr_reg];
28
endmodule
29
 
30
 

powered by: WebSVN 2.1.0

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