VexRiscv icon indicating copy to clipboard operation
VexRiscv copied to clipboard

[Bug] CSR writes to cycle/instret do not raise illegal-instruction

Open canxin121 opened this issue 1 month ago • 1 comments

Reproduction

Minimal program (user_code only):

li x17, 1
csrrs x18, cycle, x17
csrrs x19, instret, x17

Issue

  • Expected: cycle and instret are read-only CSRs; csrrs with rs1!=x0 should raise illegal-instruction and must not write back to GPRs.
  • Actual: Spike raises illegal-instruction on both instructions; VexRiscv does not trap and retires normally, updating x18/x19 with the counter values.

canxin121 avatar Nov 24 '25 14:11 canxin121

Hi,

Yes right. That would need to be fixed.

Dolu1990 avatar Nov 24 '25 14:11 Dolu1990