Struct rust_hdl::widgets::strobe::Strobe

source ·
pub struct Strobe<const N: usize> {
    pub enable: Signal<In, Bit>,
    pub strobe: Signal<Out, Bit>,
    pub clock: Signal<In, Clock>,
    /* private fields */
}
Expand description

A Strobe generates a periodic pulse train, with a single clock-cycle wide pulse at the prescribed frequency. The argument [N] of the generic Strobe is used to size the counter that stores the internal delay value. Unfortunately, Rust const generics are currently not good enough to compute [N] on the fly. However, a compile time assert ensures that the number of clock cycles between pulses does not overflow the [N]-bit wide register inside the Strobe.

Fields§

§enable: Signal<In, Bit>

Set this to true to enable the pulse train.

§strobe: Signal<Out, Bit>

This is the strobing signal - it will fire for 1 clock cycle such that the strobe frequency is generated.

§clock: Signal<In, Clock>

The clock that drives the Strobe. All signals are synchronous to this clock.

Implementations§

Generate a Strobe widget that can be used in a RustHDL circuit.

Arguments
  • frequency: The frequency (in Hz) of the clock signal driving the circuit.
  • strobe_freq_hz: The desired frequency in Hz of the output strobe. Note that the strobe frequency will be rounded to something that can be obtained by dividing the input clock by an integer. As such, it may not produce exactly the desired frequency, unless frequency/strobe_freq_hz is an integer.

returns: Strobe<{ N }>

Examples

See [BlinkExample] for an example.

Trait Implementations§

Connects the internal signals of the circuit - used to initialize the circuit
Propogate changes from inputs to outputs within the circuit
Returns true if anything in the circuit has changed (outputs or internal state)
The visitor pattern - allows a circuit to be probed by a Probe struct.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.