KS4J277 1.1.1 32 min read 10 question quiz 18 exam marks

Architecture of the CPU

What the processor is actually for, the job of every component inside it, and the fetch decode execute cycle written the way examiners want to read it.

What the CPU is for

The Central Processing Unit is the part of a computer that carries out instructions. Everything a computer appears to do, loading a page, playing audio, checking a password, is the CPU executing a very long list of extremely simple instructions, very fast.

That last sentence is worth slowing down on. The CPU cannot do anything clever. It can add two numbers, compare two numbers, copy a number from one place to another, and jump to a different instruction. Complex behaviour comes from doing millions of those simple things per second in the right order.

The one sentence definition

The CPU processes data and instructions, and it does this by continuously fetching, decoding and executing instructions stored in memory.

The von Neumann architecture

Almost every computer you use follows the von Neumann architecture. Its defining feature is the stored program concept: instructions and data are held in the same memory, and instructions are fetched from memory one at a time to be executed.

Before this idea, a machine had to be physically rewired to do a different job. The stored program concept is why a single laptop can be a word processor one minute and a games console the next.

Do not say the CPU 'stores' data

The CPU processes data. Storing is what memory and secondary storage do. Registers hold data only for the split second they are being worked on.

A processor, from above and from belowA processor chip lying face up out of its socket, with the heat spreader on top and hundreds of gold contact pads covering the underside.topunderneaththe metal lid is a heat spreaderthe silicon is a few millimetres wide, beneath ithundreds of gold contact padsthey press onto the socket's pinspin 1 marker
The metal lid is a heat spreader, not the processor. The silicon doing the work is a square a few millimetres across underneath it.Drawn illustration

Components of the CPU

You need to know what each part does, and crucially why it exists.

The Arithmetic Logic Unit (ALU)

The ALU carries out all the arithmetic and all the logic operations.

  • Arithmetic means addition, subtraction, and the shifts used for multiplication and division.
  • Logic means comparisons and Boolean operations: AND, OR, NOT, and tests such as is this value greater than that one.

Every calculation in every program you have ever run happened in an ALU.

The Control Unit (CU)

The Control Unit is the manager. It:

  • decodes the instructions fetched from memory,
  • sends control signals to the other components telling them what to do and when,
  • controls the flow of data around the CPU and between the CPU and memory,
  • keeps everything synchronised to the clock.

Cache

Cache is a small amount of very fast memory located inside or extremely close to the CPU. It holds copies of instructions and data that have been used recently or are likely to be needed next.

Why it exists: RAM is slow compared with the CPU. If the CPU had to wait for RAM every single cycle it would sit idle most of the time. Cache is the buffer that keeps the CPU fed.

LevelSizeSpeedPosition
L1Smallest, a few KB to a few hundred KBFastestOn the CPU core itself
L2Larger, hundreds of KB to a few MBSlower than L1On the chip, often per core
L3Largest, several MB or moreSlowest of the three, still far faster than RAMShared between all cores

When the CPU finds what it needs in cache that is a cache hit. When it does not, that is a cache miss and it has to go out to RAM, which is much slower.

Why more cache means better performance

More cache means more instructions and data can be held close to the CPU, so there are fewer slow trips out to RAM, so the CPU spends more time working and less time waiting.

Registers

Registers are tiny, extremely fast storage locations inside the CPU. Each holds a single value. They are the fastest storage in the entire computer, faster even than cache, because they are part of the CPU itself.

RegisterFull nameWhat it holds
PCProgram CounterThe memory address of the next instruction to be fetched
MARMemory Address RegisterThe address currently being read from or written to
MDRMemory Data RegisterThe data or instruction that has just been fetched, or is about to be written
ACCAccumulatorThe result of calculations carried out by the ALU
MAR holds an address, MDR holds data

This is the single most commonly confused pair at GCSE. MAR is the postcode. MDR is the parcel.

Buses

A bus is a set of parallel wires that carries signals between components.

  • Address bus: carries memory addresses from the CPU to memory. It is unidirectional, addresses only travel one way.
  • Data bus: carries the actual data and instructions. It is bidirectional, data travels both ways.
  • Control bus: carries control signals, such as read, write and clock signals.
