32 lines
623 B
Haskell
32 lines
623 B
Haskell
import Clash.Prelude
|
|
-- import Clash.Explicit.Testbench
|
|
|
|
data SList (n :: Nat) a
|
|
= SNil
|
|
| SCons !a !(SList a)
|
|
deriving (NFDataX, Generic)
|
|
|
|
isSNil :: SList a -> Bool
|
|
isSNil sl = case sl of
|
|
SNil -> True
|
|
_ -> False
|
|
|
|
tf :: SList Int -> Int -> (SList Int, Maybe Bool)
|
|
tf s inp = case s of
|
|
SCons _ s' -> (s', Just False)
|
|
SNil -> (SNil, Just True)
|
|
|
|
mon
|
|
:: SystemClockResetEnable
|
|
=> Signal System Int
|
|
-> Signal System (Maybe Bool)
|
|
mon = mealy tf SNil
|
|
|
|
topEntity
|
|
:: Clock System
|
|
-> Reset System
|
|
-> Enable System
|
|
-> Signal System Int
|
|
-> Signal System (Maybe Bool)
|
|
topEntity = exposeClockResetEnable mon
|