diff --git a/src/id_stage.sv b/src/id_stage.sv index 58fad9b21..9fb3adaec 100644 --- a/src/id_stage.sv +++ b/src/id_stage.sv @@ -92,18 +92,18 @@ module id_stage #( assign ready_o = ~full; decoder decoder_i ( - .clk_i ( clk_i ), - .rst_ni ( rst_ni ), - .pc_i ( pc_if_i ), - .is_compressed_i ( is_compressed_i ), - .instruction_i ( instruction_i ), - .ex_i ( ex_if_i ), - .instruction_o ( decoded_instr_dc_sb ) + .clk_i ( clk_i ), + .rst_ni ( rst_ni ), + .pc_i ( pc_if_i ), + .is_compressed_i ( is_compressed_i ), + .instruction_i ( instruction_i ), + .ex_i ( ex_if_i ), + .instruction_o ( decoded_instr_dc_sb ) ); scoreboard #( - .NR_ENTRIES ( NR_ENTRIES ), - .NR_WB_PORTS ( NR_WB_PORTS ) + .NR_ENTRIES ( NR_ENTRIES ), + .NR_WB_PORTS ( NR_WB_PORTS ) ) scoreboard_i ( diff --git a/src/issue_read_operands.sv b/src/issue_read_operands.sv index 91d728220..b0788ffd3 100644 --- a/src/issue_read_operands.sv +++ b/src/issue_read_operands.sv @@ -193,7 +193,7 @@ module issue_read_operands ( operand_a_n = {52'b0, issue_instr_i.rs1}; end // or is it an immediate (including PC), this is not the case for a store - if (issue_instr_i.use_imm && (issue_instr_i.op inside {SD, SW, SH, SB})) begin + if (issue_instr_i.use_imm && ~(issue_instr_i.op inside {SD, SW, SH, SB})) begin operand_b_n = issue_instr_i.result; end // immediates are the third operands in the store case diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 000000000..39c60c5af --- /dev/null +++ b/test/.gitignore @@ -0,0 +1 @@ +*.v diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 000000000..8af9165c2 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,21 @@ +CC = riscv64-unknown-elf-gcc +OBJDUMP = riscv64-unknown-elf-objdump +ODFLAGS = +OBJCOPY = riscv64-unknown-elf-objcopy +OCFLAGS = +ASFLAGS = -c +CFLAGS = +LDFLAGS = + +TESTS = add_test + +.S.o: + $(CC) $(ASFLAGS) -o $@ $< + + +# .c.o: +# $(CC) $(CFLAGS) -o $@ -c $< +# .v: .S.o + +$(TESTS): $(TESTS).o + $(OBJCOPY) -O verilog -I elf64-little $< $@.v diff --git a/test/add_test.S b/test/add_test.S new file mode 100755 index 000000000..25bd677b8 --- /dev/null +++ b/test/add_test.S @@ -0,0 +1,16 @@ +.text + nop + nop + nop + addi x1, x0, 1 + addi x2, x0, 1 + add x3, x1, x2 + add x4, x2, x3 + add x5, x3, x4 + add x6, x4, x5 + add x7, x5, x6 + add x8, x6, x7 + add x9, x7, x8 + nop + nop + nop \ No newline at end of file