{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoGeneralizedNewtypeDeriving #-}
{-# LANGUAGE Safe #-}
module Clash.Prelude.Moore
(
moore
, mooreB
, medvedev
, medvedevB
)
where
import qualified Clash.Explicit.Moore as E
import Clash.Signal
import Clash.XException (NFDataX)
moore
:: ( HiddenClockResetEnable dom
, NFDataX s )
=> (s -> i -> s)
-> (s -> o)
-> s
-> (Signal dom i -> Signal dom o)
moore :: (s -> i -> s) -> (s -> o) -> s -> Signal dom i -> Signal dom o
moore = (KnownDomain dom =>
Clock dom
-> Reset dom
-> Enable dom
-> (s -> i -> s)
-> (s -> o)
-> s
-> Signal dom i
-> Signal dom o)
-> (s -> i -> s) -> (s -> o) -> s -> Signal dom i -> Signal dom o
forall (dom :: Domain) r.
HiddenClockResetEnable dom =>
(KnownDomain dom => Clock dom -> Reset dom -> Enable dom -> r) -> r
hideClockResetEnable KnownDomain dom =>
Clock dom
-> Reset dom
-> Enable dom
-> (s -> i -> s)
-> (s -> o)
-> s
-> Signal dom i
-> Signal dom o
forall (dom :: Domain) s i o.
(KnownDomain dom, NFDataX s) =>
Clock dom
-> Reset dom
-> Enable dom
-> (s -> i -> s)
-> (s -> o)
-> s
-> Signal dom i
-> Signal dom o
E.moore
{-# INLINE moore #-}
medvedev
:: ( HiddenClockResetEnable dom
, NFDataX s )
=> (s -> i -> s)
-> s
-> (Signal dom i -> Signal dom s)
medvedev :: (s -> i -> s) -> s -> Signal dom i -> Signal dom s
medvedev s -> i -> s
tr s
st = (s -> i -> s) -> (s -> s) -> s -> Signal dom i -> Signal dom s
forall (dom :: Domain) s i o.
(HiddenClockResetEnable dom, NFDataX s) =>
(s -> i -> s) -> (s -> o) -> s -> Signal dom i -> Signal dom o
moore s -> i -> s
tr s -> s
forall a. a -> a
id s
st
{-# INLINE medvedev #-}
mooreB
:: ( HiddenClockResetEnable dom
, NFDataX s
, Bundle i
, Bundle o )
=> (s -> i -> s)
-> (s -> o)
-> s
-> (Unbundled dom i -> Unbundled dom o)
mooreB :: (s -> i -> s)
-> (s -> o) -> s -> Unbundled dom i -> Unbundled dom o
mooreB = (KnownDomain dom =>
Clock dom
-> Reset dom
-> Enable dom
-> (s -> i -> s)
-> (s -> o)
-> s
-> Unbundled dom i
-> Unbundled dom o)
-> (s -> i -> s)
-> (s -> o)
-> s
-> Unbundled dom i
-> Unbundled dom o
forall (dom :: Domain) r.
HiddenClockResetEnable dom =>
(KnownDomain dom => Clock dom -> Reset dom -> Enable dom -> r) -> r
hideClockResetEnable KnownDomain dom =>
Clock dom
-> Reset dom
-> Enable dom
-> (s -> i -> s)
-> (s -> o)
-> s
-> Unbundled dom i
-> Unbundled dom o
forall (dom :: Domain) s i o.
(KnownDomain dom, NFDataX s, Bundle i, Bundle o) =>
Clock dom
-> Reset dom
-> Enable dom
-> (s -> i -> s)
-> (s -> o)
-> s
-> Unbundled dom i
-> Unbundled dom o
E.mooreB
{-# INLINE mooreB #-}
medvedevB
:: ( HiddenClockResetEnable dom
, NFDataX s
, Bundle i
, Bundle s )
=> (s -> i -> s)
-> s
-> (Unbundled dom i -> Unbundled dom s)
medvedevB :: (s -> i -> s) -> s -> Unbundled dom i -> Unbundled dom s
medvedevB s -> i -> s
tr s
st = (s -> i -> s)
-> (s -> s) -> s -> Unbundled dom i -> Unbundled dom s
forall (dom :: Domain) s i o.
(HiddenClockResetEnable dom, NFDataX s, Bundle i, Bundle o) =>
(s -> i -> s)
-> (s -> o) -> s -> Unbundled dom i -> Unbundled dom o
mooreB s -> i -> s
tr s -> s
forall a. a -> a
id s
st
{-# INLINE medvedevB #-}