From ee1091f4910b0c76b95ee481c7b3e307c9cb1be7 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 9 Mar 2015 17:17:21 +0100 Subject: [PATCH] fhdl/module: avoid flushing self._submodules and create do_exit. --- migen/fhdl/module.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/migen/fhdl/module.py b/migen/fhdl/module.py index e3d6f9fd..4d91693d 100644 --- a/migen/fhdl/module.py +++ b/migen/fhdl/module.py @@ -142,8 +142,10 @@ class Module: object.__setattr__(self, name, value) def _collect_submodules(self): - r = [(name, submodule.get_fragment()) for name, submodule in self._submodules] - self._submodules = [] + r = [] + for name, submodule in self._submodules: + if not submodule._get_fragment_called: + r += [(name, submodule.get_fragment())] return r def finalize(self, *args, **kwargs): @@ -176,3 +178,7 @@ class Module: def do_finalize(self): pass + + def do_exit(self, *args, **kwargs): + for name, submodule in self._submodules: + submodule.do_exit(*args, **kwargs) -- 2.30.2