How does it all work?

The CPU operates using the Fetch-Decode-Execute cycle.

Fetch

CPU Animation
  1. The address of the next instruction is copied from the Program Counter (PC) to the Memory Address Register (MAR).
  2. The PC is immediately incremented to point to the address of the following instruction.
  3. The CPU sends a signal along the address bus to the memory location held in the MAR.
  4. The instruction at that address is sent back via the data bus and stored in the Memory Data Register (MDR).
  5. The instruction is copied from the MDR into the Current Instruction Register (CIR).

Decode

The Control Unit (CU) makes sense of the instruction sitting in the CIR.

The instruction is split into two parts:

The CU interprets the opcode and prepares any necessary hardware pathways.

Execute

The instruction is carried out. Depending on the command, this might involve:

Key Components of the CPU

Registers of the CPU

Register Full Name Purpose
PC Program Counter Holds the address of the next instruction to be fetched.
MAR Memory Address Register Holds the address of the current location being accessed in memory.
MDR Memory Data Register Acts as a buffer for data/instructions traveling between memory and the CPU.
CIR Current Instruction Register Holds the instruction currently being decoded and executed.
ACC Accumulator Stores the intermediate results of ALU calculations.

Visual Guide: The Fetch-Execute Cycle