From: Sebastien Bourdeauducq Date: Sat, 14 Mar 2015 16:45:11 +0000 (+0100) Subject: fhdl/visit: fix TransformModule X-Git-Tag: 24jan2021_ls180~2099^2~187 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c824379878a0de752b67e78a90ee5a7d81369e08;p=litex.git fhdl/visit: fix TransformModule --- diff --git a/migen/fhdl/module.py b/migen/fhdl/module.py index bb29fc6f..1d83abe9 100644 --- a/migen/fhdl/module.py +++ b/migen/fhdl/module.py @@ -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 diff --git a/migen/fhdl/visit.py b/migen/fhdl/visit.py index a1506f99..ab7a1b85 100644 --- a/migen/fhdl/visit.py +++ b/migen/fhdl/visit.py @@ -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())