From: Michael Nolan Date: Wed, 1 Apr 2020 17:17:27 +0000 (-0400) Subject: Register each pipeline stage X-Git-Tag: ls180-24jan2020~100 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cf7c926b611e7e5de9235774b14b1da7c7ba59e8;p=ieee754fpu.git Register each pipeline stage --- diff --git a/src/ieee754/cordic/sin_cos_pipeline.py b/src/ieee754/cordic/sin_cos_pipeline.py index 65ac9525..e8b3a6be 100644 --- a/src/ieee754/cordic/sin_cos_pipeline.py +++ b/src/ieee754/cordic/sin_cos_pipeline.py @@ -8,23 +8,32 @@ from ieee754.cordic.pipe_data import (CordicPipeSpec, CordicData, CordicInitialData) class CordicPipeChain(PipeModBaseChain): + def __init__(self, pspec, stages): + self.stages = stages + super().__init__(pspec) + def get_chain(self): - initstage = CordicInitialStage(self.pspec) - cordicstages = [] - for i in range(self.pspec.iterations): - stage = CordicStage(self.pspec, i) - cordicstages.append(stage) - return [initstage] + cordicstages + return self.stages class CordicBasePipe(ControlBase): def __init__(self, pspec): ControlBase.__init__(self) - self.chain = CordicPipeChain(pspec) - self._eqs = self.connect([self.chain]) + self.initstage = CordicPipeChain(pspec, + [CordicInitialStage(pspec)]) + self.cordicstages = [] + for i in range(pspec.iterations): + stage = CordicPipeChain(pspec, + [CordicStage(pspec, i)]) + self.cordicstages.append(stage) + + self._eqs = self.connect([self.initstage] + self.cordicstages) def elaborate(self, platform): m = ControlBase.elaborate(self, platform) - m.submodules.chain = self.chain + m.submodules.init = self.initstage + for i, stage in enumerate(self.cordicstages): + setattr(m.submodules, "cordic%d" % i, + stage) m.d.comb += self._eqs return m