67dc034c61d07a7f37c7ef5a6ec222743abc0221
[soc.git] / src / soc / fu / shift_rot / pipeline.py
1 from nmutil.singlepipe import ControlBase
2 from nmutil.pipemodbase import PipeModBaseChain
3 from soc.fu.shift_rot.input_stage import ShiftRotInputStage
4 from soc.fu.shift_rot.main_stage import ShiftRotMainStage
5 from soc.fu.shift_rot.output_stage import ShiftRotOutputStage
6
7 class ShiftRotStart(PipeModBaseChain):
8 def get_chain(self):
9 inp = ShiftRotInputStage(self.pspec)
10 return [inp]
11
12 class ShiftRotStage(PipeModBaseChain):
13 def get_chain(self):
14 main = ShiftRotMainStage(self.pspec)
15 return [main]
16
17
18 class ShiftRotStageEnd(PipeModBaseChain):
19 def get_chain(self):
20 out = ShiftRotOutputStage(self.pspec)
21 return [out]
22
23
24 class ShiftRotBasePipe(ControlBase):
25 def __init__(self, pspec):
26 ControlBase.__init__(self)
27 self.pspec = pspec
28 self.pipe1 = ShiftRotStart(pspec)
29 self.pipe2 = ShiftRotStage(pspec)
30 self.pipe3 = ShiftRotStageEnd(pspec)
31 self._eqs = self.connect([self.pipe1, self.pipe2, self.pipe3])
32
33 def elaborate(self, platform):
34 m = ControlBase.elaborate(self, platform)
35 m.submodules.pipe1 = self.pipe1
36 m.submodules.pipe2 = self.pipe2
37 m.submodules.pipe3 = self.pipe3
38 m.d.comb += self._eqs
39 return m