Skip to content

Commit ed2a9ea

Browse files
committed
riscv: add basic unit tests for mstatush
Adds a basic unit-tests for the `mstatush` CSR.
1 parent 25511f7 commit ed2a9ea

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

riscv/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2525
- Use CSR helper macros to define `misa` register
2626
- Use CSR helper macros to define `mip` register
2727
- Use CSR helper macros to define `mstatus` register
28+
- Use CSR helper macros to define `mstatush` register
2829

2930
## [v0.12.1] - 2024-10-20
3031

riscv/src/register/mstatush.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,20 @@ pub unsafe fn set_mbe(endianness: Endianness) {
4242
Endianness::LittleEndian => _clear(1 << 5),
4343
}
4444
}
45+
46+
#[cfg(test)]
47+
mod tests {
48+
use super::*;
49+
50+
#[test]
51+
fn test_mstatush() {
52+
let mut m = Mstatush::from_bits(0);
53+
54+
[Endianness::LittleEndian, Endianness::BigEndian]
55+
.into_iter()
56+
.for_each(|endianness| {
57+
test_csr_field!(m, sbe: endianness);
58+
test_csr_field!(m, mbe: endianness);
59+
});
60+
}
61+
}

0 commit comments

Comments
 (0)