From f3a300ce5927cad9ecf02821b3be007f9d2af22b Mon Sep 17 00:00:00 2001 From: dianshi Date: Wed, 19 Jan 2022 22:00:08 +0000 Subject: Add instruction memory --- instrmem/v0.1/instr_memory.v | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 instrmem/v0.1/instr_memory.v (limited to 'instrmem/v0.1/instr_memory.v') diff --git a/instrmem/v0.1/instr_memory.v b/instrmem/v0.1/instr_memory.v new file mode 100644 index 0000000..943d358 --- /dev/null +++ b/instrmem/v0.1/instr_memory.v @@ -0,0 +1,18 @@ +`include "parameters.h" + +module instr_memory( + input [15:0]pc, + output [15:0]instruction +); + +reg [`col - 1:0] memory [`row_i - 1:0]; +wire [3:0] rom_addr = pc[4:1]; + +initial begin + $readmemb("test.instr",memory,0,14); +end + +assign instruction = memory[rom_addr]; + +endmodule + -- cgit v1.2.3