-
Notifications
You must be signed in to change notification settings - Fork 159
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
Added support of newer additional PMP configuration and address CSRs #168
Conversation
Hi @martinberger @jrtc27, |
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.
Haven't methodically checked for copy/paste errors but this is what I found skimming it.
I had some ideas a while back about how to reduce the code duplication, but I don't think that should block adding this support, even if it gets rather silly.
model/riscv_csr_map.sail
Outdated
mapping clause csr_name_map = 0x3A0 <-> "pmpcfg0" | ||
mapping clause csr_name_map = 0x3A1 <-> "pmpcfg1" | ||
mapping clause csr_name_map = 0x3A2 <-> "pmpcfg2" | ||
mapping clause csr_name_map = 0x3A3 <-> "pmpcfg3" |
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.
mapping clause csr_name_map = 0x3A0 <-> "pmpcfg0" | |
mapping clause csr_name_map = 0x3A1 <-> "pmpcfg1" | |
mapping clause csr_name_map = 0x3A2 <-> "pmpcfg2" | |
mapping clause csr_name_map = 0x3A3 <-> "pmpcfg3" |
model/riscv_insts_zicsr.sail
Outdated
(0x3A7, 32) => { pmpWriteCfgReg(7, value); Some(pmpReadCfgReg(7)) }, // pmpcfg7, | ||
(0x3A8, _) => { pmpWriteCfgReg(8, value); Some(pmpReadCfgReg(8)) }, // pmpcfg8, | ||
(0x3A9, 32) => { pmpWriteCfgReg(9, value); Some(pmpReadCfgReg(9)) }, // pmpcfg9, | ||
(0x3AA, _) => { pmpWriteCfgReg(10, value); Some(pmpReadCfgReg(10))}, // pmpcfg10, |
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.
Need a space before the }
0x3ED => p == Machine, // pmpaddr61 | ||
0x3EE => p == Machine, // pmpaddr62 | ||
0x3EF => p == Machine, // pmpaddr63 | ||
|
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.
model/riscv_pmp_regs.sail
Outdated
} | ||
|
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.
model/riscv_insts_zicsr.sail
Outdated
(0x3AD, 32) => { pmpWriteCfgReg(13, value); Some(pmpReadCfgReg(13))}, // pmpcfg13, | ||
(0x3AE, _) => { pmpWriteCfgReg(14, value); Some(pmpReadCfgReg(14))}, // pmpcfg14, | ||
(0x3AF, 32) => { pmpWriteCfgReg(15, value); Some(pmpReadCfgReg(15))}, // pmpcfg15, | ||
|
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.
model/riscv_csr_map.sail
Outdated
mapping clause csr_name_map = 0x3ED <-> "pmpaddr61" | ||
mapping clause csr_name_map = 0x3EE <-> "pmpaddr62" | ||
mapping clause csr_name_map = 0x3EF <-> "pmpaddr63" | ||
|
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.
Resolved the formatting issues, empty lines and duplications |
Hello @jrtc27 @martinberger I have tested the updated SAIL model by writing tests that contain pmpcfg[4,15] and pmpaddr[16,63]. And SAIL is giving the expected result. Is there anything else to do before merging this PR? |
@Abdulwadoodd please squash the fixes back into the first commit, instead of adding a new commit to clean up the earlier one. |
Hi @scottj97, I have squashed the changes into a single (earlier) commit. |
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 is wrong, PMP configuration and address CSRs already exist, just not the newer additional ones
model/riscv_pmp_control.sail
Outdated
Machine => true, | ||
_ => false |
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.
Don't reformat this
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.
Done
model/riscv_pmp_regs.sail
Outdated
pmp17cfg = pmpWriteCfg(pmp17cfg, v[15..8]); | ||
pmp18cfg = pmpWriteCfg(pmp18cfg, v[23..16]); | ||
pmp19cfg = pmpWriteCfg(pmp19cfg, v[31..24]); | ||
pmp20cfg = pmpWriteCfg(pmp19cfg, v[39..32]); |
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.
Lots of copy/paste errors in these
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.
FIxed
Commit message updated |
This PR has no activity for almost 9 months.
|
Style looks fine |
Open questions from the golden-model meeting:
|
@ptomsich, thanks for the reminder. I will rebase it by 2nd June. |
@Abdulwadoodd Thanks for the update! I'll keep this in the queue, so we can move it forward shortly thereafter. |
Hello @Abdulwadoodd , any updates on this? |
Since the PMP CSR addresses are nicely aligned, you can somewhat reduce the crazy amount of copy and pasting like this:
( |
In fact maybe hold off on this. I have implemented the approach I mentioned above which means adding support for 64 PMPs is a 1 line change instead of a gazillion line copy/paste. I'll try to send a PR soon. |
It is completed by #350. |
This PR contains all the PMP configuration and address CSRs to support 64 PMP entries as defined by the spec