cva6 icon indicating copy to clipboard operation
cva6 copied to clipboard

Illegal instruction handling

Open PRugg-Cap opened this issue 5 months ago • 1 comments

I'm getting some odd errors in mtval with certain illegal instructions. mtval (when enabled) should be reported as the illegal instruction bits for all illegal instructions.

However, for the illegal encoding corresponding to URET (0x00200073), this doesn't happen.

Interestingly some of the illegal decode system cases set the op back to be a nop, as here:

https://github.com/openhwgroup/cva6/blob/301d11ceb88c1169f75e9dea415e4bff4eb29888/core/decoder.sv#L241-L242

I'm suspicious that without this the illegal instruction has its tval overridden somewhere else in the pipeline, despite correctly being decoded as an illegal instruction.

Adding instruction_o.op = ariane_pkg::ADD; to the fallthrough system decode case fixes this issue, but presumably other bit patterns have similar issues?

Maybe we could always set the op to be a nop at the end of decode if we detect an illegal instruction, if that's not too bad for timing?

PRugg-Cap avatar Jun 19 '25 16:06 PRugg-Cap

(Found with TestRIG fuzzing against Sail. I should say this particular bug was found in a fork of CVA6 and I haven't checked it applies to the current state of the repo, but it seems odd that instruction_o.op = ariane_pkg::ADD; is required on line 242 but not in the other cases)

PRugg-Cap avatar Jun 19 '25 16:06 PRugg-Cap