diff options
Diffstat (limited to 'rtl/src/ram.v')
-rw-r--r-- | rtl/src/ram.v | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/rtl/src/ram.v b/rtl/src/ram.v new file mode 100644 index 0000000..541096e --- /dev/null +++ b/rtl/src/ram.v @@ -0,0 +1,23 @@ +module ram #( + parameter N = 32, + parameter SIZE = 1024 +)( + input clk, + input rstn, + input we, + input [N-1:0] addr, + input [N-1:0] data_write, + output reg [N-1:0] data_read +); + +`include "include/log2.vh" + +//(* RAM_STYLE="BLOCK" *) +reg [N-1:0] mem [0:SIZE-1]; + +always @(posedge clk) begin + if (we) mem[addr >> 2] <= data_write; + data_read <= mem[addr >> 2]; +end + +endmodule |