-
Notifications
You must be signed in to change notification settings - Fork 164
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
Fix RV64F compilation, simplify fmv implementation, and make nan boxing functions generic #594
base: master
Are you sure you want to change the base?
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.
Minor nit: The title of the commit sounds like there is an implementation bug. Maybe Fix RV64F compilation and simplify fmv implementation
?
Change LGTM.
60448aa
to
feb2e2d
Compare
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.
Looks good with the latest changes. A nice cleanup + fixes a clear problem with building the model.
feb2e2d
to
7e1e5f3
Compare
Btw
Ok actually that's not quite true.
And also
Very cool though right? IMO we should do this in future and switch the |
Yes this looks much nicer! |
Definitely nicer that way. For now you could put the logic for the matching in the |
Yeah, having the suffixed versions be wrappers around the integer-taking version was what I was imagining. |
This simplifies the code and allows easily supporting the Q extension.
Simplify the implementations with fewer intermediate variables, and fix compilation of RV64F. I also added relevant quote from the spec because the spec for these instructions is very confusing. This is a prime candidate for getting Sail code into the spec.
7e1e5f3
to
0b8ff1e
Compare
Ok I updated it to this. |
function nan_box(n, x) = ones('m - 'n) @ x | ||
|
||
// When an n-bit float is stored ina smaller m-bit register it is "unboxed" | ||
// - only if it is a valid boxed NaN. Otherwise a canonical NaN value is stored. |
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 just stored, using as an input to some computation sees the same thing, right? As in this is just a property of any read of a non-NaN-boxed 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.
And in particular transfer instructions (FLn/FSn/FMV.n.X/FMV.X.n) don't do this, despite storing in a smaller register.
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.
Ah yeah you're right I didn't really describe it correctly (and I think the spec is not especially readable). How about this:
// Except for floating-point transfer instructions (FSn and FMV.n.X),
// n-bit reads of a >n-bit floating point register "unboxes" the value stored
// in the register. If the register does not contain a valid boxed value
// then a canonical NaN value is returned instead.
and
// n-bit writes to a >n-bit floating point register "boxes" the value
// by prepending 1s, which turn it into a qNaN.
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.
(un)boxes should be (un)box as you have plural reads/writes, but yes that looks ok to me otherwise
Co-authored-by: Jessica Clarke <[email protected]> Signed-off-by: Tim Hutt <[email protected]>
Co-authored-by: Jessica Clarke <[email protected]> Signed-off-by: Tim Hutt <[email protected]>
Simplify the implementations with fewer intermediate variables, and fix compilation of RV64F.
I also added relevant quote from the spec because the spec for these instructions is very confusing. This is a prime candidate for getting Sail code into the spec.
Fixes #556