@@ -499,6 +499,7 @@ where
499
499
// source,
500
500
// &mut record.var[0].read_aux[2].prev_timestamp,
501
501
// );
502
+ source = source. saturating_sub ( 12 * ( shift != 0 ) as u32 ) ;
502
503
if shift != 0 {
503
504
if source >= 4 {
504
505
record. var [ 0 ] . data [ 3 ] = tracing_read (
@@ -576,7 +577,7 @@ where
576
577
let mut dest_data = [ 0 ; 4 ] ;
577
578
let mut source_data = [ 0 ; 4 ] ;
578
579
let mut len_data = [ 0 ; 4 ] ;
579
-
580
+ source = source . saturating_add ( 12 * ( shift != 0 ) as u32 ) ;
580
581
tracing_write (
581
582
state. memory ,
582
583
RV32_REGISTER_AS ,
@@ -1005,6 +1006,8 @@ unsafe fn execute_e12_impl<F: PrimeField32, CTX: ExecutionCtxTrait>(
1005
1006
let mut source = u32:: from_le_bytes ( source) . saturating_sub ( 12 * ( shift != 0 ) as u32 ) ;
1006
1007
let mut len = u32:: from_le_bytes ( len) ;
1007
1008
1009
+ let effective_len = len. saturating_sub ( shift as u32 ) ; // n >= 16 + shift
1010
+ let num_iters = ( effective_len >> 4 ) as u32 ;
1008
1011
// Check address ranges are valid
1009
1012
1010
1013
/*
@@ -1034,9 +1037,7 @@ unsafe fn execute_e12_impl<F: PrimeField32, CTX: ExecutionCtxTrait>(
1034
1037
} else {
1035
1038
[ 0 ; 4 ] // unused when shift == 0
1036
1039
} ;
1037
- let effective_len = len. saturating_sub ( shift as u32 ) ;
1038
- let num_iters = ( effective_len >> 4 ) as u32 ; // number of 16-byte chunks we will process
1039
- //why is PC not being incremented correctly
1040
+
1040
1041
eprintln ! ( "num_iters: {:?}" , num_iters) ;
1041
1042
eprintln ! ( "source: {:?}, dest: {:?}, pc: {:?}" , source, dest, * pc) ;
1042
1043
for _ in 0 ..num_iters {
0 commit comments