CPU components, registers and buses
The central processing unit (CPU) runs programs by repeatedly taking an instruction from memory and carrying it out.
It has two working units, a handful of registers and three buses linking it to main memory.
Units and registers
The arithmetic logic unit (ALU) performs arithmetic (add, subtract) and logic operations (AND, OR, comparisons).
The control unit (CU) does no calculation itself.
It decodes instructions and sends timing and control signals that make every other part act at the right moment.
Registers are tiny, very fast storage locations inside the CPU.
The IB names five:
Register
Holds
Program counter (PC)
the address of the next instruction to fetch
Memory address register (MAR)
the address about to be read from or written to
Memory data register (MDR)
the data or instruction just read, or about to be written
Instruction register (IR)
the instruction currently being decoded and executed
Accumulator (AC)
the result of the most recent ALU operation
- ① CU: decodes and directs
- ② ALU: calculates and compares
- ③ PC: next instruction's address
- ④ IR: current instruction
- ⑤ MAR: address being accessed
- ⑥ MDR: data moving to or from memory
- ⑦ AC: latest ALU result
- ⑧ Address bus: CPU to memory
- ⑨ Data bus: both ways
- ⑩ Control bus: read, write and timing signals
Buses
The address bus carries an address from the MAR to memory; it is one-way, CPU to memory.
The data bus carries the data or instruction itself, in both directions, to and from the MDR.
The control bus carries signals such as memory read, memory write and the clock, in both directions.
The width of the address bus limits how many locations can be addressed: address lines give addresses.
Single-core, multi-core and co-processors
A single-core processor has one set of ALU, CU and registers, so it executes one instruction stream at a time.
A multi-core processor puts two or more complete cores on one chip, so several threads genuinely run at the same moment.
A co-processor is an extra specialised processor that takes one kind of work off the CPU, such as a GPU, a floating-point unit or a cryptography engine.
- Register: a very small, very fast storage location inside the CPU used to hold data, addresses or instructions being processed.
- Bus: a set of parallel wires that carries addresses, data or control signals between components.
- Multi-core processor: a single chip containing two or more independent processing cores.
- Co-processor: a supplementary processor that performs specialised tasks to relieve the main CPU.
A value stored at address 200 must be copied into the CPU.
Identify the register and bus used at each stage.
1. The address 200 is placed in the MAR.
2. The MAR sends 200 to memory along the address bus.
3. The CU sends a memory-read signal along the control bus.
4. Memory puts the value on the data bus, and it arrives in the MDR.
Answer: MAR and address bus for the location, control bus for the read signal, data bus and MDR for the value.
A processor has a 32-bit address bus and each address holds one byte.
Calculate the maximum memory it can address.
1. Number of addresses .
2. One byte each gives 4 294 967 296 bytes; dividing by gives 4 GiB.
Answer: 4 GiB (4 294 967 296 bytes).
When you describe a register, give what it holds, not just its name expanded: "the PC holds the address of the next instruction" earns the mark, "the PC counts the program" does not.
In a diagram, show the MAR on the address bus and the MDR on the data bus.
- Saying the PC holds the current instruction. It holds the address of the next one; the IR holds the current instruction.
- Saying the CU performs calculations. Only the ALU calculates; the CU directs.
- Making the address bus two-way. Addresses only travel from the CPU to memory.
Check your understanding
1. State the function of the memory data register. [1]
2. Outline the role of the control unit. [2]
3. Distinguish between a multi-core processor and a co-processor. [2]
4. A processor has a 24-bit address bus with one byte per address. Calculate the number of addressable bytes. [2]