c27a0e566295ce00f5cf839db64e24b9d43c2e2f
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 TrapOutputData
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 TrapOutputData(self
.pspec
)
12 def ospec(self
): return TrapOutputData(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
= TrapStages(pspec
)
37 self
.pipe2
= TrapDummyStages(pspec
)
38 self
._eqs
= self
.connect([self
.pipe1
, self
.pipe2
])
40 def elaborate(self
, platform
):
41 m
= ControlBase
.elaborate(self
, platform
)
42 m
.submodules
.pipe1
= self
.pipe1
43 m
.submodules
.pipe2
= self
.pipe2