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

Issues in the Handling of Critical CSR Fields in mstatus #207

Open
fly-1011 opened this issue Sep 9, 2024 · 0 comments
Open

Issues in the Handling of Critical CSR Fields in mstatus #207

fly-1011 opened this issue Sep 9, 2024 · 0 comments

Comments

@fly-1011
Copy link

fly-1011 commented Sep 9, 2024

Bug Description:

When executing the instruction csrwi mstatus, 0 on the NutShell processor, the mstatus register's SXL and UXL fields are incorrectly cleared to 0. According to the RISC-V Privileged ISA specification, these fields should retain their legal values (specifically, SXL = 10 and UXL = 10 for 64-bit systems) and should not be zeroed by a csrwi instruction. This issue is not present in Spike, the reference model, which preserves the values of these fields as expected.

Expected Behavior (RISC-V Specification):

SXL and UXL are WARL fields (Write Any, Read Legal), and their values should be preserved unless explicitly set to a new legal value.
In RV64 systems, SXL should be set to 10 to indicate a 64-bit S-mode, and UXL should be set to 10 to indicate a 64-bit U-mode.

Screenshots
image

image

Environment
Nutshell version = commit fa8de48

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

No branches or pull requests

1 participant