File size: 473 Bytes
0ba037b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Single-port 64-bit word memory with synchronous read (maps to block RAM).
module word_memory #(
  parameter int DEPTH = 256
)(
  input  logic                     clk,
  input  logic                     we,
  input  logic [$clog2(DEPTH)-1:0] addr,
  input  logic [63:0]              wdata,
  output logic [63:0]              rdata
);
  logic [63:0] mem [0:DEPTH-1];
  always_ff @(posedge clk) begin
    if (we) mem[addr] <= wdata;
    rdata <= mem[addr];
  end
endmodule