Explore the Arithmetic Logic Unit, the computational heart of every processor. Watch how 8-bit inputs flow through the ALU datapath, operations are selected, and results with status flags are produced step by step.
| Op | Opcode | Symbol | Function | Category |
|---|---|---|---|---|
| Add | 000 | + | A + B | arithmetic |
| Subtract | 001 | - | A - B | arithmetic |
| AND | 010 | & | A AND B | logic |
| OR | 011 | | | A OR B | logic |
| XOR | 100 | ^ | A XOR B | logic |
| NOT | 101 | ~ | NOT A | logic |
| Shift Left | 110 | << | A << B | shift |
| Shift Right | 111 | >> | A >> B | shift |
Set when the result is exactly 0. Used for equality comparisons (if A - B = 0, then A == B).
5 - 5 = 0 → Z=1
Set when an unsigned operation produces a result larger than 8 bits (carry out) or a borrow in subtraction.
200 + 100 = 300 → C=1 (300 > 255)
Set when a signed operation produces a result outside the -128 to 127 range. Detected when the sign of the result contradicts the signs of the operands.
127 + 1 = -128 → V=1
Set when the most significant bit (bit 7) of the result is 1, indicating a negative number in two's complement.
5 - 10 = -5 → N=1