From: Luke Kenneth Casson Leighton Date: Mon, 21 Feb 2022 00:26:14 +0000 (+0000) Subject: again reduce combinatorial chains, similar to Trap pipeline, X-Git-Url: https://git.libre-soc.org/?p=soc.git;a=commitdiff_plain;h=4586d3fbe87874110d7ca70eaed368237cab8ebd again reduce combinatorial chains, similar to Trap pipeline, introduce dummy passthrough stage in Branch pipeline --- diff --git a/src/soc/fu/branch/pipeline.py b/src/soc/fu/branch/pipeline.py index 1cdb3e9a..f7c9456e 100644 --- a/src/soc/fu/branch/pipeline.py +++ b/src/soc/fu/branch/pipeline.py @@ -1,6 +1,26 @@ from nmutil.singlepipe import ControlBase from nmutil.pipemodbase import PipeModBaseChain from soc.fu.branch.main_stage import BranchMainStage +from nmutil.pipemodbase import PipeModBase +from soc.fu.branch.pipe_data import BranchInputData +from nmigen import Module + +# gives a 1-clock delay to stop combinatorial link between in and out +class DummyBranchStage(PipeModBase): + def __init__(self, pspec): super().__init__(pspec, "dummy") + def ispec(self): return BranchInputData(self.pspec) + def ospec(self): return BranchInputData(self.pspec) + + def elaborate(self, platform): + m = Module() + m.d.comb += self.o.eq(self.i) # pass-through output + return m + +class BranchDummyStages(PipeModBaseChain): + def get_chain(self): + dummy = DummyBranchStage(self.pspec) + return [dummy] + class BranchStages(PipeModBaseChain): def get_chain(self): @@ -12,11 +32,13 @@ class BranchBasePipe(ControlBase): def __init__(self, pspec): ControlBase.__init__(self) self.pspec = pspec - self.pipe1 = BranchStages(pspec) - self._eqs = self.connect([self.pipe1]) + self.pipe1 = BranchDummyStages(pspec) + self.pipe2 = BranchStages(pspec) + self._eqs = self.connect([self.pipe1, self.pipe2]) def elaborate(self, platform): m = ControlBase.elaborate(self, platform) - m.submodules.pipe = self.pipe1 + m.submodules.pipe1 = self.pipe1 + m.submodules.pipe2 = self.pipe2 m.d.comb += self._eqs return m