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

Simplify mstatus[SD] bit handling #717

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

Timmmm
Copy link
Collaborator

@Timmmm Timmmm commented Feb 6, 2025

I'm not sure why we didn't think of this before, but you can have the SD field positioned relative to xlen, so it's at 63 on RV64 and 31 on RV31. This simplifies the code a lot.

Note #683 has an alternative solution that just calculates SD on read, but I'm not sure we need that after this simplification. In any case we can still do it if desired.

I'm not sure why we didn't think of this before, but you can have the SD field positioned relative to xlen, so it's at 63 on RV64 and 31 on RV31. This simplifies the code a lot.
@Timmmm
Copy link
Collaborator Author

Timmmm commented Feb 6, 2025

@KotorinMinami fyi

Copy link

github-actions bot commented Feb 6, 2025

Test Results

392 tests  ±0   392 ✅ ±0   1m 20s ⏱️ -1s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 40b1ad6. ± Comparison against base commit 0d48a16.

Copy link
Collaborator

@jordancarlin jordancarlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great solution! I don't know how we didn't think of this before.

@radimkrcmar
Copy link
Contributor

It was like this before the patch from @KotorinMinami, so I thought it was somehow not desired.

The dynamic SD bit has three advantages

  • dynamic xlen doesn't need to shuffle the bit around
  • we don't need to increase mstatus size to 128 when RV128 lands
  • internal sail code cannot make a mistake and use the SD bit with incorrect value

I'll have time to rebase this weekend, so we can discuss it there.

@Timmmm
Copy link
Collaborator Author

Timmmm commented Feb 6, 2025

It was like this before the patch from @KotorinMinami, so I thought it was somehow not desired.

Oops so it was. I guess I was just being dumb!

@Timmmm Timmmm added the will be merged Scheduled to be merged in a few days if nobody objects label Feb 6, 2025
@Timmmm Timmmm merged commit 9fc6e8a into riscv:master Feb 10, 2025
2 checks passed
@Timmmm Timmmm deleted the user/timh/sd_simplification branch February 17, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
will be merged Scheduled to be merged in a few days if nobody objects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants