aboutsummaryrefslogtreecommitdiff
path: root/src/rom.v
blob: d93ef07efaf6d1c07524edd77da371bbd8d03bfd (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
module rom #(
  parameter N = 32, 
  parameter SIZE = 1024
)(
    input clk,
    input [N-1:0] addr,
    output reg [N-1:0] data_read
);

`include "include/log2.vh"


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

initial begin
  $readmemh("build/rom.hex", mem, 0, SIZE-1);
end

always @(negedge clk) begin
  data_read <= mem[addr >> 2];
end

endmodule