{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# 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{SNat period
sPeriod :: forall (dom :: Domain) (period :: Nat) (edge :: ActiveEdge)
(reset :: ResetKind) (init :: InitBehavior)
(polarity :: ResetPolarity).
SDomainConfiguration
dom ('DomainConfiguration dom period edge reset init polarity)
-> SNat period
sPeriod :: SNat period
sPeriod} ->
SNat period
SNat period
sPeriod
{-# CLASH_OPAQUE 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{SActiveEdge edge
sActiveEdge :: forall (dom :: Domain) (period :: Nat) (edge :: ActiveEdge)
(reset :: ResetKind) (init :: InitBehavior)
(polarity :: ResetPolarity).
SDomainConfiguration
dom ('DomainConfiguration dom period edge reset init polarity)
-> SActiveEdge edge
sActiveEdge :: SActiveEdge edge
sActiveEdge} ->
SActiveEdge edge
SActiveEdge edge
sActiveEdge
{-# CLASH_OPAQUE 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{SResetKind reset
sResetKind :: forall (dom :: Domain) (period :: Nat) (edge :: ActiveEdge)
(reset :: ResetKind) (init :: InitBehavior)
(polarity :: ResetPolarity).
SDomainConfiguration
dom ('DomainConfiguration dom period edge reset init polarity)
-> SResetKind reset
sResetKind :: SResetKind reset
sResetKind} ->
SResetKind sync
SResetKind reset
sResetKind
{-# CLASH_OPAQUE 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{SInitBehavior init
sInitBehavior :: forall (dom :: Domain) (period :: Nat) (edge :: ActiveEdge)
(reset :: ResetKind) (init :: InitBehavior)
(polarity :: ResetPolarity).
SDomainConfiguration
dom ('DomainConfiguration dom period edge reset init polarity)
-> SInitBehavior init
sInitBehavior :: SInitBehavior init
sInitBehavior} ->
SInitBehavior init
SInitBehavior init
sInitBehavior
{-# CLASH_OPAQUE 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{SResetPolarity polarity
sResetPolarity :: forall (dom :: Domain) (period :: Nat) (edge :: ActiveEdge)
(reset :: ResetKind) (init :: InitBehavior)
(polarity :: ResetPolarity).
SDomainConfiguration
dom ('DomainConfiguration dom period edge reset init polarity)
-> SResetPolarity polarity
sResetPolarity :: SResetPolarity polarity
sResetPolarity} ->
SResetPolarity polarity
SResetPolarity polarity
sResetPolarity
{-# CLASH_OPAQUE 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)