From cf7c926b611e7e5de9235774b14b1da7c7ba59e8 Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Wed, 1 Apr 2020 13:17:27 -0400 Subject: [PATCH] Register each pipeline stage --- src/ieee754/cordic/sin_cos_pipeline.py | 27 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) 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 -- 2.30.2