Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify the interaction between CSRRS/C and "reads as" bits #1581

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Timmmm
Copy link
Contributor

@Timmmm Timmmm commented Aug 6, 2024

pmpaddr uniquely contains writable bits that "read as" some value, but have an underlying value that can be different. The behaviour when you modify different bits in the CSR using csrr{sc}[i] was not clear.

This is the behaviour that the Sail model, SPIKE and the open-source Rocket core all implement.

`pmpaddr` uniquely contains writable bits that "read as" some value, but have an underlying value that can be different. The behaviour when you modify *different* bits in the CSR using `csrr{sc}[i]` was not clear.

This is the behaviour that the Sail model, SPIKE and the open-source Rocket core all implement.
@pdonahue-ventana
Copy link
Contributor

IIRC, this also affects mepc[1] if misa.C is writable.

@Timmmm
Copy link
Contributor Author

Timmmm commented Aug 7, 2024

Ah yes you're right:

If an implementation allows IALIGN to be either 16 or 32 (by changing CSR misa, for example), then, whenever IALIGN=32, bit mepc[1] is masked on reads so that it appears to be 0. This masking occurs also for the implicit read by the MRET instruction. Though masked, mepc[1] remains writable when IALIGN=32.

For completeness, here's the discussion on the mailing list. The proposal there (which I don't really like) is to make it implementation defined.

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.

2 participants