-
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
Added support of Smepmp in Sail RISCV #196
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,9 @@ function is_CSR_defined (csr : csreg, p : Privilege) -> bool = | |
0x343 => p == Machine, // mtval | ||
0x344 => p == Machine, // mip | ||
|
||
0x747 => p == Machine, // mseccfg | ||
0x757 => p == Machine & (sizeof(xlen) == 32), // mseccfgh | ||
|
||
Comment on lines
+103
to
+105
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We recently used this code and needed to make the following change so that mseccfg does not exist when PMP is disabled: diff --git a/model/riscv_sys_control.sail b/model/riscv_sys_control.sail
index c3ac1fe..e5a8cf7 100644
--- a/model/riscv_sys_control.sail
+++ b/model/riscv_sys_control.sail
@@ -50,8 +50,8 @@ function is_CSR_defined (csr : csreg, p : Privilege) -> bool =
0x3D @ idx : bits(4) => p == Machine & sys_pmp_max_count() > unsigned(0b10 @ idx),
0x3E @ idx : bits(4) => p == Machine & sys_pmp_max_count() > unsigned(0b11 @ idx),
- 0x747 => p == Machine, // mseccfg
- 0x757 => p == Machine & (sizeof(xlen) == 32), // mseccfgh
+ 0x747 => p == Machine & sys_pmp_count() > 0, // mseccfg
+ 0x757 => p == Machine & (sizeof(xlen) == 32) & sys_pmp_count() > 0, // mseccfgh
0xB00 => p == Machine, // mcycle
0xB02 => p == Machine, // minstret There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that is strictly correct. You can have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you're right. Either way this code needs to be altered before we can merge. |
||
0x3A0 => p == Machine, // pmpcfg0 | ||
0x3A1 => p == Machine & (sizeof(xlen) == 32), // pmpcfg1 | ||
0x3A2 => p == Machine, // pmpcfg2 | ||
|
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.
For this file, we needed the following change:
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.
Hmm I think this is handled in
phys_access_check()
but maybe it makes more sense here.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, then I should probably be using that function in my work as well. Thanks! This can thus be marked as resolved with relation to this PR.