RVSCC/rtl/InstructionMemory.sv

20 lines
453 B
Systemverilog
Raw Normal View History

2023-01-01 22:28:56 +00:00
`timescale 1ns / 1ps
// N = Bit width
module InstructionMemory #(
2023-01-29 04:55:22 +00:00
parameter int N = 32,
parameter int N_INSTR = 32,
parameter int BYTE_WIDTH = 8
) (
input logic [N-1:0] addr,
output logic [N-1:0] instr
2023-01-01 22:28:56 +00:00
);
2023-01-29 04:55:22 +00:00
logic [BYTE_WIDTH-1:0] mem[N_INSTR*BYTE_WIDTH-1:0];
2023-01-01 22:28:56 +00:00
2023-01-29 04:55:22 +00:00
always_comb begin
instr = {mem[addr+'d0], mem[addr+'d1], mem[addr+'d2], mem[addr+'d3]};
end
2023-01-01 22:28:56 +00:00
2023-01-29 04:55:22 +00:00
initial $readmemh("sandbox.mem", mem);
2023-01-01 22:28:56 +00:00
endmodule