Oops, forgot pipeline.py
authorMichael Nolan <mtnolan2640@gmail.com>
Fri, 8 May 2020 20:35:40 +0000 (16:35 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Fri, 8 May 2020 20:35:40 +0000 (16:35 -0400)
src/soc/alu/pipeline.py [new file with mode: 0644]

diff --git a/src/soc/alu/pipeline.py b/src/soc/alu/pipeline.py
new file mode 100644 (file)
index 0000000..e8dd199
--- /dev/null
@@ -0,0 +1,25 @@
+from nmutil.singlepipe import ControlBase
+from nmutil.pipemodbase import PipeModBaseChain
+from soc.alu.input_stage import ALUInputStage
+from soc.alu.main_stage import ALUMainStage
+from soc.alu.output_stage import ALUOutputStage
+
+class ALUStages(PipeModBaseChain):
+    def get_chain(self):
+        inp = ALUInputStage(self.pspec)
+        main = ALUMainStage(self.pspec)
+        out = ALUOutputStage(self.pspec)
+        return [inp, main, out]
+
+
+class ALUBasePipe(ControlBase):
+    def __init__(self, pspec):
+        ControlBase.__init__(self)
+        self.pipe1 = ALUStages(pspec)
+        self._eqs = self.connect([self.pipe1])
+
+    def elaborate(self, platform):
+        m = ControlBase.elaborate(self, platform)
+        m.submodules.pipe = self.pipe1
+        m.d.comb += self._eqs
+        return m