pub struct Counter {
    pub inp: Signal16,
    pub reset: Signal,
    pub load: Signal,
    pub inc: Signal,
    pub out: Signal16,
    /* private fields */
}
Expand description

Fast memory device which can increment its value in every time unit.

Fields

inp: Signal16reset: Signalload: Signalinc: Signalout: Signal16

Implementations

Carries out the simulation, taking as input:

  • inp: data input
  • reset: whether to reset to zero or not
  • load: whether to write inp into the counter register
  • inc: whether to increment the counter register

It returns the following:

if reset(t-1) { out(t) = 0 }
else if load(t-1) { out(t) = in(t-1) }
else if inc(t-1) { out(t) = out(t-1)+1 }
else { out(t) = out(t-1) }

Trait Implementations

Returns the “default value” for a type. Read more
Carries out the tick-phase of a clock cycle: LOW
Carries out the tock-phase of a clock cycle: HIGH
Evaluates the logic expression as we do with arithmetic without advancing the time. 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 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.