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