Components of the CPU and the three busesThe central processing unit contains a control unit which decodes instructions and coordinates the other components, an arithmetic logic unit which performs calculations and comparisons, a set of registers holding the program counter, memory address register, memory data register, current instruction register and accumulator, and cache holding recently used data and instructions. The CPU connects to main memory and to input and output devices through three buses. The address bus carries addresses one way out of the processor, the data bus carries data and instructions in both directions, and the control bus carries control signals in both directions.CENTRAL PROCESSING UNITControl Unitdecodes and coordinatesArithmetic Logic Unitcalculates and comparesREGISTERSPCMARMDRCIRACCCacheMain memoryRAMInput and outputdevicesAddress busone way, out of the CPUData bustwo wayControl bustwo way
The address bus is one way because addresses only ever travel out of the processor. The data bus is two way because data travels in both.
The fetch decode execute cycle inside the processorThe processor on the left, with main memory on the right, joined by three buses. Inside the processor are the program counter, the memory address register, the memory data register, the current instruction register, the control unit and the arithmetic logic unit. The cycle runs like this. The program counter holds the address of the next instruction, here 0x04A. That address is copied into the memory address register and sent to memory along the address bus, which is one way. Memory sends the contents of that address, here the instruction LDA 7, back along the data bus into the memory data register, and it is copied to the current instruction register. The control unit decodes the instruction and works out what has to happen, sending signals along the control bus when memory is involved. The arithmetic logic unit carries it out, and the program counter moves on by one.CENTRAL PROCESSING UNITPCprogram counter0x04AMARmemory address0x04ACIRcurrent instructionLDA 7MDRmemory dataLDA 7CUcontrol unitdecodesALUarithmetic logic unitadds, compares, ANDsaddress busdata buscontrol busMain memory (RAM)0x049ADD 30x04ALDA 70x04BSTA 90x04CJMP 2a real memory module12345
  1. The program counter holds the address of the next instruction.
  2. That address goes to memory along the address bus.
  3. The instruction comes back along the data bus and lands in the MDR.
  4. The control unit decodes it and works out what has to happen.
  5. The ALU executes it, and the program counter moves on by one.
Address out, data back, control alongside. The address bus is one way: memory never sends an address to the CPU.

The fetch decode execute cycle

This is the heartbeat of the computer. It repeats billions of times per second, and it never stops while the machine is on.

Fetch

  1. The address of the next instruction is copied from the Program Counter into the MAR.
  2. The Program Counter is incremented so it points at the following instruction.
  3. The address in the MAR is sent along the address bus to main memory.
  4. The instruction at that address is sent back along the data bus into the MDR.

Decode

  1. The instruction in the MDR is passed to the Control Unit, which works out what the instruction means: what operation is required and what data it needs.

Execute

  1. The instruction is carried out. This might be an ALU calculation with the result placed in the Accumulator, data being written to memory, or a jump that changes the value in the Program Counter.

Then the cycle begins again.

How to earn full marks on a cycle question

Use the register names, and put them in the right order. A four mark answer that says "it fetches the instruction, decodes it, then executes it" will usually get one mark. An answer that names PC, MAR, MDR, the buses and the CU in sequence gets all four.

Speed check

A 3 GHz processor completes this cycle around three billion times each second. In the time it takes you to blink, roughly 300 milliseconds, it has run about 900 million cycles.

The fetch decode execute cycleA seven stage walk through the fetch decode execute cycle. In fetch, the address in the program counter is copied into the memory address register, the program counter is incremented, the address travels out on the address bus to main memory, and the instruction returns on the data bus into the memory data register and then the current instruction register. In decode, the control unit splits that instruction into an opcode saying which operation to perform and an operand giving the data or its address. In execute, the instruction is carried out and any result from the arithmetic logic unit is placed in the accumulator with the status flags updated. Control then returns to fetch and the whole cycle repeats, around three billion times a second on a 3 gigahertz processor.CENTRAL PROCESSING UNITPCMARMDRCIRControl Unit + ALUMAIN MEMORY0x04A ADD 120x04B STA 20address busdata busPC → MARPC = PC + 1address out on the address businstruction back on the data bus → MDR → CIRopcode + operandcarry it out, update the flagsrepeat
Step through the cycle. Naming the registers and buses in this order is what turns a one mark answer into a full mark one.

Key terms you must be able to define

CPU
The component that processes all data and instructions by repeatedly fetching, decoding and executing them.
Von Neumann architecture
A design in which instructions and data are stored in the same memory and instructions are fetched one at a time.
ALU
Arithmetic Logic Unit. Performs all arithmetic calculations and all logical comparisons.
Control Unit
Decodes instructions and sends control signals that coordinate every other component.
Cache
Small, very fast memory inside or near the CPU holding recently or frequently used data and instructions.
Register
A tiny, extremely fast storage location inside the CPU that holds a single value.
Program Counter
The register holding the memory address of the next instruction to be fetched.
MAR
Memory Address Register. Holds the address in memory currently being read from or written to.
MDR
Memory Data Register. Holds the data or instruction that has just been fetched from, or is about to be written to, memory.
Accumulator
The register that stores the result of calculations carried out by the ALU.
Bus
A set of parallel wires carrying signals between components. The three buses are address, data and control.

Flashcards

Say the definition out loud before you flip the card. Retrieving it from memory is what builds recall, reading it again is not.

DefineCPU
AnswerThe component that processes all data and instructions by repeatedly fetching, decoding and executing them.
DefineVon Neumann architecture
AnswerA design in which instructions and data are stored in the same memory and instructions are fetched one at a time.
DefineALU
AnswerArithmetic Logic Unit. Performs all arithmetic calculations and all logical comparisons.
DefineControl Unit
AnswerDecodes instructions and sends control signals that coordinate every other component.
DefineCache
AnswerSmall, very fast memory inside or near the CPU holding recently or frequently used data and instructions.
DefineRegister
AnswerA tiny, extremely fast storage location inside the CPU that holds a single value.
DefineProgram Counter
AnswerThe register holding the memory address of the next instruction to be fetched.
DefineMAR
AnswerMemory Address Register. Holds the address in memory currently being read from or written to.

Reach the top grade on this topic

Grade 9 answers on this topic do three things that grade 5 answers do not.

They use register names as verbs, not decoration. Weak answer: "the CPU gets the instruction from memory". Strong answer: "the address held in the Program Counter is copied to the MAR, and the instruction at that address is returned along the data bus into the MDR".

They explain the reason, not just the fact. If a question asks why cache improves performance, the fact is "cache is faster than RAM". The reason is "so the CPU spends fewer cycles waiting for data, which means more instructions completed per second".

They link components together. Top answers show that the components form a system: the CU sends the signal, the ALU does the work, the accumulator holds the result, the PC decides what happens next.

  • Be able to write the full fetch decode execute cycle from memory in six numbered steps
  • Be able to state what each register holds in one sentence, without hesitating between MAR and MDR
  • Be able to explain a cache hit and a cache miss and why the difference matters
  • Be able to say why the address bus is unidirectional but the data bus is bidirectional

Mistakes that cost marks here

Avoid these
  • Saying the CPU stores data permanently. It does not. Registers hold values only while they are being processed.
  • Swapping MAR and MDR. The Address Register holds an address, the Data Register holds data.
  • Forgetting that the Program Counter is incremented during the fetch stage, not at the end of the cycle.
  • Writing that cache 'makes the CPU faster'. Cache does not change the clock speed. It reduces the time the CPU spends waiting, so more work is completed per second.
  • Describing the ALU as doing 'everything'. The ALU does arithmetic and logic. Decoding and coordination are the Control Unit's job.
Fun fact

The 'von Neumann' architecture is named after John von Neumann, but the report that described it in 1945 was a draft with only his name on the cover. The ideas came from a whole team at the University of Pennsylvania, and the argument over credit has never fully died down.

Knowledge check

0 of 10 answered
1Which register holds the address of the next instruction to be fetched?
2What is the defining feature of the von Neumann architecture?
3Which component decodes instructions and sends control signals to the rest of the CPU?
4A cache miss occurs when:
5Which bus is unidirectional?
6Where is the result of an ALU calculation placed?
7During the fetch stage, when is the Program Counter incremented?
8Which of these best explains why L1 cache is smaller than L3 cache?
9What does the MDR hold immediately after the fetch stage?
10A computer executes a jump instruction. Which register is directly changed as a result?
Score 0 / 10

Exam-style questions

Five written questions in the style of the real paper. Write a full answer, then let the marker check it against the mark scheme.

18 marks
1Describe the purpose of the Arithmetic Logic Unit within the CPU.2 marks
Describe

Mark scheme0 / 2
  • LPerforms arithmetic operations such as addition and subtraction
  • LPerforms logical operations and comparisons such as AND, OR, NOT or greater than
Model answer

The ALU carries out all arithmetic operations, such as addition and subtraction, and all logical operations, such as comparing two values or applying AND, OR and NOT. Results produced by the ALU are placed in the accumulator.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
2Describe the stages of the fetch decode execute cycle. Refer to the registers involved in your answer.6 marks
Describe

Mark scheme0 / 6
  • LThe address of the next instruction is copied from the Program Counter into the MAR
  • LThe Program Counter is incremented
  • LThe address is sent to memory along the address bus
  • LThe instruction is returned along the data bus into the MDR
  • LThe Control Unit decodes the instruction to determine what operation is required
  • LThe instruction is executed, for example the ALU performs a calculation and stores the result in the accumulator
Model answer

The address of the next instruction is copied from the Program Counter into the Memory Address Register, and the Program Counter is then incremented so that it points at the following instruction. The address in the MAR is sent to main memory along the address bus, and the instruction stored there is returned along the data bus into the Memory Data Register. The Control Unit then decodes that instruction to determine which operation is required and which data it needs. Finally the instruction is executed: if it is a calculation the ALU performs it and the result is placed in the accumulator, and the cycle then repeats.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
3Explain how increasing the amount of cache memory in a computer can improve its performance.4 marks
Explain

Mark scheme0 / 4
  • LCache is much faster to access than RAM
  • LMore cache means more frequently used instructions and data can be stored close to the CPU
  • LThis increases the cache hit rate, so fewer requests have to go out to RAM
  • LThe CPU therefore spends less time waiting and can execute more instructions per second
Model answer

Cache is a small amount of memory that is much faster to access than RAM because it sits inside or very close to the CPU. Increasing the amount of cache means more of the instructions and data the CPU uses frequently can be held there, which raises the proportion of requests that are cache hits. Because fewer requests have to travel out to the slower RAM, the CPU spends less time idle waiting for data, so it completes more instructions per second and the computer performs better.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
4Explain the difference between the Memory Address Register and the Memory Data Register.3 marks
Explain

Mark scheme0 / 3
  • LThe MAR holds a memory address
  • LThe MDR holds the actual data or instruction
  • LThe MAR identifies where in memory to read from or write to, and the MDR carries what is read or written
Model answer

The Memory Address Register holds the address of the memory location that is currently being read from or written to, so it identifies where in memory the CPU is working. The Memory Data Register holds the actual data or instruction that has just been fetched from that location, or that is about to be written to it. In short, the MAR says where and the MDR says what.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
5A student says: 'The CPU stores all of a computer's data.' Explain why this statement is incorrect.3 marks
Explain

Mark scheme0 / 3
  • LThe CPU processes data rather than storing it long term
  • LRegisters and cache inside the CPU hold data only temporarily while it is being worked on
  • LData is stored in RAM while in use and in secondary storage such as an SSD or hard disk when not in use
Model answer

The statement is incorrect because the role of the CPU is to process data and instructions, not to store them. The registers and cache inside the CPU do hold values, but only temporarily while those values are actively being fetched, decoded or executed, and their contents are lost when power is removed. Data that is currently in use is stored in RAM, and data that must be kept when the computer is switched off is stored in secondary storage such as an SSD or a hard disk drive.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
Machine mark 0 / 18