Skip to content

Commit 3990fbc

Browse files
committed
Verify CSR read: add support for seed register
The seed register can only be decoded with crypto extensions enabled. This commit makes them available during model checking to ensure we pass the CSR read tests.
1 parent 47fc1b4 commit 3990fbc

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

model_checking/src/lib.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,7 @@ pub fn read_csr() {
7575
// Infinite number of pmps for the formal verification
7676
ctx.nb_pmp = usize::MAX;
7777

78-
let mut csr_register = generate_csr_register();
79-
80-
let is_seed = csr_register == 0b000000010101;
81-
82-
// TODO: Adapt the last registers for the symbolic verification
83-
if is_seed {
84-
csr_register = 0;
85-
}
78+
let csr_register = generate_csr_register();
8679

8780
// Read value from Miralis
8881
let decoded_csr = mctx.decode_csr(csr_register as usize);

model_checking/src/symbolic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ pub fn new_symbolic_contexts() -> (VirtContext, MiralisContext, SailVirtCtx) {
156156
// Initialize Miralis's own context
157157
let mut hw = unsafe { Arch::detect_hardware() };
158158
hw.available_reg.nb_pmp = 64; // We assume 64 PMPs during model checking
159+
hw.extensions.has_crypto_extension = true; // Needed for Seed register
159160
let mctx = MiralisContext::new(hw, Plat::get_miralis_start(), 0x1000);
160161

161162
(ctx, mctx, sail_ctx)

0 commit comments

Comments
 (0)