~ruther/verilog-riscv-semestral-project

ref: 300c2dd744c0a39f8ca60ce97c3015c7af4c27cf verilog-riscv-semestral-project/src/program_memory.sv -rwxr-xr-x 288 bytes
300c2dd7 — Rutherther feat: add program counter 1 year, 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module program_memory
(
  input [WIDTH - 1:0] addr,
  output [31:0] instruction
);
  parameter WIDTH = 12;
  parameter MEM_SIZE = 1 << (WIDTH - 2) - 1;

  reg [31:0] imem[0:MEM_SIZE];

  initial $readmemh("memfile.dat", imem);

  assign instruction = imem[addr[WIDTH - 1:2]];

endmodule;
Do not follow this link