Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Pipeline where
- import Clash.Prelude
- (<@>)
- :: ( HiddenClockResetEnable dom
- , Undefined b
- , Default b
- )
- => (a -> b)
- -> Signal dom a
- -> Signal dom b
- f <@> s =
- register def (f <$> s)
- infixr 9 <@>
- in1 :: Signal dom Int
- in1 = fromList [10..100]
- added1 :: HiddenClockResetEnable dom => Signal dom Int
- added1 = (+1) <@> in1
- multiplied1 :: HiddenClockResetEnable dom => Signal dom Int
- multiplied1 = (*2) <@> added1
- in2 :: HiddenClockResetEnable dom => Signal dom Int
- in2 = register 10 (in2 + 1)
- added2 :: HiddenClockResetEnable dom => Signal dom Int
- added2 = (+1) <@> in2
- multiplied2 :: HiddenClockResetEnable dom => Signal dom Int
- multiplied2 = (*2) <@> added2
- {-
- *Pipeline> sampleN @System 5 in1
- [10,11,12,13,14]
- *Pipeline> sampleN @System 5 added1
- [0,0,12,13,14]
- *Pipeline> sampleN @System 5 multiplied1
- [0,0,0,24,26]
- *Pipeline> sampleN @System 5 in2
- [10,10,11,12,13]
- *Pipeline> sampleN @System 5 added2
- [0,0,11,12,13]
- *Pipeline> sampleN @System 5 multiplied2
- [0,0,0,22,24]
- -}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement