[dv] Mask read-only fields in CSR test generator (Fixes #1337)#2442
[dv] Mask read-only fields in CSR test generator (Fixes #1337)#2442RKNAGA18 wants to merge 1 commit into
Conversation
|
Hi @RKNAGA18, thanks again for your interest in this. Did you see any improvement when running tests from this change? Only, I'm a little worried that the current spec ("The RISC-V Instruction Set Manual, Volume II - Privileged Architecture - Version 20260120") seems to claim that writing to read-only fields would not generate an illegal instruction:
|
|
Hi @elliotb-lowrisc, I actually misstated the failure mechanism in my PR description, Thank you for pulling the exact ISA spec. |
This PR pivots to fixing the root cause of the timeouts (Bullet Point 1 of #1337): the Python script generates csrrw/csrrs/csrrc instructions that attempt to overwrite RO (Read-Only) fields, which triggers an Illegal Instruction exception in the hardware and hangs the simulation.
Changes
Modified the data generation loop in gen_csr_test.py.
Before writing the raw rand_rs1_val to the assembly payload, it is now passed through the internal csr_write() function to explicitly mask out read-only bits based on the YAML definitions.
Generated a .patch file in vendor/patches/google_riscv-dv/ to persist this fix across upstream vendor updates.
Impact
The generated assembly now strictly respects read-only boundaries. It prevents the core from triggering hardware exceptions during standard register checks, eliminating the timeouts without breaking reset value predictions.