From f0166f1954705418dc56364f723881e8947c2a27 Mon Sep 17 00:00:00 2001 From: Brendan Haines Date: Sat, 14 Nov 2020 23:13:24 -0700 Subject: [PATCH] load (word only) appears to be working --- hdl/core.v | 9 ++++++--- sim/core_tb.wcfg | 14 +++++++++++--- test/test.S | 50 +++++++++++++++++++++++++++--------------------- 3 files changed, 45 insertions(+), 28 deletions(-) diff --git a/hdl/core.v b/hdl/core.v index b7b2e7d..e68e18c 100644 --- a/hdl/core.v +++ b/hdl/core.v @@ -256,9 +256,12 @@ always @(*) begin default: s_id_invalid = 1; endcase end - // OP_LOAD: begin - - // end + OP_LOAD: begin + s_id_load = 1; + s_id_s1 = regfile[s_id_rs1]; + s_id_s2 = s_id_immed_itype; + // TODO: finish parsing (byte vs word. For now always assume word) + end OP_STORE: begin s_id_store = 1; s_id_s1 = regfile[s_id_rs1]; diff --git a/sim/core_tb.wcfg b/sim/core_tb.wcfg index 2cd9504..eff36d7 100644 --- a/sim/core_tb.wcfg +++ b/sim/core_tb.wcfg @@ -468,9 +468,9 @@ r_wb_rd[4:0] UNSIGNEDDECRADIX - - r_wb_ra - r_wb_ra + + r_wb_ra[31:0] + r_wb_ra[31:0] r_wb_load_data[31:0] @@ -482,6 +482,14 @@ r_wb_alu_out[31:0] HEXRADIX + + r_wb_jump + r_wb_jump + + + r_wb_load + r_wb_load + s_wb_data[31:0] s_wb_data[31:0] diff --git a/test/test.S b/test/test.S index a17eec7..d815074 100644 --- a/test/test.S +++ b/test/test.S @@ -210,28 +210,34 @@ test9: test10: addi x30, x0, 10 # x30 = 10 - # # now for some memory stuff - # # sw - # la x9, someint # x9 = start of .bss - # lui x10, 0x12345 # x10 = 0x12345000 - # addi x10, x10, 0x678 # x10 = 0x12345678 - # nop - # nop - # nop - # nop - # nop - # sw x10, 0(x9) # someint = 0x12345678 - # nop - # nop - # nop - # nop - # nop - # # lw x11, 0(x9) # x11 = 0x12345678 - # nop - # nop - # nop - # nop - # nop + # now for some memory stuff + # sw + la x9, someint # x9 = start of .bss + lui x10, 0x12345 # x10 = 0x12345000 + addi x10, x10, 0x678 # x10 = 0x12345678 + nop + nop + nop + nop + nop + lw x11, 0(x9) # x11 = 0xfedcba98 + nop + nop + nop + nop + nop + sw x10, 0(x9) # someint = 0x12345678 + nop + nop + nop + nop + nop + lw x12, 0(x9) # x12 = 0x12345678 + nop + nop + nop + nop + nop done: