-
Notifications
You must be signed in to change notification settings - Fork 40
Add FFLAGS and FRM CSRs #657
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
Add FFLAGS and FRM CSRs #657
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.
Other than minor comments, all seems good, great work @neverlandiz!
@AFOliveira Thank you so much for the feedback! I've made the changes that you requested. |
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.
Sorry for the second review, but this is mostly things that I don't understand. Your PR may be ready to merge but there are somethings I would like to ask so we may discuss them before merging.
This CSRs exist inside fcsr, but instead of making some type of connection between them we are just duplicating information in most of the description, I realize UDB may not have a way to tie CSRs in "pseudo-instruction" type of way, but this may be the case of opening an issue requesting that, right? Otherwise, we will have precisely the same information in two places, which does not seem very logical.
We do have an "alias" attribute for CSR fields. There are lots of examples in arch/csr, including
|
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.
Not sure if this is handled elsewhere, but does something need to be done to make this CSR inaccessible if mstatus.FS
is 0 (only for the F extension, for Zfinx this constraint is different).
We don't currently handle it anywhere, that I see, unless it's buried under All of FCSR, FRM, FFLAGS needs that constraint added, as well as any instruction that might access it (which is why @jordancarlin, is it true that with Zfinx, only the static (embedded in the opcode) rounding mode is supported? (That's my conclusion from reading the spec.) |
Not sure that
I don't think so. With both F and Zfinx instructions the rounding mode can be statically determined from the opcode or dynamically driven by the FRM csr. When F is implemented, From section 26.7 of the unprivileged spec:
Sail represents all of this as follows:
|
In the Zfinx case, I guess Smstateen also comes into play. For Zfinx (but not F), So it seems like if F is supported, we need one set of checks for whether FCSR, FRM, and FFLAGS are supported, and if Zfinx is supported, we need a different set of checks. |
I am confused by that and this (priv 3.1.6.6):
If FS is 0, zero means "off", and the text above seems to apply to both f0-f31 and fcsr, frm, and fflags identically. What does it mean for the status of all of these registers to be identically "off"? If there is a fscr, but it's not saved/restored, how does that work? |
There was a recent, somewhat related discussion on the tech-privileged mailing list: https://lists.riscv.org/g/tech-privileged/topic/smstateen_and_ssstateen/112508172.
My understanding of this all is that when (and only when) F is supported, Zfinx is a completely separate extension with its own set of rules. There are no f0-f31 registers, and fcsr, frm, and fflags are always accessible. When Smstateen is implemented in addition to Zfinx, there is yet another set of rules that governs this access. fcsr, frm, and fflags are only accessible when |
we have a We need to call that from sw_read/sw_write, as so:
( |
seems like we also need to update |
How timely! It's only missing a discussion about how "FS" fits in.
OK
Not explicitly stated, but OK.
OK, not sure that zero was the best choice, but here we are.
Important point there.
Ack. |
I modified |
@dhower-qc The regression tests are running into a syntax error for this part It doesn't seem to recognize the `<< operator? |
Sorry, just wait for #736 to come through. |
I didn't notice I was the bottleneck for this PR until now. Great work @neverlandiz! |
The PR addresses Issue #559 and adds the remaining F CSRs.
FFLAGS
FRM
Most of the information for the two CSRs is also included in
fcsr.yaml
sincefcsr
isfrm
+fflags
.