From: Luke Kenneth Casson Leighton Date: Mon, 22 Jul 2019 03:51:34 +0000 (+0100) Subject: sort out weirdness in FPDIVBasePipe initialisation X-Git-Tag: ls180-24jan2020~786 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=369a35ebe0a48b8a9083f8f5448c729caf41df1b;p=ieee754fpu.git sort out weirdness in FPDIVBasePipe initialisation --- diff --git a/src/ieee754/fpdiv/divstages.py b/src/ieee754/fpdiv/divstages.py index 6a65f005..1b41b9e7 100644 --- a/src/ieee754/fpdiv/divstages.py +++ b/src/ieee754/fpdiv/divstages.py @@ -12,6 +12,7 @@ from nmutil.singlepipe import (StageChain, SimpleHandshake) from ieee754.fpcommon.fpbase import FPState from ieee754.fpcommon.denorm import FPSCData from ieee754.fpcommon.postcalc import FPAddStage1Data +from ieee754.div_rem_sqrt_rsqrt.div_pipe import DivPipeInterstageData # TODO: write these from .div0 import FPDivStage0Mod diff --git a/src/ieee754/fpdiv/pipeline.py b/src/ieee754/fpdiv/pipeline.py index 4e483633..4ee1694b 100644 --- a/src/ieee754/fpdiv/pipeline.py +++ b/src/ieee754/fpdiv/pipeline.py @@ -76,11 +76,8 @@ from ieee754.pipeline import PipelineSpec class FPDIVBasePipe(ControlBase): def __init__(self, pspec): - ControlBase.__init__(self) self.pspec = pspec - - def elaborate(self, platform): - m = ControlBase.elaborate(self, platform) + ControlBase.__init__(self) pipechain = [] n_stages = 6 # TODO (depends on width) @@ -110,18 +107,25 @@ class FPDIVBasePipe(ControlBase): stage_idx += n_comb_stages # increment so that each CalcStage # gets a (correct) unique index + self.pipechain = pipechain + # start and end: unpack/specialcases then normalisation/packing - pipestart = FPDIVSpecialCasesDeNorm(self.pspec) - pipeend = FPNormToPack(self.pspec) + self.pipestart = FPDIVSpecialCasesDeNorm(self.pspec) + self.pipeend = FPNormToPack(self.pspec) + + self._eqs = self.connect([pipestart] + pipechain + [pipeend]) + + def elaborate(self, platform): + m = ControlBase.elaborate(self, platform) # add submodules - m.submodules.scnorm = pipestart - for i, p in enumerate(pipechain): + m.submodules.scnorm = self.pipestart + for i, p in enumerate(self.pipechain): setattr(m.submodules, "pipediv%d" % i, p) - m.submodules.normpack = pipeend + m.submodules.normpack = self.pipeend # ControlBase.connect creates the "eqs" needed to connect each pipe - m.d.comb += self.connect([pipestart] + pipechain + [pipeend]) + m.d.comb += self._eqs return m