🡄 Previous

Next 🡆

Contents > Functions

Conditional Increment

The conditional increment function operates on a 2-element array, [ W, C ], where W is a signed or unsigned 16-bit integer, and C is a Boolean, a byte restricted to 0 and 1:

f( [ W, C ] ) = [ Q, C ], where C ∈ { 0, 1 }

Q is W + 1 if C is 1; otherwise, Q is W. Either way, C passes through, unchanged.

As shown below, its circuit consists of a 16-bit incrementer, where the carry-in is C0 and the carry-out is discarded.

Conditional Increment Schematic

Here is the Tetris version:

Conditional Increment

🡄 Previous

Next 🡆