<s> from __future__ import print_function <EOL> from pymtl import * <EOL> class TestVectorSimulator ( object ) : <EOL> def __init__ ( self , model , test_vectors , <EOL> set_inputs_func , verify_outputs_func , wait_cycles = <NUM_LIT:0> ) : <EOL> self . model = model <EOL> self . set_inputs_func = set_inputs_func <EOL> self . verify_outputs_func = verify_outputs_func <EOL> self . test_vectors = test_vectors <EOL> self . wait_cycles = wait_cycles <EOL> def run_test ( self , ) : <EOL> sim = SimulationTool ( self . model ) <EOL> print ( ) <EOL> sim . reset ( ) <EOL> for test_vector in self . test_vectors : <EOL> self . set_inputs_func ( self . model , test_vector ) <EOL> if self . wait_cycles == <NUM_LIT:0> : <EOL> sim . eval_combinational ( ) <EOL> else : <EOL> for i in range ( self . wait_cycles ) : <EOL> sim . cycle ( ) <EOL> sim . print_line_trace ( ) <EOL> self . verify_outputs_func ( self . model , test_vector ) <EOL> sim . cycle ( ) <EOL> sim . cycle ( ) <EOL> sim . cycle ( ) <EOL> sim . cycle ( ) </s>
