Skip to content

Commit

Permalink
Implement Eq and PartialEq for Range and Permission
Browse files Browse the repository at this point in the history
It's useful to be able to do equality tests for these for unit tests.
  • Loading branch information
jsgf committed May 7, 2024
1 parent 8e148af commit 4f4d161
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions riscv/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Add `Mcause::from(usize)` for use in unit tests
- Add `Mstatus::from(usize)` for use in unit tests
- Add `Mstatus.bits()`
- Add `Eq` and `PartialEq` for `pmpcfgx::{Range, Permission}`
- Export `riscv::register::macros` module macros for external use

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions riscv/src/register/pmpcfgx.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Physical memory protection configuration
/// Permission enum contains all possible permission modes for pmp registers
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Permission {
NONE = 0b000,
R = 0b001,
Expand All @@ -14,7 +14,7 @@ pub enum Permission {
}

/// Range enum contains all possible addressing modes for pmp registers
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Range {
OFF = 0b00,
TOR = 0b01,
Expand Down

0 comments on commit 4f4d161

Please sign in to comment.