Exemplo n.º 1
0
    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})
Exemplo n.º 2
0
 def test_create_assert(self):
     w = pyrtl.WireVector(1)
     pyrtl.rtl_assert(w, self.RTLSampleException('testing rtl assert'))
Exemplo n.º 3
0
 def test_duplicate_assert(self):
     w = pyrtl.Input(1)
     pyrtl.rtl_assert(w, self.RTLSampleException())
     pyrtl.rtl_assert(w, self.RTLSampleException())
Exemplo n.º 4
0
 def bad_rtl_assert(self, *args, **kwargs):
     with self.assertRaises(pyrtl.PyrtlError):
         pyrtl.rtl_assert(*args, **kwargs)
Exemplo n.º 5
0
 def test_create_assert(self):
     w = pyrtl.WireVector(1)
     pyrtl.rtl_assert(w, self.RTLSampleException('testing rtl assert'))
Exemplo n.º 6
0
 def test_duplicate_assert(self):
     w = pyrtl.Input(1)
     pyrtl.rtl_assert(w, self.RTLSampleException())
     pyrtl.rtl_assert(w, self.RTLSampleException())
Exemplo n.º 7
0
 def bad_rtl_assert(self, *args, **kwargs):
     with self.assertRaises(pyrtl.PyrtlError):
         pyrtl.rtl_assert(*args, **kwargs)