Menu

Parts of the CPU

Arithmetic Logic Unit

The Arithmetic Logic Unit (ALU) is the part of the CPU that carries out calculations and tests on values. It is a CPU component, not a register: it works on values rather than storing them.

The ALU handles three kinds of operation:

  • Arithmetic operations work with numbers: addition, subtraction, multiplication and division are all carried out here.
  • Logical operations work on binary values, combining them with AND and OR or inverting them with NOT.
  • Comparisons test two values and produce a true or false answer, such as whether a score equals the target or is greater than it. Decisions and loops in a program rely on these tests: an if statement only chooses a branch once the ALU has compared the values.

For example, a school trip is booking minibuses. Each minibus seats 15 students and 4 minibuses have been reserved, so the ALU multiplies 15 by 4 to get 60, which is stored in the Accumulator. The ALU then compares 60 with the 57 students who returned their permission slips and gives true, because there is room for everyone. The Accumulator holds the answer to a calculation, not the calculation itself.

The ALU does not fetch or decode instructions, and it does not control the flow of data around the CPU; the Control Unit does that. The ALU receives values, performs the operation it has been given and sends the result to the Accumulator.

Practise this