Skip to content
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

SailBugfix: pmp_cfg_idx must be multiplied by two #397

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions model_checking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,7 @@ pub fn fences() {
#[cfg_attr(kani, kani::proof)]
#[cfg_attr(test, test)]
pub fn read_csr() {
let (mut ctx, mctx, mut sail_ctx) = symbolic::new_symbolic_contexts();

// Infinite number of pmps for the formal verification
ctx.nb_pmp = usize::MAX;
let (ctx, mctx, mut sail_ctx) = symbolic::new_symbolic_contexts();

let csr_register = generate_csr_register();

Expand Down
2 changes: 1 addition & 1 deletion src/virt/csr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl RegisterContextGetter<Csr> for VirtContext {
log::warn!("Invalid pmpcfg {}", pmp_cfg_idx);
return 0;
}
if pmp_cfg_idx >= self.nb_pmp / 8 {
if pmp_cfg_idx >= 2 * self.nb_pmp / 8 {
// This PMP is not emulated
return 0;
}
Expand Down