{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
module Clash.Signal.Internal.Ambiguous
( knownVDomain
, clockPeriod
, activeEdge
, resetKind
, initBehavior
, resetPolarity
) where
import Clash.Signal.Internal
import Clash.Promoted.Nat (SNat)
clockPeriod
:: forall dom period
. (KnownDomain dom, DomainPeriod dom ~ period)
=> SNat period
clockPeriod :: SNat period
clockPeriod =
case KnownDomain dom => SDomainConfiguration dom (KnownConf dom)
forall (dom :: Domain).
KnownDomain dom =>
SDomainConfiguration dom (KnownConf dom)
knownDomain @dom of
SDomainConfiguration SSymbol dom
_dom SNat period
period SActiveEdge edge
_edge SResetKind reset
_sync SInitBehavior init
_init SResetPolarity polarity
_polarity ->
SNat period
SNat period
period
{-# NOINLINE clockPeriod #-}
activeEdge
:: forall dom edge
. (KnownDomain dom, DomainActiveEdge dom ~ edge)
=> SActiveEdge edge
activeEdge :: SActiveEdge edge
activeEdge =
case KnownDomain dom => SDomainConfiguration dom (KnownConf dom)
forall (dom :: Domain).
KnownDomain dom =>
SDomainConfiguration dom (KnownConf dom)
knownDomain @dom of
SDomainConfiguration SSymbol dom
_dom SNat period
_period SActiveEdge edge
edge SResetKind reset
_sync SInitBehavior init
_init SResetPolarity polarity
_polarity ->
SActiveEdge edge
SActiveEdge edge
edge
{-# NOINLINE activeEdge #-}
resetKind
:: forall dom sync
. (KnownDomain dom, DomainResetKind dom ~ sync)
=> SResetKind sync
resetKind :: SResetKind sync
resetKind =
case KnownDomain dom => SDomainConfiguration dom (KnownConf dom)
forall (dom :: Domain).
KnownDomain dom =>
SDomainConfiguration dom (KnownConf dom)
knownDomain @dom of
SDomainConfiguration SSymbol dom
_dom SNat period
_period SActiveEdge edge
_edge SResetKind reset
sync SInitBehavior init
_init SResetPolarity polarity
_polarity ->
SResetKind sync
SResetKind reset
sync
{-# NOINLINE resetKind #-}
initBehavior
:: forall dom init
. (KnownDomain dom, DomainInitBehavior dom ~ init)
=> SInitBehavior init
initBehavior :: SInitBehavior init
initBehavior =
case KnownDomain dom => SDomainConfiguration dom (KnownConf dom)
forall (dom :: Domain).
KnownDomain dom =>
SDomainConfiguration dom (KnownConf dom)
knownDomain @dom of
SDomainConfiguration SSymbol dom
_dom SNat period
_period SActiveEdge edge
_edge SResetKind reset
_sync SInitBehavior init
init_ SResetPolarity polarity
_polarity ->
SInitBehavior init
SInitBehavior init
init_
{-# NOINLINE initBehavior #-}
resetPolarity
:: forall dom polarity
. (KnownDomain dom, DomainResetPolarity dom ~ polarity)
=> SResetPolarity polarity
resetPolarity :: SResetPolarity polarity
resetPolarity =
case KnownDomain dom => SDomainConfiguration dom (KnownConf dom)
forall (dom :: Domain).
KnownDomain dom =>
SDomainConfiguration dom (KnownConf dom)
knownDomain @dom of
SDomainConfiguration SSymbol dom
_dom SNat period
_period SActiveEdge edge
_edge SResetKind reset
_sync SInitBehavior init
_init SResetPolarity polarity
polarity ->
SResetPolarity polarity
SResetPolarity polarity
polarity
{-# NOINLINE resetPolarity #-}
knownVDomain
:: forall dom
. KnownDomain dom
=> VDomainConfiguration
knownVDomain :: VDomainConfiguration
knownVDomain =
SDomainConfiguration dom (KnownConf dom) -> VDomainConfiguration
forall (dom :: Domain) (conf :: DomainConfiguration).
SDomainConfiguration dom conf -> VDomainConfiguration
vDomain (KnownDomain dom => SDomainConfiguration dom (KnownConf dom)
forall (dom :: Domain).
KnownDomain dom =>
SDomainConfiguration dom (KnownConf dom)
knownDomain @dom)