aboutsummaryrefslogtreecommitdiff
path: root/rtl/src/rom.v
blob: f32b9a0121c325e7faf45ba7faea8ca14bdb4cd5 (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
26
27
28
// rom:
// Contains instructions of program.

module rom #(
  parameter N = 32, 
  parameter SIZE = 1024,
  parameter ROM_FILE = "../../build/rom.hex"
)(
    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(ROM_FILE, mem, 0, SIZE-1);
end

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

endmodule