-
Notifications
You must be signed in to change notification settings - Fork 169
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 Sstc extension #570
base: master
Are you sure you want to change the base?
Add Sstc extension #570
Conversation
This is a rebase of #395 by @ved-rivos. The model structure has changed a bit so it required fairly extensive changes. I also added a command line flag. |
Yes, I think having a |
25ebc9e
to
ef365f8
Compare
☝️ rebased and fixed a missing |
ef365f8
to
b0a1507
Compare
@billmcspadden-riscv any idea who we could get to review this from a spec correctness point of view? |
b0a1507
to
6c6fe58
Compare
Rebased to handle the CSR rejigging. I had to move some code around to make the dependencies work. I also removed the We've been using this code for a while now with no issues found. It seems like @jscheid-ventana was the original author of the spec - if you could take a look that would be great! Otherwise I think we should just merge this. |
This adds the stimecmp[h] CSRs. It is enabled by default. The code is slightly unfortunately structured to handle CSRs that don't fit the standard permission checks. I added a TODO to improve it. Co-authored-by: Tim Hutt <[email protected]>
6c6fe58
to
471a1b4
Compare
function clause is_CSR_defined(0x14D) = extensionEnabled(Ext_S) & extensionEnabled(Ext_Sstc) | ||
function clause is_CSR_defined(0x15D) = extensionEnabled(Ext_S) & extensionEnabled(Ext_Sstc) & xlen == 32 | ||
|
||
function clause read_CSR(0x14D) = stimecmp[sizeof(xlen) - 1 .. 0] |
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.
Now we have this commit, I think this can just be xlen - 1
?
function check_Stimecmp(csr : csreg, p : Privilege) -> bool = { | ||
// Check if it is not stimecmp. | ||
if csr != 0x14D & csr != 0x15D | ||
then return true; |
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.
Nitpick: I think this would look better with the then on the preceding line like:
if csr != 0x14D & csr != 0x15D then {
return true
};
or maybe with the whole if as a single line.
I left some minor comments, but overall I also think this can just be merged. |
@@ -61,8 +70,12 @@ function check_seed_CSR (csr : csreg, p : Privilege, isWrite : bool) -> bool = { | |||
function check_CSR(csr : csreg, p : Privilege, isWrite : bool) -> bool = |
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 for this PR, but wouldn't this be cleaner as a scattered function?
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.
LGTM with @Alasdair's comment addressed
This adds the stimecmp[h] CSRs. It is enabled by default.
The code is slightly unfortunately structured to handle CSRs that don't fit the standard permission checks. I added a TODO to improve it.