test/constant: use new API
authorSebastien Bourdeauducq <sb@m-labs.hk>
Thu, 17 Sep 2015 03:08:40 +0000 (11:08 +0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Thu, 17 Sep 2015 03:08:40 +0000 (11:08 +0800)
migen/test/test_constant.py

index 11ac5f6bc8ae91c2803fbcfea5a2021777278a38..8ad637fc7f9225c13e9c091f0ef7f68401673050 100644 (file)
@@ -1,11 +1,11 @@
 import unittest
 
-from migen.fhdl.std import *
-from migen.test.support import SimCase, SimBench
+from migen import *
+from migen.test.support import SimCase
 
 
 class ConstantCase(SimCase, unittest.TestCase):
-    class TestBench(SimBench):
+    class TestBench(Module):
         def __init__(self):
             self.sigs = [
                 (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]
 
     def test_comparisons(self):
-        def cb(tb, tbp):
-            for s, l, v in tb.sigs:
-                s = tbp.simulator.rd(s)
+        def gen():
+            for s, l, v in self.tb.sigs:
+                s = yield s
                 self.assertEqual(
                     s, int(v),
                     "got {}, want {} from literal {}".format(
                         s, v, l))
-        self.run_with(cb, 1)
+        self.run_with(gen())