import Clash.Prelude
import Clash.Promoted.Nat.Unsafe
topEntity :: SystemClockReset => Signal System Bool
topEntity = metronome 4
metronome :: SystemClockReset => Integer -> Signal System Bool
metronome i =
case unsafeSNat i of
n@SNat -> (==0) <$> counter n
counter :: SystemClockReset => SNat i -> Signal System (Index i)
counter SNat = go where
go = register 0 $ fmap (\i -> if i == maxBound then 0 else i+1) go
errors with