Struct acs::logic::alu::Alu

source · []
pub struct Alu { /* private fields */ }
Expand description

Arithmetic Logic Unit

Implementations

Carries out the ALU simulation.

It takes as input two main signals: x and y. Then the following:

  • zx: Set x to zero.
  • nx: Negate x.
  • zy: Set y to zero.
  • ny: Negate y.
  • f:
    • LO selects the & function
    • HI selects the + function
  • no: Negate out signal.

It can return one of the following: 0, 1, -1, x, y, !x, !y, -x, -y, x+1, y+1, x-1, y-1, x+y, x-y, y-x, x&y, x|y,

And two more signals which tell whether the result is zero or negative in this exact order.

Trait Implementations

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

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.