@@ -335,6 +335,7 @@ def _simulate_steps(
335335 """
336336 N = 2 * self .elements_per_vector
337337 num_stages = len (steps )
338+ solver = Solver ()
338339
339340 elems = [BitVec (f"e_{ i } " , self .lane_width ) for i in range (N )]
340341
@@ -347,10 +348,18 @@ def _simulate_steps(
347348 is_last_stage = step_idx == num_stages - 1
348349
349350 new_top = self ._apply_concrete_instructions (
350- top_vec , bottom_vec , gadget .top_instructions , is_top = True
351+ top_vec ,
352+ bottom_vec ,
353+ gadget .top_instructions ,
354+ is_top = True ,
355+ solver = solver ,
351356 )
352357 new_bottom = self ._apply_concrete_instructions (
353- top_vec , bottom_vec , gadget .bottom_instructions , is_top = False
358+ top_vec ,
359+ bottom_vec ,
360+ gadget .bottom_instructions ,
361+ is_top = False ,
362+ solver = solver ,
354363 )
355364
356365 if natural_order and is_last_stage :
@@ -563,7 +572,12 @@ def _extract_output_elements(
563572 return sorted_elems
564573
565574 def _apply_concrete_instructions (
566- self , top_reg , bottom_reg , instructions : list [InstructionSpec ], is_top : bool
575+ self ,
576+ top_reg ,
577+ bottom_reg ,
578+ instructions : list [InstructionSpec ],
579+ is_top : bool ,
580+ solver : Solver | None = None ,
567581 ):
568582 """Apply concrete (non-symbolic) instructions to compute an output register.
569583
@@ -578,6 +592,8 @@ def _apply_concrete_instructions(
578592 3+ instruction chains to reference any earlier intermediate.
579593 """
580594 current_reg = top_reg if is_top else bottom_reg
595+ if solver is None :
596+ solver = Solver ()
581597 prev_output = None
582598 results : list = []
583599
@@ -598,7 +614,7 @@ def _apply_concrete_instructions(
598614 results ,
599615 )
600616
601- current_reg = self ._dispatch_intrinsic (intrinsic , args )
617+ current_reg = self ._dispatch_intrinsic (intrinsic , args , solver = solver )
602618 prev_output = current_reg
603619 results .append (current_reg )
604620
@@ -645,6 +661,6 @@ def _resolve_arg(
645661
646662 return value
647663
648- def _dispatch_intrinsic (self , intrinsic , args : dict ):
664+ def _dispatch_intrinsic (self , intrinsic , args : dict , solver : Solver | None = None ):
649665 """Dispatch an intrinsic call using shared signature patterns."""
650- return _dispatch_intrinsic_by_signature (intrinsic , args )
666+ return _dispatch_intrinsic_by_signature (intrinsic , args , solver = solver )
0 commit comments