From a330c5c41cbad09a2a1cf55a094841f9442a38cc Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 16 Jun 2019 07:34:52 +0100 Subject: [PATCH] switch off specallocate in fpadd statemachine --- src/ieee754/fpadd/statemachine.py | 2 +- src/nmutil/stageapi.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ieee754/fpadd/statemachine.py b/src/ieee754/fpadd/statemachine.py index 918e35a2..0ca7ce7a 100644 --- a/src/ieee754/fpadd/statemachine.py +++ b/src/ieee754/fpadd/statemachine.py @@ -161,7 +161,7 @@ class FPADDBaseMod(Elaboratable): get.trigger_setup(m, self.in_t.stb, self.in_t.ack) chainlist = [get, sc, alm, n1] - chain = StageChain(chainlist, specallocate=True) + chain = StageChain(chainlist, specallocate=False) chain.setup(m, self.i) m.submodules.sc = sc m.submodules.alm = alm diff --git a/src/nmutil/stageapi.py b/src/nmutil/stageapi.py index 33fd995d..6ed34f5e 100644 --- a/src/nmutil/stageapi.py +++ b/src/nmutil/stageapi.py @@ -77,6 +77,7 @@ all the optional bits. """ +from nmigen import Elaboratable from abc import ABCMeta, abstractmethod import inspect @@ -239,7 +240,10 @@ class StageChain(StageHelper): assert len(chain) > 0, "stage chain must be non-zero length" self.chain = chain StageHelper.__init__(self, None) - self.setup = self._sa_setup if specallocate else self._na_setup + if specallocate: + self.setup = self._sa_setup + else: + self.setup = self._na_setup self.set_specs(self.chain[0], self.chain[-1]) def _sa_setup(self, m, i): @@ -247,7 +251,10 @@ class StageChain(StageHelper): if hasattr(c, "setup"): c.setup(m, i) # stage may have some module stuff ofn = self.chain[idx].ospec # last assignment survives - o = _spec(ofn, 'chainin%d' % idx) + cname = 'chainin%d' % idx + o = _spec(ofn, cname) + if isinstance(o, Elaboratable): + setattr(m.submodules, cname, o) m.d.comb += nmoperator.eq(o, c.process(i)) # process input into "o" if idx == len(self.chain)-1: break -- 2.30.2