From: Luke Kenneth Casson Leighton Date: Thu, 28 Mar 2019 16:31:05 +0000 (+0000) Subject: add new mode to StageChain which uses python output variables X-Git-Tag: ls180-24jan2020~1415 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f098eca99df0d0a4bb61066a149e3849057759a6;p=ieee754fpu.git add new mode to StageChain which uses python output variables instead of allocating ispec/ospec --- diff --git a/src/add/singlepipe.py b/src/add/singlepipe.py index ffd515f6..a5e00750 100644 --- a/src/add/singlepipe.py +++ b/src/add/singlepipe.py @@ -351,8 +351,9 @@ class StageChain(StageCls): * output of second goes into input into third (etc. etc.) * the output of this class will be the output of the last stage """ - def __init__(self, chain): + def __init__(self, chain, specallocate=False): self.chain = chain + self.specallocate = specallocate def ispec(self): return self.chain[0].ispec() @@ -364,12 +365,17 @@ class StageChain(StageCls): for (idx, c) in enumerate(self.chain): if hasattr(c, "setup"): c.setup(m, i) # stage may have some module stuff - o = self.chain[idx].ospec() # only the last assignment survives - m.d.comb += eq(o, c.process(i)) # process input into "o" + if self.specallocate: + o = self.chain[idx].ospec() # last assignment survives + m.d.comb += eq(o, c.process(i)) # process input into "o" + else: + o = c.process(i) # store input into "o" if idx != len(self.chain)-1: - ni = self.chain[idx+1].ispec() # becomes new input on next loop - m.d.comb += eq(ni, o) # assign output to next input - i = ni + if self.specallocate: + ni = self.chain[idx+1].ispec() # new input on next loop + m.d.comb += eq(ni, o) # assign to next input + else: + i = o self.o = o # last loop is the output def process(self, i):