🡄 Previous

Next 🡆

Contents > Functions

Logical AND-NOT

The logical AND-NOT function operates on a 2-byte array, where both bytes are Booleans, values restricted to 0 and 1. It replaces the first byte with the first byte ANDed with the inverse of the second byte:

f( [ A, B ] ) = [ Q, B ], where A,B,Q ∈ { 0, 1 }

Q = AB

B passes through unchanged, while A is lost.

Since A and B are Booleans, only their lowest bits are used to produce Q:

Logical AND NOT Schematic

The wire leading to the inverter—the horizontal line in the schematic above—appears diagonal in the Tetris realization because it consists of swap circuits stacked right-to-left, the arrangement required to propagate the signal across the B lines:

Logical AND NOT Schematic

There is a variation that operates on a 3-byte array, where all three bytes are Booleans. It sets the first byte to the second byte ANDed with the inverse of the third byte:

f( [ X, A, B ] ) = [ C, A, B ], where A,B,C ∈ { 0, 1 }

C = AB

A and B pass through unchanged, while X is discarded.

As above, only the lowest bits of A and B are used to generate the result:

Logical AND NOT Schematic

The Tetris version follows.

Logical AND NOT

🡄 Previous

Next 🡆