def everything_t_procedure(self, timing_val=None, opt_timing_val=None): # if there is a nondefault timing val supplied, then it will check # to make sure that the timing matches # this is a subprocess to do the synth and timing block = pyrtl.working_block() timing_map = pyrtl.timing_analysis(block) timing_max_length = pyrtl.timing_max_length(timing_map) if timing_val is not None: self.assertEqual(timing_max_length, timing_val) critical_path = pyrtl.timing_critical_path(timing_map) pyrtl.synthesize() pyrtl.optimize() block = pyrtl.working_block() timing_map = pyrtl.timing_analysis(block) timing_max_length = pyrtl.timing_max_length(timing_map) if opt_timing_val is not None: self.assertEqual(timing_max_length, opt_timing_val) critical_path = pyrtl.timing_critical_path(timing_map) pyrtl.and_inverter_synth() pyrtl.optimize() block = pyrtl.working_block() timing_map = pyrtl.timing_analysis(block) timing_max_length = pyrtl.timing_max_length(timing_map) self.assertEqual(self.num_net_of_type('|', block), 0) self.assertEqual(self.num_net_of_type('^', block), 0) pyrtl.nand_synth() pyrtl.optimize() block = pyrtl.working_block() timing_map = pyrtl.timing_analysis(block) timing_max_length = pyrtl.timing_max_length(timing_map) block.sanity_check() self.assertEqual(self.num_net_of_type('|', block), 0) self.assertEqual(self.num_net_of_type('&', block), 0) self.assertEqual(self.num_net_of_type('^', block), 0)
def test_timing_error(self): inwire, inwire2 = pyrtl.Input(bitwidth=1), pyrtl.Input(bitwidth=1) tempwire, tempwire2 = pyrtl.WireVector(1), pyrtl.WireVector(1) outwire = pyrtl.Output() tempwire <<= ~(inwire & tempwire2) tempwire2 <<= ~(inwire2 & tempwire) outwire <<= tempwire with self.assertRaises(pyrtl.PyrtlError): pyrtl.synthesize() pyrtl.optimize() block = pyrtl.working_block() timing_map = pyrtl.timing_analysis(block) block_max_time = pyrtl.timing_max_length(timing_map)
def doAllOps(): pyrtl.synthesize() pyrtl.optimize() block = pyrtl.working_block() timing_map = pyrtl.timing_analysis(block) block_max_time = pyrtl.timing_max_length(timing_map)