-
Notifications
You must be signed in to change notification settings - Fork 19
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 an implementation of the proposed CRelocate instruction #62
base: master
Are you sure you want to change the base?
Conversation
Whilst not used inside the model, sail-cheri-riscv-verif will make use of this for properties relating to the upcoming CRelocate.
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.
Commit message should probably reference CTSRD-CHERI/cheri-specification#3?
* **tag** field cleared, and its **base** and **address* replaced with | ||
* *cs1*.**base** $+$ *rs2* and *cs1*.**address** $+$ *rs2* respectively, | ||
* subject to representability. If the resulting capability is not | ||
* representable, the value of *rs2* as used for both calculations is |
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 find this sentence rather hard to parse
function getRepresentableLength(len) : xlenbits -> xlenbits = { | ||
let m = getRepresentableAlignmentMask(len); | ||
(len + ~(m)) & m | ||
} | ||
|
||
function relocateCap(cap, offset) : (Capability, CapAddrBits) -> (bool, Capability) = { | ||
let E = min(cap_max_E, unsigned(cap.E)); |
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.
This is a rather large and complex piece of code that looks like a close duplicate of other decoding code. I think this could either do with comments and/or share more code with getCapBoundsBits.
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.
Hm, parts of it do, but it's not clear how you'd really factor it out into a common function, I guess the only thing you could do is have an (a, B, T) -> (correction_base, correction_top)
helper, if that's what you mean?
No description provided.