nix-development-configs/haskell-clash/MAC.hs
harris-chris 35b90044df Add clash
2022-03-18 11:21:33 +09:00

18 lines
419 B
Haskell

module MAC where
import Clash.Prelude
import Clash.Explicit.Testbench
mac :: (Num a) => a -> (a, a) -> (a, a)
mac acc (x, y) = (acc + x * y, acc)
macS :: (HiddenClockResetEnable dom, Num a, NFDataX a) => Signal dom (a, a) -> Signal dom a
macS = mealy mac 0
topEntity
:: Clock System
-> Reset System
-> Enable System
-> Signal System (Int, Int)
-> Signal System Int
topEntity = exposeClockResetEnable macS