File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99
1010### Added
1111
12+ - Add ` dpc ` CSR support for RISC-V
1213- Add Mtopi
1314- Added DCSR (Debug Control and Status Register) CSR support for the RISC-V
1415- Add ` miselect ` CSR
Original file line number Diff line number Diff line change @@ -131,3 +131,4 @@ mod tests;
131131
132132// TODO: Debug Mode Registers
133133pub mod dcsr;
134+ pub mod dpc;
Original file line number Diff line number Diff line change 1+ //! dpc register — Debug PC (0x7b1)
2+
3+ read_write_csr ! {
4+ /// Debug PC Register
5+ Dpc : 0x7b1 ,
6+ mask: !1usize ,
7+ }
8+
9+ #[ cfg( test) ]
10+ mod tests {
11+ use super :: * ;
12+
13+ #[ test]
14+ fn test_dpc_alignment_mask ( ) {
15+ let dpc = Dpc :: from_bits ( 0x1 ) ;
16+ assert_eq ! ( dpc. bits( ) & 1 , 0 ) ;
17+ }
18+
19+ #[ test]
20+ fn test_dpc_bits_roundtrip ( ) {
21+ let dpc = Dpc :: from_bits ( 0x12345 ) ;
22+ assert_eq ! ( dpc. bits( ) , 0x12344 ) ;
23+ assert_eq ! ( Dpc :: from_bits( dpc. bits( ) ) . bits( ) , dpc. bits( ) ) ;
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments