playground/clash/ListState.hs

32 lines
475 B
Haskell

module ListState where
import Clash.Prelude
import qualified Data.List
lst = [1,2,3]
tf
:: Int
-> ()
-> (Int, Int)
tf s i = (mod (s+1) 3, (Data.List.!!) lst s)
tfun
:: SystemClockResetEnable
=> Signal System ()
-> Signal System Int
tfun = mealy tf 0
topEntity
:: Clock System
-> Reset System
-> Enable System
-> Signal System ()
-> Signal System Int
topEntity = exposeClockResetEnable tfun
{-
compiles and synthesizes
-}