Safe Haskell | None |
---|---|
Language | Haskell2010 |
The Clock
module provides a utility function for simulating clock rate
downsampling.
- rate :: forall x clk. (Clock clk, Size x) => Witness x -> Rational -> Signal clk Bool
- powerOfTwoRate :: forall x clk. (Clock clk, Size x) => Witness x -> Signal clk Bool
- rateP :: forall c sig. (Clock c, sig ~ Signal c) => sig Bool -> Patch () (sig (Enabled ())) () (sig Ack)
- throttleP :: forall sig c a x. (sig ~ Signal c, Clock c, Rep a) => sig Bool -> Patch (sig (Enabled a)) (sig (Enabled a)) (sig Ack) (sig Ack)
Documentation
rate :: forall x clk. (Clock clk, Size x) => Witness x -> Rational -> Signal clk Bool Source
rate
constructs a stream of enable bits used for clock-rate
downsampling. For example, with a rate of n=1/2, every other value in the
output stream will be True. If 1/n is not a integer, then the function uses
http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm to approximate the
given rate.
powerOfTwoRate :: forall x clk. (Clock clk, Size x) => Witness x -> Signal clk Bool Source
powerOfTwoRate
generates a pulse every 2^n cycles, which is often good enough for polling, timeouts, etc.