/ˌeɪ ɛl ˈjuː/

noun … “Circuit that performs arithmetic and logic operations.”

ALU, short for Arithmetic Logic Unit, is a fundamental component of a CPU or microprocessor that executes mathematical calculations (addition, subtraction, multiplication, division) and logical operations (AND, OR, NOT, XOR). The ALU processes binary data from registers or memory and outputs the result to registers, memory, or other parts of the system.

Key characteristics of ALU include:

  • Arithmetic operations: addition, subtraction, multiplication, division.
  • Logical operations: AND, OR, NOT, XOR, comparison operations.
  • Bitwise operations: shift left, shift right, rotate.
  • Integration: works with control unit, registers, and memory to execute instructions.
  • Width: defined by the number of bits it can process simultaneously (e.g., 8-bit, 32-bit, 64-bit).

Applications of ALU include executing CPU instructions, performing calculations in microcontrollers, signal processing, and computer graphics operations.

Workflow example: Adding two binary numbers:

operand1 = 0b1010   -- 10
operand2 = 0b0111   -- 7
result = ALU.add(operand1, operand2)
print(result)       -- 0b10001 (17)

Here, the ALU adds two binary operands and outputs the sum.

Conceptually, an ALU is like the brain’s calculator: it takes inputs, performs defined operations, and delivers precise results to the system.

See CPU, Microprocessor, Registers, Control Unit, Binary.