playground/clash/Mac.hs

29 lines
515 B
Haskell

module Mac where
import Clash.Prelude
import Clash.Explicit.Testbench
import qualified Data.List as L
tf
:: Int
-> (Int, Int)
-> (Int, Int)
tf s (a,b) = (s+a*b, s)
tfun
:: SystemClockResetEnable
=> Signal System (Int, Int)
-> Signal System Int
tfun = mealy tf 0
topEntity
:: Clock System
-> Reset System
-> Enable System
-> Signal System (Int, Int)
-> Signal System Int
topEntity = exposeClockResetEnable tfun
-- L.take 4 $ simulate @System tfun [(1,1),(2,2),(3,3),(4,4)]