switch off specallocate in fpadd statemachine
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 16 Jun 2019 06:34:52 +0000 (07:34 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 16 Jun 2019 06:34:52 +0000 (07:34 +0100)
src/ieee754/fpadd/statemachine.py
src/nmutil/stageapi.py

index 918e35a2d81ff4a6d9220918b7fec8ef998208ce..0ca7ce7a490f761214ea13846e555b80d9e80205 100644 (file)
@@ -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
index 33fd995d22d6ad2ded3cda886ab2031d04323006..6ed34f5e631de239d6e33c803340e64dfd72f3ae 100644 (file)
@@ -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