def run_sim(s, th): vcd_file_name = s.__class__.cmdline_opts["dump_vcd"] max_cycles = s.__class__.cmdline_opts["max_cycles"] or 10000 # Translate the DUT and import it back in using the yosys backend. th.elaborate() # Check command line arguments for vcd dumping if vcd_file_name: th.set_metadata(VcdGenerationPass.vcd_file_name, vcd_file_name) th.dut.set_metadata(YosysVerilatorImportPass.vl_trace, True) th.dut.set_metadata(YosysVerilatorImportPass.vl_trace_filename, vcd_file_name) # Translate the DUT and import it back in using the yosys backend. th.dut.set_metadata(YosysTranslationImportPass.enable, True) th = YosysTranslationImportPass()(th) # Create a simulator th.apply(DefaultPassGroup()) # Tick the simulator while not th.done() and th.sim_cycle_count() < max_cycles: th.sim_tick() # Check timeout assert th.sim_cycle_count() < max_cycles finalize_verilator(th)
def run_sim( s, th, max_cycles=1000 ): s.vcd_file_name = s.__class__.cmdline_opts["dump_vcd"] # Check command line arguments for vcd dumping if s.vcd_file_name: th.dump_vcd = True th.vcd_file_name = "translated."+s.vcd_file_name # Translate the DUT and import it back in using the yosys backend. th.elaborate() th.dut.set_metadata( YosysTranslationImportPass.enable, True ) # ''' TUTORIAL TASK '''''''''''''''''''''''''''''''''''''''''''''''''' # Apply the translation-import and simulation passes # ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''\/ th = YosysTranslationImportPass()( th ) th.apply( DefaultPassGroup() ) # ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''/\ th.sim_reset() # Tick the simulator while not th.done() and th.sim_cycle_count() < max_cycles: th.sim_tick() # Check timeout assert th.sim_cycle_count() < max_cycles
def run_sim(s, th, max_cycles=1000): # Translate the DUT and import it back in using the yosys backend. th.elaborate() th.dut.set_metadata(YosysTranslationImportPass.enable, True) th = YosysTranslationImportPass()(th) # Create a simulator th.apply(DefaultPassGroup()) # Tick the simulator while not th.done() and th.sim_cycle_count() < max_cycles: th.sim_tick() # Check timeout assert th.sim_cycle_count() < max_cycles
def run_sim(s, th, gen_test, max_cycles=10000): th.elaborate() # Assemble the program mem_image = assemble(gen_test()) # Load the program into memory th.load(mem_image) # Translate the processor and import it back in from pymtl3.passes.backends.yosys import YosysTranslationImportPass th.proc.set_metadata(YosysTranslationImportPass.enable, True) th = YosysTranslationImportPass()(th) # Create a simulator and run simulation th.apply(DefaultPassGroup(print_line_trace=True)) th.sim_reset() while not th.done() and th.sim_cycle_count() < max_cycles: th.sim_tick() # Force a test failure if we timed out assert th.sim_cycle_count() < max_cycles