Skip to content

Commit e3dcd0b

Browse files
committed
riscv: add mseccfg unit tests
Adds basic unit tests for the `mseccfg` CSR register.
1 parent a6cc40c commit e3dcd0b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

riscv/src/register/mseccfg.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,27 @@ read_write_csr_field! {
9292
pmm,
9393
PMM: [32:33],
9494
}
95+
96+
#[cfg(test)]
97+
mod tests {
98+
use super::*;
99+
100+
#[test]
101+
fn test_mseccfg() {
102+
let mut mseccfg = Mseccfg::from_bits(0);
103+
104+
test_csr_field!(mseccfg, mml);
105+
test_csr_field!(mseccfg, mmwp);
106+
test_csr_field!(mseccfg, rlb);
107+
test_csr_field!(mseccfg, useed);
108+
test_csr_field!(mseccfg, sseed);
109+
test_csr_field!(mseccfg, mlpe);
110+
111+
#[cfg(not(target_arch = "riscv32"))]
112+
{
113+
test_csr_field!(mseccfg, pmm: PMM::Disabled);
114+
test_csr_field!(mseccfg, pmm: PMM::EnabledXlen57);
115+
test_csr_field!(mseccfg, pmm: PMM::EnabledXlen48);
116+
}
117+
}
118+
}

0 commit comments

Comments
 (0)