fhdl/visit: fix TransformModule
authorSebastien Bourdeauducq <sb@m-labs.hk>
Sat, 14 Mar 2015 16:45:11 +0000 (17:45 +0100)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Sat, 14 Mar 2015 16:45:11 +0000 (17:45 +0100)
migen/fhdl/module.py
migen/fhdl/visit.py

index bb29fc6f004e02234c5a852542641c864bc1166c..1d83abe98f456e86c1e2e603d6bdf3534374957d 100644 (file)
@@ -83,8 +83,8 @@ class _ModuleClockDomains(_ModuleProxy, _ModuleForwardAttr):
 
 class Module:
        def get_fragment(self):
-               assert(not self._get_fragment_called)
-               self._get_fragment_called = True
+               assert(not self.get_fragment_called)
+               self.get_fragment_called = True
                self.finalize()
                return self._fragment
 
@@ -127,9 +127,9 @@ class Module:
                elif name == "_clock_domains":
                        self._clock_domains = []
                        return self._clock_domains
-               elif name == "_get_fragment_called":
-                       self._get_fragment_called = False
-                       return self._get_fragment_called
+               elif name == "get_fragment_called":
+                       self.get_fragment_called = False
+                       return self.get_fragment_called
 
                else:
                        raise AttributeError("'"+self.__class__.__name__+"' object has no attribute '"+name+"'")
@@ -144,7 +144,7 @@ class Module:
        def _collect_submodules(self):
                r = []
                for name, submodule in self._submodules:
-                       if not submodule._get_fragment_called:
+                       if not submodule.get_fragment_called:
                                r.append((name, submodule.get_fragment()))
                return r
 
index a1506f99b0c9b762d4abccb76192960485afef3f..ab7a1b85087559d7c836ca84b731af285e474927 100644 (file)
@@ -202,6 +202,9 @@ class TransformModule:
        def __init__(self, transform, module):
                self.transform = transform
                self.module = module
+               self.get_fragment_called = False
 
        def get_fragment(self):
+               assert(not self.get_fragment_called)
+               self.get_fragment_called = True
                return self.transform(self.module.get_fragment())