Skip to content

Commit

Permalink
riscv: add mideleg unit tests
Browse files Browse the repository at this point in the history
Adds basic unit tests for the `mideleg` register.
  • Loading branch information
rmsyn committed Oct 31, 2024
1 parent e91761f commit 301469b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions riscv/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Re-use `try_*` functions in `mcountinhibit`
- Use CSR helper macros to define `mcause` register
- Use CSR helper macros to define `medeleg` register
- Use CSR helper macros to define `mideleg` register

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

Expand Down
14 changes: 14 additions & 0 deletions riscv/src/register/mideleg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,17 @@ set_clear_csr!(
set_clear_csr!(
/// Supervisor External Interrupt Delegate
, set_sext, clear_sext, 1 << 9);

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_mideleg() {
let mut m = Mideleg::from_bits(0);

test_csr_field!(m, ssoft);
test_csr_field!(m, stimer);
test_csr_field!(m, sext);
}
}

0 comments on commit 301469b

Please sign in to comment.