def test_assert_fastsimulation(self): i = pyrtl.Input(1) o = pyrtl.rtl_assert(i, self.RTLSampleException('test assertion failed')) sim = pyrtl.FastSimulation() sim.step({i: 1}) self.assertEquals(sim.inspect(o), 1) with self.assertRaises(self.RTLSampleException): sim.step({i: 0})
def test_create_assert(self): w = pyrtl.WireVector(1) pyrtl.rtl_assert(w, self.RTLSampleException('testing rtl assert'))
def test_duplicate_assert(self): w = pyrtl.Input(1) pyrtl.rtl_assert(w, self.RTLSampleException()) pyrtl.rtl_assert(w, self.RTLSampleException())
def bad_rtl_assert(self, *args, **kwargs): with self.assertRaises(pyrtl.PyrtlError): pyrtl.rtl_assert(*args, **kwargs)