Hoogle Search

Within LTS Haskell 24.70 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. hideClockResetEnable :: forall (dom :: Domain) r . HiddenClockResetEnable dom => (KnownDomain dom => Clock dom -> Reset dom -> Enable dom -> r) -> r

    clash-prelude Clash.Signal

    Hide the Clock, Reset, and Enable arguments of a component, so they can be routed implicitly. Click here to read more about hidden clocks, resets, and enables

  2. hideReset :: forall (dom :: Domain) r . HiddenReset dom => (Reset dom -> r) -> r

    clash-prelude Clash.Signal

    Hide the Reset argument of a component, so it can be routed implicitly. Click here to read more about hidden clocks, resets, and enables

  3. holdReset :: forall (dom :: Domain) (m :: Nat) . HiddenClockResetEnable dom => SNat m -> Reset dom

    clash-prelude Clash.Signal

    Hold reset for a number of cycles relative to an incoming reset signal. NB: The output of this function is combinational for n > 1 on domains with a synchronous reset. Use registerSyncReset to add an output register if desired. Example:

    >>> holdResetBool = unsafeToActiveHigh . (holdReset @System)
    
    >>> sampleN 8 (exposeReset (holdResetBool (SNat @2)) (resetGenN (SNat @3)))
    [True,True,True,True,True,False,False,False]
    
    holdReset holds the reset for an additional 2 clock cycles for a total of 5 clock cycles where the reset is asserted. holdReset also works on intermediate assertions of the reset signal:
    >>> let rst = fromList [True, False, False, False, True, False, False, False]
    
    >>> sampleN 8 (exposeReset (holdResetBool (SNat @2)) (unsafeFromActiveHigh rst))
    [True,True,True,False,True,True,True,False]
    

  4. registerSyncReset :: forall (dom :: Domain) . (HiddenClockResetEnable dom, KnownDomain dom, DomainResetKind dom ~ 'Synchronous) => Bool -> Reset dom

    clash-prelude Clash.Signal

    Register a synchronous reset signal. registerSyncReset delays an incoming reset by one clock cycle using a register. This can be useful to break combinational paths involving reset logic. NB: This is not a synchronizer. Use resetSynchronizer to synchronize a reset. Example:

    >>> registerSyncResetBool = unsafeToActiveHigh . (registerSyncReset @XilinxSystem)
    
    >>> let rst = unsafeFromActiveHigh (fromList [False, True, False, False, True, False])
    
    >>> sampleN 7 (exposeReset (registerSyncResetBool True) rst)
    [True,False,True,False,False,True,False]
    

  5. resetGen :: forall (dom :: Domain) . KnownDomain dom => Reset dom

    clash-prelude Clash.Signal

    Reset generator for simulation purposes. Asserts the reset for a single cycle. To be used like:

    rstSystem = resetGen @System
    
    See tbClockGen for example usage. NB: While this can be used in the testBench function, it cannot be synthesized to hardware.

  6. resetGenN :: forall (dom :: Domain) (n :: Natural) . (KnownDomain dom, 1 <= n) => SNat n -> Reset dom

    clash-prelude Clash.Signal

    Reset generator for simulation purposes. Asserts the reset for the first n cycles. To be used like:

    rstSystem5 = resetGen @System d5
    
    Example usage:
    >>> sampleN 7 (unsafeToActiveHigh (resetGenN @System d3))
    [True,True,True,False,False,False,False]
    
    NB: While this can be used in the testBench function, it cannot be synthesized to hardware.

  7. resetGlitchFilter :: forall (dom :: Domain) (glitchlessPeriod :: Natural) . (HasCallStack, HasDefinedInitialValues dom, 1 <= glitchlessPeriod) => SNat glitchlessPeriod -> Clock dom -> Reset dom -> Reset dom

    clash-prelude Clash.Signal

    Filter glitches from reset signals by only triggering a reset after it has been asserted for glitchlessPeriod cycles. Similarly, it will stay asserted until a glitchlessPeriod number of deasserted cycles have been observed. This circuit can only be used on platforms supporting initial values. This restriction can be worked around by using unsafeResetGlitchFilter but this is not recommended. On platforms without initial values, you should instead use resetGlitchFilterWithReset with an additional power-on reset, or holdReset if filtering is only needed on deassertion. At power-on, the reset will be asserted. If the filtered reset input remains unasserted, the output reset will deassert after glitchlessPeriod clock cycles. If resetGlitchFilter is used in a domain with asynchronous resets (Asynchronous), resetGlitchFilter will first synchronize the reset input with dualFlipFlopSynchronizer.

    Example 1

    >>> let sampleResetN n = sampleN n . unsafeToActiveHigh
    
    >>> let resetFromList = unsafeFromActiveHigh . fromList
    
    >>> let rst = resetFromList [True, True, False, False, True, False, False, True, True, False, True, True]
    
    >>> sampleResetN 12 (resetGlitchFilter d2 (clockGen @XilinxSystem) rst)
    [True,True,True,True,False,False,False,False,False,True,True,True]
    

  8. resetKind :: forall (dom :: Domain) (sync :: ResetKind) . (KnownDomain dom, DomainResetKind dom ~ sync) => SResetKind sync

    clash-prelude Clash.Signal

    Get ResetKind from a KnownDomain context. Example usage:

    f :: forall dom . KnownDomain dom => ....
    f a b c =
    case resetKind @dom of
    SAsynchronous -> foo
    SSynchronous -> bar
    

  9. resetPolarity :: forall (dom :: Domain) (polarity :: ResetPolarity) . (KnownDomain dom, DomainResetPolarity dom ~ polarity) => SResetPolarity polarity

    clash-prelude Clash.Signal

    Get ResetPolarity from a KnownDomain context. Example usage:

    f :: forall dom . KnownDomain dom => ....
    f a b c =
    case resetPolarity @dom of
    SActiveHigh -> foo
    SActiveLow -> bar
    

  10. resetSynchronizer :: forall (dom :: Domain) . KnownDomain dom => Clock dom -> Reset dom -> Reset dom

    clash-prelude Clash.Signal

    The resetSynchronizer will synchronize an incoming reset according to whether the domain is synchronous or asynchronous. For asynchronous resets this synchronizer ensures the reset will only be de-asserted synchronously but it can still be asserted asynchronously. The reset assert is immediate, but reset de-assertion is delayed by two cycles. Normally, asynchronous resets can be both asynchronously asserted and de-asserted. Asynchronous de-assertion can induce meta-stability in the component which is being reset. To ensure this doesn't happen, resetSynchronizer ensures that de-assertion of a reset happens synchronously. Assertion of the reset remains asynchronous. Note that asynchronous assertion does not induce meta-stability in the component whose reset is asserted. However, when a component "A" in another clock or reset domain depends on the value of a component "B" being reset, then asynchronous assertion of the reset of component "B" can induce meta-stability in component "A". To prevent this from happening you need to use a proper synchronizer, for example one of the synchronizers in Clash.Explicit.Synchronizer. For synchronous resets this function ensures that the reset is asserted and de-asserted synchronously. Both the assertion and de-assertion of the reset are delayed by two cycles.

    Example 1

    The circuit below detects a rising bit (i.e., a transition from 0 to 1) in a given argument. It takes a reset that is not synchronized to any of the other incoming signals and synchronizes it using resetSynchronizer.
    topEntity
    :: Clock  System
    -> Reset  System
    -> Signal System Bit
    -> Signal System (BitVector 8)
    topEntity clk asyncRst key1 =
    withClockResetEnable clk rst enableGen leds
    where
    rst   = resetSynchronizer clk asyncRst
    key1R = isRising 1 key1
    leds  = mealy blinkerT (1, False, 0) key1R
    

    Example 2

    Similar to Example 1 this circuit detects a rising bit (i.e., a transition from 0 to 1) in a given argument. It takes a clock that is not stable yet and a reset signal that is not synchronized to any other signals. It stabilizes the clock and then synchronizes the reset signal. Note that the function altpllSync provides this functionality in a convenient form, obviating the need for resetSynchronizer for this use case.
    topEntity
    :: Clock  System
    -> Reset  System
    -> Signal System Bit
    -> Signal System (BitVector 8)
    topEntity clk rst key1 =
    let  (pllOut,pllStable) = unsafeAltpll clk rst
    rstSync            = resetSynchronizer pllOut (unsafeFromActiveLow pllStable)
    in   exposeClockResetEnable leds pllOut rstSync enableGen
    where
    key1R  = isRising 1 key1
    leds   = mealy blinkerT (1, False, 0) key1R
    

    Implementation details

    resetSynchronizer implements the following circuit for asynchronous domains:
    rst
    --------------------------------------+
    |                 |
    +----v----+       +----v----+
    deasserted   |         |       |         |
    --------------->         +------->         +-------->
    |         |       |         |
    +---|>        |   +---|>        |
    |   |         |   |   |         |
    |   +---------+   |   +---------+
    clk     |                 |
    -----------------------------+
    
    This corresponds to figure 3d at https://www.embedded.com/asynchronous-reset-synchronization-and-distribution-challenges-and-solutions/ For synchronous domains two sequential dflipflops are used:
    +---------+       +---------+
    rst          |         |       |         |
    --------------->         +------->         +-------->
    |         |       |         |
    +---|>        |   +---|>        |
    |   |         |   |   |         |
    |   +---------+   |   +---------+
    clk     |                 |
    -----------------------------+
    

Page 1660 of many | Previous | Next