Short for arithmetic logic unit, the ALU is a complex digital circuit with an AU (arithmetic unit) and a LU (logic unit). Multiple Arithmetic Logic Units are in a computer, including multiple ALU's in the CPU (central processing unit), GPU (graphics processing unit), and FPU (floating-point unit).
The arithmetic unit handles all of the following computer numerical operations.
- Add - add two bits.
- Add with carry - add two bits with a carry-in.
- Subtract - subtract two bits.
- Subtract with borrow - subtract two bits with borrow from carry-in.
- Negate - flip the bits values sign (- to + or + to -).
- Increment - add 1 to a bit.
- Decrement - subtract 1 from a bit.
- Pass through - let bits through without modification.
Simple ALU's have no divide or multiply operations. For these ALU's to perform these operations, they use the add and subtraction operations.
Logic unit operations
The logic unit performs logical operations (e.g., AND, OR, and NOT) and numeric tests like checking if a number is a negative number.