File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed
Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -1042,15 +1042,9 @@ macro_rules! test_csr_field {
10421042 } } ;
10431043
10441044 // test a multi-bit bitfield for read-only CSR (must come before enum pattern)
1045- ( $reg: ident, $field: ident: [ $start: literal , $end: literal ] ) => { {
1045+ ( $reg: ident, $field: ident: [ $start: expr , $end: expr ] ) => { {
10461046 let bits = $reg. bits( ) ;
1047-
1048- let shift = $end - $start + 1 ;
1049- let mask = ( 1usize << shift) - 1 ;
1050-
1051- let exp_val = ( bits >> $start) & mask;
1052-
1053- // Test field extraction matches expected value
1047+ let exp_val = $crate:: bits:: bf_extract( bits, $start, $end - $start + 1 ) ;
10541048 assert_eq!( $reg. $field( ) , exp_val) ;
10551049 } } ;
10561050
Original file line number Diff line number Diff line change 2424read_only_csr ! {
2525 /// Machine Top Priority Interrupt Register
2626 Mtopi : 0x7C0 ,
27- mask: 0x0FFF_FFFF ,
27+ mask: 0x0FFF_00FF ,
2828}
2929
3030read_only_csr_field ! {
You can’t perform that action at this time.
0 commit comments