1 from nmutil
.singlepipe
import ControlBase
2 from nmutil
.pipemodbase
import PipeModBaseChain
3 from soc
.fu
.trap
.main_stage
import TrapMainStage
4 from soc
.fu
.trap
.pipe_data
import TrapInputData
5 from nmutil
.pipemodbase
import PipeModBase
6 from nmigen
import Module
8 # gives a 1-clock delay to stop combinatorial link between in and out
9 class DummyTrapStage(PipeModBase
):
10 def __init__(self
, pspec
): super().__init
__(pspec
, "dummy")
11 def ispec(self
): return TrapInputData(self
.pspec
)
12 def ospec(self
): return TrapInputData(self
.pspec
)
14 def elaborate(self
, platform
):
16 m
.d
.comb
+= self
.o
.eq(self
.i
) # pass-through output
20 class TrapDummyStages(PipeModBaseChain
):
22 dummy
= DummyTrapStage(self
.pspec
)
26 class TrapStages(PipeModBaseChain
):
28 main
= TrapMainStage(self
.pspec
)
32 class TrapBasePipe(ControlBase
):
33 def __init__(self
, pspec
):
34 ControlBase
.__init
__(self
)
36 #self.pipe1 = TrapDummyStages(pspec)
37 self
.pipe2
= TrapStages(pspec
)
38 #pipes = [self.pipe1, self.pipe2]
40 self
._eqs
= self
.connect(pipes
)
42 def elaborate(self
, platform
):
43 m
= ControlBase
.elaborate(self
, platform
)
44 #m.submodules.pipe1 = self.pipe1
45 m
.submodules
.pipe2
= self
.pipe2