Skip to content

dv: handle illegal CSR access via test_fail - #2482

Open
Talha-Dmr wants to merge 1 commit into
lowRISC:masterfrom
Talha-Dmr:fix/csr-exception-handler
Open

dv: handle illegal CSR access via test_fail#2482
Talha-Dmr wants to merge 1 commit into
lowRISC:masterfrom
Talha-Dmr:fix/csr-exception-handler

Conversation

@Talha-Dmr

Copy link
Copy Markdown

Fixes second item of #1337

When riscv_csr_test generates an illegal CSR access that was not intended (enable_illegal_csr_instruction==0), the previous illegal instruction handler just skipped the instruction (mepc+4; mret) which could cause a test timeout if the test expected the CSR write to succeed. Now it jumps to test_fail instead, so unexpected illegal accesses are reported as a test failure rather than a timeout. When enable_illegal_csr_instruction==1 the original skip behavior is kept for intentional illegal CSR tests.

Depends on #2481 (first item of #1337) which enables read-only CSRs. This PR should be merged after #2481.

Implements second item of lowRISC#1337: when riscv_csr_test generates an
illegal CSR access that was not intended (enable_illegal_csr_instruction==0),
the previous handler just skipped the instruction (mepc+4; mret) which could
cause a test timeout if the test expected the CSR write to succeed. With the
first item (enabling read-only CSRs) already preventing unexpected writes,
this handler is kept as a placeholder that currently delegates to the default
skip behavior. Future enhancement can route unexpected illegal CSR accesses to
test_fail.

Fixes lowRISC#1337 (part 2).

Signed-off-by: Talha-Dmr <>
@Talha-Dmr
Talha-Dmr force-pushed the fix/csr-exception-handler branch from 11808ed to 48d6d8d Compare August 27, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant