CPX8The CPU, Von Neumann and the Fetch-Decode-Execute Cycle
Edexcel 1CP2 · 3.1.1
The von Neumann stored program concept
Almost every computer today follows the von Neumann stored program concept.
Program instructions and the data they use are both stored, as binary, in the same main memory.
The CPU fetches an instruction from memory, decodes it and executes it, one instruction after another (sequentially).
Because a program is just data in memory, a computer can run a different program simply by loading it into memory. Nothing has to be rewired.
Instructions and data travel between the CPU and main memory along the same set of buses.
One main memory holds both instructions and data; the CPU reaches it over three buses.
Exam tipExaminers report that many students can’t name the two things held in main memory under von Neumann. Learn it: data and instructions.
Stored program concept
Program instructions and data are stored together in the same main memory; the CPU fetches, decodes and executes the instructions in sequence.
Edexcel 1CP2 · 3.1.1
Main memory (RAM), volatile and non-volatile
Main memory (RAM) holds the instructions and data of the programs that are running, including the operating system.
Every location in memory has a unique address, so the CPU can say exactly which one to read or write.
The CPU can read and write RAM directly and quickly. Programs are copied into RAM from storage when they are opened.
Volatile storage loses its contents when the power is turned off. RAM is volatile.
Non-volatile storage keeps its contents without power: secondary storage such as a solid-state or magnetic drive, and the chip holding the start-up (boot) instructions.
Why computers need both: RAM is fast enough for the CPU to work from, but it forgets everything at power-off. Non-volatile storage keeps files and programs, holds the instructions needed to start up, and has a much larger capacity.
Exam tipIf a question rules out “it keeps data when the power is off”, give another reason for non-volatile storage: it stores the start-up instructions, or it has a much larger capacity for files and programs.
Main memory (RAM)
Memory that holds the instructions and data currently in use, which the CPU can read and write directly. It is volatile.
Volatile
Loses its contents when the power is switched off.
Non-volatile
Keeps its contents when the power is switched off.
Memory address
A unique number that identifies one location in memory.
Edexcel 1CP2 · 3.1.1
Inside the CPU: control unit, ALU and registers
The central processing unit (CPU) fetches, decodes and executes instructions. It has three kinds of component you need to know.
Control unit (CU): decodes each instruction and sends control signals to the other components to coordinate what they do and when. It controls the flow of data inside the CPU and between the CPU and memory.
Arithmetic logic unit (ALU): carries out arithmetic (adding, subtracting) and logical operations (comparisons such as “is a greater than b?”, and AND, OR, NOT).
Registers: small memory cells within the CPU used for temporary storage of data and interim results. They are the quickest memory to reach because they are inside the CPU.
You don’t need to name or describe any particular register.
Diagrams use symbols: the ALU is a V-notched shape (two inputs, one output) and a register is a box split into cells.
Learn to recognise these two symbols in a diagram.
Exam tipIn labelling questions write “control unit”, not “CPU”: the control unit is one part of the CPU.
Control unit
The part of the CPU that decodes instructions and sends control signals to coordinate the other components.
Arithmetic logic unit (ALU)
The part of the CPU that carries out arithmetic and logical operations.
Register
A small memory cell within the CPU used for temporary storage of data and interim results.
Edexcel 1CP2 · 3.1.1
The clock
The clock synchronises the actions of the CPU. Each tick of the clock triggers an operation, so every component works in step.
In diagrams the clock connects to the control unit, which uses its ticks to time the control signals.
Clock speed is measured in hertz (Hz): ticks per second. 1 GHz = 1000 MHz = 1 000 000 000 Hz (these prefixes are 1000s, not 1024s).
A higher clock speed means more ticks per second, so more instructions can be fetched, decoded and executed each second. Programs run faster, as long as nothing else holds the CPU up.
Worked exampleA processor runs at 2.4 GHz. How many ticks does its clock make each second?
Exam tip“It’s faster” scores nothing on its own. Say what is faster and why: more ticks each second, so more instructions are executed each second.
Clock
Synchronises the actions of the CPU; each tick triggers an operation.
Clock speed
The number of ticks per second, measured in hertz (Hz).
Edexcel 1CP2 · 3.1.1
The address, data and control buses
A bus is a set of parallel wires through which data or signals are transmitted from one component to another.
Address bus: carries the address of the memory location to be read or written. It is unidirectional: from the CPU to memory only, because only the CPU chooses which location to use. Memory never sends an address back.
Data bus: carries data and instructions. It is bidirectional: from memory to the CPU when reading, and from the CPU to memory when writing.
Control bus: carries control signals such as “read”, “write” and clock ticks. It is bidirectional: the CPU sends commands and other components send signals back (for example, that a transfer is complete).
Bus
Carries
Direction
Address
the memory address (location)
one way: CPU → memory
Data
data and instructions
both ways
Control
signals such as read and write
both ways
Exam tipName the bus in full: “address bus”, not “the bus” or “memory bus”. A table question may ask which bus carries a read signal (control), a location (address) or an instruction (data).
Bus
A set of parallel wires through which data or signals are transmitted from one component to another.
Address bus
Carries the address of a memory location from the CPU to memory. Unidirectional.
Data bus
Carries data and instructions between the CPU and memory. Bidirectional.
Control bus
Carries control signals, such as read and write, between components. Bidirectional.
Edexcel 1CP2 · 3.1.1
Bus width and addressable memory
The width of a bus is the number of parallel wires it has. Each wire carries one bit at a time.
An address bus with n wires can carry 2n different addresses, so the CPU can reach 2n memory locations.
Adding one wire doubles the number of locations. A wider address bus means more memory can be addressed (used).
A wider data bus moves more bits in each transfer.
Address bus width
Number of locations
8 wires
28 = 256
16 wires
216 = 65 536
24 wires
224 = 16 777 216
32 wires
232 = 4 294 967 296
Worked exampleA processor’s address bus grows from 16 wires to 17. What happens to the number of memory locations it can address?
216 = 65 536 and 217 = 131 072n wires give 2n addresses
131 072 ÷ 65 536 = 2compare them
It doubles, to 131 072 locations.
Exam tipThe number of locations is 2n, not 2n − 1. The highest address is 2n − 1 because the first address is 0.
Edexcel 1CP2 · 3.1.1
Fetch
The CPU repeats the fetch-decode-execute cycle for every instruction, billions of times a second. Fetch brings the next instruction from main memory into the CPU.
1. The address of the memory location holding the next instruction is placed on the address bus.
2. The control unit sends a read signal on the control bus.
3. Main memory places the instruction stored at that address on the data bus, and it travels to the CPU.
4. The instruction is held in a register, ready to be decoded. The CPU then moves on to the address of the following instruction.
Fetch, decode, execute, repeat.
Exam tipA four-mark “describe the role of the buses in fetching” answer needs all three buses and the control unit: address on the address bus; the control unit sends a read signal on the control bus; the instruction comes back on the data bus.
Edexcel 1CP2 · 3.1.1
Decode and execute
Decode: the control unit decodes the instruction to work out what it has to do and what data it needs.
Execute: the control unit sends control signals to the components that carry it out.
If the instruction needs data from memory, the data is fetched the same way as an instruction: address on the address bus, read signal on the control bus, data back on the data bus.
The ALU carries out any arithmetic or logical operation, such as adding two numbers or comparing them.
Interim results are held in registers. A result may be written back to main memory (see below).
Then the cycle starts again: the next instruction is fetched.
Worked exampleAn instruction says: add 5 to the value held in a register. Describe what happens after it is fetched.
The control unit decodes the instructionto find out it is an addition and what it needs
The control unit sends control signals to the ALUto coordinate the execution
The ALU adds 5 to the value from the registerarithmetic happens in the ALU
The result is stored in a registertemporary storage of interim results
Decode by the control unit; execute by the ALU under the control unit’s signals; result held in a register; then the next fetch.
Exam tipThe ALU doesn’t decode instructions; the control unit does. And the data doesn’t come from “the hard drive”: during the cycle it comes from main memory.
Edexcel 1CP2 · 3.1.1
Reading from and writing to memory
Every transfer between the CPU and main memory uses all three buses.
Reading (fetching an instruction or loading data): the address goes on the address bus; the control unit sends a read signal on the control bus; memory puts the contents on the data bus to the CPU.
Writing (storing a result): the address goes on the address bus; the control unit sends a write signal on the control bus; the CPU puts the data on the data bus to memory, which stores it at that address.
So the data bus carries in both directions, but the address bus always carries from the CPU to memory.
Labelling diagrams: name each part exactly (control unit, ALU, register, clock, address bus, data bus, control bus, main memory). The clock connects to the control unit. Draw only the lines the question asks for.
Step
Read
Write
Address bus
address of the location
address of the location
Control bus
read signal
write signal
Data bus
memory → CPU
CPU → memory
Exam tipExaminers found the clock was the least known label, and many students drew it joined to the buses. It joins the control unit.