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.
Something has an unconnected input. Every input pin needs a wire before the circuit can run.
| A | B | Sel | Result | Carry | |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0· | 0· | |
| 0 | 0 | 1 | 0· | 0· | |
| 0 | 1 | 0 | 0· | 0· | |
| 0 | 1 | 1 | 1· | 0· | |
| 1 | 0 | 0 | 0· | 0· | |
| 1 | 0 | 1 | 1· | 0· | |
| 1 | 1 | 0 | 1· | 0· | |
| 1 | 1 | 1 | 0· | 1· |
Sign in to save your progress. The board works either way.