add trailing NOP instructions so non-initialized memory doesn't cause issues

This commit is contained in:
Brendan Haines 2021-07-02 03:14:37 -06:00
parent 9ff977c1be
commit 07d317eb6e
2 changed files with 10 additions and 4 deletions

View File

@ -32,10 +32,10 @@ wire [31:0] mem_inst_idx = mem_inst_addr >> 2;
wire [31:0] mem_inst_data = mem_inst_idx < MEM_LENGTH ? mem[mem_inst_idx] : INST_NOP; wire [31:0] mem_inst_data = mem_inst_idx < MEM_LENGTH ? mem[mem_inst_idx] : INST_NOP;
initial begin: mem_init initial begin: mem_init
integer i; // integer i;
for (i=0; i<MEM_LENGTH; i=i+1) begin // for (i=0; i<MEM_LENGTH; i=i+1) begin
mem[i] = INST_NOP; // mem[i] = INST_NOP;
end // end
$readmemh("text.hex", mem); $readmemh("text.hex", mem);
end end

View File

@ -361,6 +361,12 @@ fail:
test_jalr: test_jalr:
addi x2, x0, 0x12 # x2 = 0x12 addi x2, x0, 0x12 # x2 = 0x12
jalr x0, x1, 0 # return jalr x0, x1, 0 # return
nop
nop
nop
nop
nop
nop
.data .data