fhdl.ir: Fragment.{drive→add_driver}
authorwhitequark <cz@m-labs.hk>
Fri, 14 Dec 2018 20:58:29 +0000 (20:58 +0000)
committerwhitequark <cz@m-labs.hk>
Fri, 14 Dec 2018 20:58:29 +0000 (20:58 +0000)
nmigen/fhdl/dsl.py
nmigen/fhdl/ir.py
nmigen/fhdl/xfrm.py
nmigen/test/test_fhdl_ir.py
nmigen/test/test_fhdl_xfrm.py
nmigen/test/test_sim.py

index 8bbcdc311ee753fbe384bbf36cb84fa6537028e1..72323bbb6d34a91246e9af08dd1e158cc5a49aa4 100644 (file)
@@ -274,7 +274,7 @@ class Module(_ModuleBuilderRoot):
             fragment.add_subfragment(submodule.get_fragment(platform), name)
         fragment.add_statements(self._statements)
         for signal, domain in self._driving.items():
-            fragment.drive(signal, domain)
+            fragment.add_driver(signal, domain)
         return fragment
 
     get_fragment = lower
index 70049252cfa77bfef54df25d38b66a93544af13e..dbac8179a506d488ab8ab35607690d9425f7712a 100644 (file)
@@ -24,7 +24,7 @@ class Fragment:
     def iter_ports(self):
         yield from self.ports.keys()
 
-    def drive(self, signal, domain=None):
+    def add_driver(self, signal, domain=None):
         if domain not in self.drivers:
             self.drivers[domain] = ValueSet()
         self.drivers[domain].add(signal)
index bbfe5cfc3a8c0c03cddb0e4cee5581712f0372bd..d6dbac84d86442bdd246d2a68f7fcec951711382 100644 (file)
@@ -119,7 +119,7 @@ class FragmentTransformer:
 
     def map_drivers(self, fragment, new_fragment):
         for domain, signal in fragment.iter_drivers():
-            new_fragment.drive(signal, domain)
+            new_fragment.add_driver(signal, domain)
 
     def on_fragment(self, fragment):
         new_fragment = Fragment()
@@ -165,7 +165,7 @@ class DomainRenamer(FragmentTransformer, ValueTransformer, StatementTransformer)
             if domain in self.domain_map:
                 domain = self.domain_map[domain]
             for signal in signals:
-                new_fragment.drive(signal, domain)
+                new_fragment.add_driver(signal, domain)
 
 
 class DomainLowerer(FragmentTransformer, ValueTransformer, StatementTransformer):
index ddd182195306c5860074e90dcd4fcfb1cf3c7123..3068af4e0d206e372a0caa506d335cdc92a1e28f 100644 (file)
@@ -109,7 +109,7 @@ class FragmentPortsTestCase(FHDLTestCase):
             self.c1.eq(self.s1)
         )
         f.add_domains(sync)
-        f.drive(self.c1, "sync")
+        f.add_driver(self.c1, "sync")
 
         f._propagate_ports(ports=())
         self.assertEqual(f.ports, ValueDict([
@@ -125,7 +125,7 @@ class FragmentPortsTestCase(FHDLTestCase):
             self.c1.eq(self.s1)
         )
         f.add_domains(sync)
-        f.drive(self.c1, "sync")
+        f.add_driver(self.c1, "sync")
 
         f._propagate_ports(ports=())
         self.assertEqual(f.ports, ValueDict([
index ca3c2424a73131d89bdec33a9a16b1b588b91661..861dcd0ca92500aa19e3de8ae1e280744d080492 100644 (file)
@@ -23,9 +23,9 @@ class DomainRenamerTestCase(FHDLTestCase):
             self.s4.eq(ClockSignal("other")),
             self.s5.eq(ResetSignal("other")),
         )
-        f.drive(self.s1, None)
-        f.drive(self.s2, None)
-        f.drive(self.s3, "sync")
+        f.add_driver(self.s1, None)
+        f.add_driver(self.s2, None)
+        f.add_driver(self.s3, "sync")
 
         f = DomainRenamer("pix")(f)
         self.assertRepr(f.statements, """
@@ -170,7 +170,7 @@ class ResetInserterTestCase(FHDLTestCase):
         f.add_statements(
             self.s1.eq(1)
         )
-        f.drive(self.s1, "sync")
+        f.add_driver(self.s1, "sync")
 
         f = ResetInserter(self.c1)(f)
         self.assertRepr(f.statements, """
@@ -189,8 +189,8 @@ class ResetInserterTestCase(FHDLTestCase):
             self.s2.eq(0),
         )
         f.add_domains(ClockDomain("sync"))
-        f.drive(self.s1, "sync")
-        f.drive(self.s2, "pix")
+        f.add_driver(self.s1, "sync")
+        f.add_driver(self.s2, "pix")
 
         f = ResetInserter({"pix": self.c1})(f)
         self.assertRepr(f.statements, """
@@ -208,7 +208,7 @@ class ResetInserterTestCase(FHDLTestCase):
         f.add_statements(
             self.s2.eq(0)
         )
-        f.drive(self.s2, "sync")
+        f.add_driver(self.s2, "sync")
 
         f = ResetInserter(self.c1)(f)
         self.assertRepr(f.statements, """
@@ -225,7 +225,7 @@ class ResetInserterTestCase(FHDLTestCase):
         f.add_statements(
             self.s3.eq(0)
         )
-        f.drive(self.s3, "sync")
+        f.add_driver(self.s3, "sync")
 
         f = ResetInserter(self.c1)(f)
         self.assertRepr(f.statements, """
@@ -250,7 +250,7 @@ class CEInserterTestCase(FHDLTestCase):
         f.add_statements(
             self.s1.eq(1)
         )
-        f.drive(self.s1, "sync")
+        f.add_driver(self.s1, "sync")
 
         f = CEInserter(self.c1)(f)
         self.assertRepr(f.statements, """
@@ -268,8 +268,8 @@ class CEInserterTestCase(FHDLTestCase):
             self.s1.eq(1),
             self.s2.eq(0),
         )
-        f.drive(self.s1, "sync")
-        f.drive(self.s2, "pix")
+        f.add_driver(self.s1, "sync")
+        f.add_driver(self.s2, "pix")
 
         f = CEInserter({"pix": self.c1})(f)
         self.assertRepr(f.statements, """
@@ -287,13 +287,13 @@ class CEInserterTestCase(FHDLTestCase):
         f1.add_statements(
             self.s1.eq(1)
         )
-        f1.drive(self.s1, "sync")
+        f1.add_driver(self.s1, "sync")
 
         f2 = Fragment()
         f2.add_statements(
             self.s2.eq(1)
         )
-        f2.drive(self.s2, "sync")
+        f2.add_driver(self.s2, "sync")
         f1.add_subfragment(f2)
 
         f1 = CEInserter(self.c1)(f1)
index 4b29c75f9b4ce1baa3b9971eab6f51730972b5b6..ec4198612aec6220505e8dd52cf728d5a1821e3b 100644 (file)
@@ -14,7 +14,7 @@ class SimulatorUnitTestCase(FHDLTestCase):
 
         frag = Fragment()
         frag.add_statements(osig.eq(stmt(*isigs)))
-        frag.drive(osig)
+        frag.add_driver(osig)
 
         with Simulator(frag,
                 vcd_file =open("test.vcd",  "w"),