instr_multicycle_done is not asserted, continuous register writes
While executing the code shown below:
We see this incorrect behavior in the core:

As shown, the addi instruction at PC 0x80000088 appears to correctly load register x13 with the value 0xa5a5a5a5, but at the very next instruction (PC: 0x8000008c), we can see from the trace log that x13 now has the value 0xa5a5de17.

From the waveform, rf_reg[13] is written correctly by the addi after adding the immediate value 0x5a5 (alu_operand_b_i), and becomes 0xa5a5a5a5. After this, the testbench does not assert the instr_gnt_i for a number of cycles, leading the core to stay in the DECODE phase while waiting for the next instruction fetch. However, we see that rf_reg[13] keeps getting written with the incremented values of alu_result in every consecutive cycle that the core waits, as instr_multicycle_done_q in the ID stage does not go high after the addi finishes. This keeps regfile_we at 1, causing the continuous writes.
Hi @udinator ,
thanks for reporting the issue and tracking down the bug! instr_multicycle_done_q is only used for multicycle instructions and currently prevents instr_executing from being deasserted for normal instructions stalled due to the instruction fetch stage. I will prepare fix for it.
Best,
Pirmin