File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed
Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -131,4 +131,9 @@ mod tests;
131131
132132// TODO: Debug Mode Registers
133133pub mod dcsr;
134+ <<<<<<< HEAD
134135pub mod dpc;
136+ =======
137+ pub mod dscratch0;
138+ pub mod dscratch1;
139+ >>>>>>> d078ccf ( Implement dscratch0 and dscratch1 CSRs for RISC -V )
Original file line number Diff line number Diff line change 1+ //! dscratch0
2+
3+ read_write_csr ! {
4+ /// Debug scratch register 0
5+ Dscratch0 : 0x7b2 ,
6+ mask: usize :: MAX ,
7+ }
8+
9+ #[ cfg( test) ]
10+ mod tests {
11+ use super :: * ;
12+
13+ #[ test]
14+ fn test_dscratch0_mask ( ) {
15+ let reg = Dscratch0 :: from_bits ( usize:: MAX ) ;
16+ assert_eq ! ( reg. bits( ) , usize :: MAX ) ;
17+ assert_eq ! ( Dscratch0 :: BITMASK , usize :: MAX ) ;
18+ }
19+
20+ #[ test]
21+ fn test_dscratch0_roundtrip ( ) {
22+ let reg = Dscratch0 :: from_bits ( 0xDEAD_BEEFusize ) ;
23+ assert_eq ! ( reg. bits( ) , 0xDEAD_BEEFusize ) ;
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ //! dscratch1
2+
3+ read_write_csr ! {
4+ /// Debug scratch register 1
5+ Dscratch1 : 0x7b3 ,
6+ mask: usize :: MAX ,
7+ }
8+
9+ #[ cfg( test) ]
10+ mod tests {
11+ use super :: * ;
12+
13+ #[ test]
14+ fn test_dscratch1_mask ( ) {
15+ let reg = Dscratch1 :: from_bits ( usize:: MAX ) ;
16+ assert_eq ! ( reg. bits( ) , usize :: MAX ) ;
17+ assert_eq ! ( Dscratch1 :: BITMASK , usize :: MAX ) ;
18+ }
19+
20+ #[ test]
21+ fn test_dscratch1_roundtrip ( ) {
22+ let reg = Dscratch1 :: from_bits ( 0xDEAD_BEEFusize ) ;
23+ assert_eq ! ( reg. bits( ) , 0xDEAD_BEEFusize ) ;
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments