test/constant: use new API
This commit is contained in:
parent
74c9159a01
commit
fd88b9b8a3
|
@ -1,11 +1,11 @@
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from migen.fhdl.std import *
|
from migen import *
|
||||||
from migen.test.support import SimCase, SimBench
|
from migen.test.support import SimCase
|
||||||
|
|
||||||
|
|
||||||
class ConstantCase(SimCase, unittest.TestCase):
|
class ConstantCase(SimCase, unittest.TestCase):
|
||||||
class TestBench(SimBench):
|
class TestBench(Module):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.sigs = [
|
self.sigs = [
|
||||||
(Signal(3), Constant(0), 0),
|
(Signal(3), Constant(0), 0),
|
||||||
|
@ -18,11 +18,11 @@ class ConstantCase(SimCase, unittest.TestCase):
|
||||||
self.comb += [a.eq(b) for a, b, c in self.sigs]
|
self.comb += [a.eq(b) for a, b, c in self.sigs]
|
||||||
|
|
||||||
def test_comparisons(self):
|
def test_comparisons(self):
|
||||||
def cb(tb, tbp):
|
def gen():
|
||||||
for s, l, v in tb.sigs:
|
for s, l, v in self.tb.sigs:
|
||||||
s = tbp.simulator.rd(s)
|
s = yield s
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
s, int(v),
|
s, int(v),
|
||||||
"got {}, want {} from literal {}".format(
|
"got {}, want {} from literal {}".format(
|
||||||
s, v, l))
|
s, v, l))
|
||||||
self.run_with(cb, 1)
|
self.run_with(gen())
|
||||||
|
|
Loading…
Reference in New Issue