What is the CPU?

  • The CPU is responsible for processing all data within the computer

  • It is made up of a number of components including:

    • Arithmetic and Logic Unit (ALU)
    • Control Unit (CU)
    • Registers
  • Registers are high-speed temporary storage/memory locations inside the CPU

  • They have a faster access speed than RAM / secondary storage due to their locality to the CPU

  • There are a number of special-purpose registers in the CPU:

    • Program Counter (PC)
    • Accumulator (ACC)
    • Memory Address Register (MAR)
    • Memory Data Register (MDR)
    • Current Instruction Register (CIR)
  • There are also general-purpose registers (e.g. AX,BX,CX in Intel architectures), which can hold almost any data a programme needs at runtime

Diagram of a computer system showing RAM, CPU with general-purpose registers, ALU, control unit, and buses: data, address, and control. Diagram of components within the CPU

ComponentFunction
Arithmetic and Logic Unit (ALU)This performs any arithmetic calculations (e.g. adding binary) or any logic comparisons (using AND, OR, NOT)
The ALU is made up of several components
Control UnitThis is where instructions are decoded. The CU also controls the data within the CPU and how it moves around
Program Counter (PC)This stores the address in memory of the next instruction to be fetched
Accumulator (ACC)Where intermediary ALU results are stored, i.e. results of ALU calculations
Memory Address Register (MAR)Holds the address of the memory location from/to which data is to be read/written
Memory Data Register (MDR)Holds the data/in to be written to or read from memory
Current Instruction Register (CIR)Briefly holds the fetched instruction while it is separated into its opcode and operand, ready for the control unit to decode and execute
  • The ALU is made up of several components:
    • Arithmetic circuit
      • This carries out any arithmetic operations (addition, subtraction, multiplication or division)
    • Logic circuit
      • This carries out logic operations like AND, OR, NOT, XOR
    • Registers
      • These are additional registers to those mentioned above and can store data (for example, holding operands, carrying out shifts, or storing flags)
    • Status flags
      • This includes overflow flags (if the value is too large for the register) or could include a zero flag (to tell if the answer is 0 easily)
    • Buses
      • These are pathways used to transport data around the ALU and to other parts of the CPU

Buses

  • There are three main buses that connect the CPU, main memory (RAM) and other components:
    • Data bus
    • Address bus
    • Control bus
BusPurposeDirection
Data busTransfers data and instructions between the CPU, memory and input/output devicesRead/Write (Bidirectional)
Address busTransfers the memory address of where data or instructions are to be read from or written toWrite only (Unidirectional) CPU → Memory/I/O
Control busTransfers control signals used to manage the operations of the computer system (e.g. memory read, memory write, interrupt requests)Sends signals (Bidirectional)
  • There are also internal buses within the CPU that transfer data between components such as registers, the ALU, and the cache.