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. registerSyncReset :: forall (dom :: Domain) . (HiddenClockResetEnable dom, KnownDomain dom, DomainResetKind dom ~ 'Synchronous) => Bool -> Reset dom

    clash-prelude Clash.Prelude

    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]
    

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

    clash-prelude Clash.Prelude

    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.

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

    clash-prelude Clash.Prelude

    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.

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

    clash-prelude Clash.Prelude

    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]
    

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

    clash-prelude Clash.Prelude

    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
    

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

    clash-prelude Clash.Prelude

    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
    

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

    clash-prelude Clash.Prelude

    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     |                 |
    -----------------------------+
    

  8. sampleWithReset :: forall (dom :: Domain) a (m :: Natural) . (KnownDomain dom, NFDataX a, 1 <= m) => SNat m -> (HiddenClockResetEnable dom => Signal dom a) -> [a]

    clash-prelude Clash.Prelude

    Get an infinite list of samples from a Signal, while asserting the reset line for m clock cycles. sampleWithReset does not return the first m cycles, i.e., when the reset is asserted. NB: This function is not synthesizable

  9. sampleWithResetN :: forall (dom :: Domain) a (m :: Natural) . (KnownDomain dom, NFDataX a, 1 <= m) => SNat m -> Int -> (HiddenClockResetEnable dom => Signal dom a) -> [a]

    clash-prelude Clash.Prelude

    Get a list of n samples from a Signal, while asserting the reset line for m clock cycles. sampleWithReset does not return the first m cycles, i.e., while the reset is asserted. NB: This function is not synthesizable

  10. simulateWithReset :: forall (dom :: Domain) a b (m :: Natural) . (KnownDomain dom, NFDataX a, NFDataX b, 1 <= m) => SNat m -> a -> (HiddenClockResetEnable dom => Signal dom a -> Signal dom b) -> [a] -> [b]

    clash-prelude Clash.Prelude

    Same as simulate, but with the reset line asserted for n cycles. Similar to simulate, simulateWithReset will drop the output values produced while the reset is asserted. While the reset is asserted, the reset value a is supplied to the circuit.

Page 1656 of many | Previous | Next