-
Notifications
You must be signed in to change notification settings - Fork 167
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
Make CSR definitions scattered #543
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.
Not reviewed this in detail - but the result is much cleaner IMO. Having two methods for the same thing is weird, and I believe extensions can just override the existing definitions by placing their clause first.
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.
Looked at the whole diff now. LGTM. Removing all the Some(
is quite nice as well.
Minstret and timers are overkill.
…On Fri, Sep 13, 2024, 8:50 AM Alexander Richardson ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In model/riscv_insts_zicsr.sail
<#543 (comment)>:
> if isWrite then {
let new_val : xlenbits = match op {
CSRRW => rs1_val,
CSRRS => csr_val | rs1_val,
CSRRC => csr_val & ~(rs1_val)
};
- writeCSR(csr, new_val)
+ let final_val = write_CSR(csr, new_val);
I meant I am not sure if we want every implicit read/write of a CSR to be
emitted in the logfile since that could end up being really verbose.
—
Reply to this email directly, view it on GitHub
<#543 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXROLOHWPUKOWYII3TLDRS3ZWMCVLAVCNFSM6AAAAABN4B2SIKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGMBTGQ4DGNBYHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I'll merge this in a few days if nobody objects. I think it's uncontroversial. |
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.
Once this is rebased I think it can be merged
Resolve the strange split between `read_CSR` (which is not `scattered`) and `ext_read_CSR` (which is). Same for `write_CSR` and `is_CSR_defined`. I changed the return type of `read_CSR` from `option(xlenbits)` to `xlenbits` since the code must already check `is_CSR_defined` before calling `read_CSR`. The only function that returned `None()` was the `seed` CSR in `write_seed_csr`, which actually meant you would get a weird "Unhandled write to CSR" if you wrote to `seed`. I renamed & reordered the files slightly to make the scattered mapping work, but I haven't moved any of the actual definitions yet. In future we should actually scatter them. Fixes riscv#410
21bd564
to
73f7467
Compare
Resolve the strange split between
read_CSR
(which is notscattered
) andext_read_CSR
(which is). Same forwrite_CSR
andis_CSR_defined
.I changed the return type of
read_CSR
fromoption(xlenbits)
toxlenbits
since the code must already checkis_CSR_defined
before callingread_CSR
. The only function that returnedNone()
was theseed
CSR inwrite_seed_csr
, which actually meant you would get a weird "Unhandled write to CSR" if you wrote toseed
.I renamed & reordered the files slightly to make the scattered mapping work, but I haven't moved any of the actual definitions yet. In future we should actually scatter them.
Fixes #410