Build a CPU

Step 6 of 9

The ALU

Operations, plus a way to pick one

Your CPU needs to add and it needs to do logic. An arithmetic logic unit is not a new kind of thing — it is the operations you have already built, with a multiplexer choosing between them.

Sel off means AND the two inputs. Sel on means add them, so Result is the sum bit and Carry is the carry.

Watch the Carry column: when the ALU is doing logic rather than arithmetic there is nothing to carry, so it has to stay off. Real ALUs do exactly this.

This step builds on the ones before it, and will make a lot more sense after them. Go to Logic gates
You built

Tap a part to add it. Tap an output pin, then the part it feeds. Tap a switch to flip it.

A0 · tap to flipB0 · tap to flipSel0 · tap to flipResult—Carry—
Something has an unconnected input. Every input pin needs a wire before the circuit can run.
ABSelResultCarry
0000·0·
0010·0·
0100·0·
0111·0·
1000·0·
1011·0·
1101·0·
1110·1·

Sign in to save your progress. The board works either way.