aboutsummaryrefslogtreecommitdiff
path: root/rtl/src/ram.v
blob: c0ec23142ce0cdb7912c7a527ffebb728c371aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// ram:
// Contains data section of program and is used for stack/heap, etc.

module ram #( 
  parameter           SIZE = 1024
)(
    input             clk,
    input             rstn,
    input             we,
    input      [31:0] addr,
    input      [31:0] wd,
    output reg [31:0] rd
);

`include "include/log2.vh"

//(* RAM_STYLE="BLOCK" *)
reg [31:0] mem [0:SIZE-1];

always @(posedge clk) begin
  if (we) mem[addr >> 2] <= wd; 
  rd <= mem[addr >> 2];
end

endmodule