blob: 541096ec0ea32d3f0157f5040a07deb7449d7a0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
|