-
Notifications
You must be signed in to change notification settings - Fork 40
Add Smstateen/Ssstateen Extension and CSRs #592
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
base: main
Are you sure you want to change the base?
Add Smstateen/Ssstateen Extension and CSRs #592
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments in hstateen0/hstateen0h generally apply to the others as well.
Signed-off-by: Katherine Hsu <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments apply to all the CSRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need an arch/ext/Ssstateen.yaml file.
I think there is already a Ssstateen.yaml file? |
You're right. Ignore my ignorance please ;) |
The SE0 bit in `hstateen0` controls access to the `sstateen0` CSR. | ||
type: RW | ||
reset_value: UNDEFINED_LEGAL | ||
ENVCFG: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The {h/s}stateen bits are 0 if the corresponding mstateen bit is 0. It doesn't look like that is captured here right now. I assume this needs a sw_read()
call to represent this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jordancarlin Thanks for pointing that out! Could you check if this implementation is correct (for hstateen0)?
sw_read(): |
# for every bit in an mstateen CSR that is zero, the same bit
# appears as read-only zero in the matching hstateen CSR
Bit<64> mstateen0_mask = CSR[mstateen0].csr_value;
Bit<64> hstateen0_value = csr_value & mstateen0_mask;
return hstateen0_value;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that seems reasonable. For sstateen it will probably be a little more complicated since it changes depending on if the H extension is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a sw_write()
here, too, that enforces read-only for corresponding bits that are zero in mstateen0
?
Regression tests are failing due to missing Sscsrind (depends on Issue #557) and Zfinx extensions. |
Sscsrind is going in as we speak.
I don't even see an issue open for that. :-/ |
There are still a couple of unresolved comments about changing a reset_value and adding a As for Zfinx, I'd be tempted to comment it out in the PR, since Zfinx isn't even started, then open an issue for Zfinx to be added, including a note to uncomment the content here. |
Ok, sounds good. Should I open an issue for Zfinx? I'm still working on resolving the remaining comments, but I'll probably finish them by the end of today. |
#711 adds the Zfinx (and other Z*inx) extensions. |
Ah, so it does. I searched issues and PRs, but unsurprisingly didn't search for Z.*f.*inx. Still, that PR and this one depend on each other. I suggest proceeding as planned... comment out Zfinx here, and move this one along. @neverlandiz , if you would, please add a comment there requesting that your commented out content be uncommented via that PR. |
Sounds good, thanks! |
This PR addresses Issue #547 and adds the Smstateen extension, along with the following Smstateen/Ssstateen CSRs