ibex icon indicating copy to clipboard operation
ibex copied to clipboard

Incorrect `mepc` value after irq is taken

Open udinator opened this issue 7 years ago • 1 comments

Hi all, During a test, this segment of code is running on the core: Screenshot from 2019-09-16 11-19-14 At PC=0x80000276 (a nop instruction), our testbench asserts a software interrupt, as shown from the waves below: Screenshot from 2019-09-16 11-23-43 However, we see that mepc_q gets set to 0x80000274 after this interrupt is detected and handling begins, meaning that after the interrupt handler has ended, the core will jump back to this address, but as you can see from the code snippet, this is a misaligned address, so Ibex immediately takes an illegal instruction exception, and fails the test. This address comes from the exception_pc, which is muxed to the value of pc_if_i, which for some reason is set to this misaligned address, and is less than the pc_id_i.

udinator avatar Sep 16 '19 18:09 udinator

Looks like the prefetch buffer changes are causing this - I'll look into it.

tomeroberts avatar Sep 17 '19 07:09 tomeroberts