9 -- Begin Signature ----------------------------------------------------------
12 pipeReg is helpful for constructing in pipelines
15 data PipeRegCmd = Input | Stall | Kill
16 deriving (Eq,Ord,Enum,Bounded,Show)
19 -- pipeReg t cmd ts , on the first cycle return "t", in later cycles,
20 -- if cmd=Input then return ts, if cmd=Stall then return the previous
21 -- value and store the input, if cmd=Kill then return a nop
23 pipeReg :: (Instruction a, Register b) =>
24 Trans a (c b d) -> Signal PipeRegCmd ->
25 Signal (Trans a (c b d)) -> Signal (Trans a (c b d))
27 input :: Signal PipeRegCmd
28 stall :: Signal PipeRegCmd
29 kill :: Signal PipeRegCmd
31 -- End Signature ----------------------------------------------------------
33 pipeReg init cmd incoming = out
34 where out = delay init (if' (cmd*==input) then' incoming
35 else' (if' (cmd*==stall) then' out