1.1.1 Architecture of the CPU · Paper 1
The CPU: how a computer runs instructions
Each section has pictures and things to try, then its key points and key words. Exam practice is at the end of the page.
You need to know
- What the CPU is for, and what happens at each stage of the fetch-execute cycle
- What the ALU, control unit, cache and registers do
- Von Neumann architecture, and the four registers: MAR, MDR, program counter and accumulator
- Whether each register holds data or an address
You don't need to know
- Exactly how data passes between registers at each stage of the cycle
What the CPU does
The CPU (central processing unit) processes data and instructions. It runs every program on the computer.
It does this by repeating the fetch-execute cycle billions of times a second.
Key points
What the CPU does
- The CPU (central processing unit) is the part of the computer that processes data and instructions.
- Every program you run is a list of instructions. The CPU carries them out one after another.
- It does this by repeating the fetch-execute cycle: fetch an instruction from memory, decode it, then execute it.
- Modern CPUs repeat this cycle billions of times every second.
Key words
Say what each one means, then tap to check.
Inside the CPU
Try it
Which part of the CPU does each job?
- Works out what an instruction means
- Checks if one number is bigger than another
- Keeps a copy of instructions the CPU uses a lot
- Holds the address of the next instruction
- Sends signals to tell the other parts what to do
- Adds 5 and 7
- Holds the answer to a sum, straight after the ALU works it out
Key points
Von Neumann architecture
Before this: What the CPU does
- Von Neumann architecture is a design for a computer where programs and data are stored together in the same memory.
- The CPU fetches instructions and data from memory, one at a time.
- It includes a control unit, an ALU, registers (including the PC, MAR, MDR and accumulator) and memory.
- Almost all everyday computers use this design.
The ALU and control unit
Before this: Von Neumann architecture
- The ALU (arithmetic logic unit) does calculations (+, −, ×, ÷) and logic operations (AND, OR, NOT, comparisons such as > and =).
- The CU (control unit) is in charge. It decodes instructions and sends control signals to the other parts of the computer.
- The CU manages the fetch-execute cycle and controls the flow of data inside the CPU.
- Results from the ALU are usually stored in the accumulator.
Cache
Before this: Von Neumann architecture
- Cache is a small amount of very fast memory inside or very close to the CPU.
- It stores copies of frequently used data and instructions, so the CPU doesn't have to wait for slower RAM.
- Cache is faster than RAM but much smaller and more expensive.
- A bigger cache usually means better performance, because more data can be kept close to the CPU.
- Cache is often split into levels (L1, L2, L3). L1 is the smallest and fastest.
Key words
Say what each one means, then tap to check.
The registers
Registers are tiny, super-fast stores inside the CPU. Each one holds one thing.
| Register | What it holds | Data or address? |
|---|---|---|
| Program counter (PC) | The address of the next instruction | Address |
| Memory address register (MAR) | The address about to be read from or written to | Address |
| Memory data register (MDR) | The data or instruction just fetched, or about to be stored | Data |
| Accumulator (ACC) | Results of calculations from the ALU | Data |
Tip: An address is where something is in memory. Data is what is stored there.
Try it
Does each register hold an address or data?
- Program counter (PC)
- Accumulator (ACC)
- Memory address register (MAR)
- Memory data register (MDR)
Key points
Registers (MAR, MDR, PC, accumulator)
Before this: Von Neumann architecture
- Registers are tiny, extremely fast storage locations inside the CPU. Each one holds a single value.
- Program counter (PC): holds the address of the next instruction.
- Memory address register (MAR): holds the address being read from or written to.
- Memory data register (MDR): holds the data or instruction just fetched, or about to be written.
- Accumulator (ACC): holds results of calculations from the ALU.
- PC and MAR hold addresses. MDR and ACC hold data.
Key words
Say what each one means, then tap to check.
The fetch-execute cycle
- Address in the PC is copied to the MAR
- Instruction at that address is copied into the MDR
- PC goes up by 1
- The control unit works out what the instruction means
- The instruction is carried out, e.g. the ALU does a sum and stores it in the accumulator
Try it
Step through one cycle and watch the registers change.
- The program counter (PC) holds the address of the next instruction: 0.
- Fetch: the address in the PC is copied into the MAR.
- Fetch: the instruction at that address, ADD 7, is copied from RAM into the MDR.
- Fetch: the PC goes up by 1, ready for the next instruction.
- Decode: the control unit works out what ADD 7 means.
- Execute: the ALU adds 7 to the 5 in the accumulator, giving 12. Then the cycle starts again.
Try it
Now put the steps of the cycle in order. Try it with the diagram covered.
- The address in the PC is copied to the MAR
- The instruction at that address is copied into the MDR
- The PC goes up by 1
- The control unit decodes the instruction
- The instruction is executed
Key points
The fetch-execute cycle
Before this: Registers (MAR, MDR, PC, accumulator)The ALU and control unit
- Fetch: the address in the PC is copied to the MAR. The instruction at that address is copied from memory into the MDR. The PC goes up by 1.
- Decode: the control unit works out what the instruction means.
- Execute: the instruction is carried out, for example the ALU does a calculation and the result goes into the accumulator.
- The cycle then repeats for the next instruction.
Key words
Say what each one means, then tap to check.
Exam practice
19 questions in the style of the OCR exam, 38 marks in total. Try each one, then check the mark scheme.
What the CPU does
Hint
What does the CPU do with a program's instructions and data?
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- To process data and instructions.
Also accept: To run programs / carry out (execute) instructions.
Also accept: To carry out the fetch-execute cycle.
Don't accept: "To control the computer" on its own.
Don't accept: "To store data". That is the job of memory.
Hint
Its name comes from what happens to each instruction: it is got from memory, then carried out.
Name means a word or a short phrase is enough.
1 mark: one answer is enough.
Show mark scheme
- The fetch-execute cycle.
Also accept: Fetch-decode-execute cycle.
Inside the CPU
Hint
Think about where the program and the data are kept while the program runs.
Describe means say what it is like or what happens. Make each point a separate fact.
2 marks: make 2 separate points.
Show mark scheme
- Instructions (programs) and data…
- …are stored together in the same memory.
Also accept: The stored program concept: the program is held in memory along with the data.
1 mark for instructions and data, 1 mark for being stored in the same memory.
Hint
Look back at the registers table. Two of them hold addresses and two hold data.
Name means a word or a short phrase is enough.
4 marks: make 4 separate points.
Show mark scheme
- Program counter (PC).
- Memory address register (MAR).
- Memory data register (MDR).
- Accumulator (ACC).
Don't accept: ALU, control unit or cache. These are parts of the CPU, but not registers.
1 mark for each register. Short names (PC, MAR, MDR, ACC) are fine.
Hint
The letters in ALU give you both marks: A for arithmetic, L for logic.
Describe means say what it is like or what happens. Make each point a separate fact.
2 marks: make 2 separate points.
Show mark scheme
- Carries out arithmetic / calculations, e.g. addition.
- Carries out logic operations / comparisons, e.g. AND, greater than.
Also accept: Carries out binary shifts.
1 mark for arithmetic, 1 mark for logic.
Hint
The control unit is the part in charge. What does it do in the decode stage, and how does it tell other parts what to do?
State means give a short, clear answer. You don't need to explain it.
2 marks: make 2 separate points.
Show mark scheme
- Decodes instructions.
- Sends control signals.
- Manages the fetch-execute cycle.
- Controls the flow of data in the CPU.
1 mark each, max 2
Hint
Compare how fast cache is with RAM, and think about what it keeps a copy of.
Explain means say what happens and why. Words like “because” and “so” help.
2 marks: aim for 2 things said, such as a point and then the reason for it.
Show mark scheme
- Cache is faster to access than RAM.
- It stores frequently used data / instructions so the CPU waits less.
Don't accept: "Cache stores all the data". It only keeps copies of data and instructions that are used often.
1 mark for each point.
Hint
Think about speed, size, cost and where each one is.
Give means give a short, clear answer. You don't need to explain it.
2 marks: make 2 separate points.
Show mark scheme
- Cache is faster.
- Cache is smaller.
- Cache is more expensive per byte.
- Cache is on / closer to the CPU.
Don't accept: "Cache is faster" and "RAM is slower" together. That is the same point twice, so 1 mark.
1 mark each, max 2
The registers
Hint
This register works closely with the ALU and keeps its results.
Identify means pick out or name the right thing. A short answer is enough.
1 mark: one answer is enough.
Show mark scheme
- Accumulator.
Hint
The middle letter of each name gives it away.
State means give a short, clear answer. You don't need to explain it.
2 marks: make 2 separate points.
Show mark scheme
- a) Address.
- b) Data.
1 mark for each.
Hint
Say what the PC holds, then what happens to it every time an instruction is fetched.
Describe means say what it is like or what happens. Make each point a separate fact.
2 marks: make 2 separate points.
Show mark scheme
- Holds the address of the next instruction to be fetched.
- Is incremented after each fetch.
Also accept: It points to the next instruction.
Don't accept: "It holds the next instruction". It holds the instruction's address, not the instruction itself.
1 mark for each point.
The fetch-execute cycle
Hint
The cycle's full name lists all three stages.
Name means a word or a short phrase is enough.
3 marks: make 3 separate points.
Show mark scheme
- Fetch.
- Decode.
- Execute.
1 mark for each stage, in the right order.
Hint
Once an instruction has been fetched, where will the address of the next one come from?
Explain means say what happens and why. Words like “because” and “so” help.
2 marks: aim for 2 things said, such as a point and then the reason for it.
Show mark scheme
- So it holds the address of the next instruction…
- …ready for the next cycle.
Don't accept: "So it holds the next instruction". It holds the next instruction's address.
1 mark for each point.
Hint
Which part of the CPU is in charge of the cycle?
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- Control unit.
Don't accept: ALU.
Mixed questions on the whole page
- State the address that will be copied into the MAR.
- State the value in the PC at the end of the fetch stage.
Hint
The PC holds the address of the next instruction. What happens to the PC at the end of the fetch stage?
State means give a short, clear answer. You don't need to explain it.
2 marks: make 2 separate points.
Show mark scheme
- a) 4
- b) 5
1 mark for each.
Hint
This register keeps track of where the program has got to.
Identify means pick out or name the right thing. A short answer is enough.
1 mark: one answer is enough.
Show mark scheme
- Program counter (PC).
Don't accept: MAR. It holds the address being used right now, not the next one.
Hint
There are three steps: one about the PC and the MAR, one about the MDR, and one about the PC again.
Describe means say what it is like or what happens. Make each point a separate fact.
3 marks: make 3 separate points.
Show mark scheme
- The address in the program counter is copied to the MAR.
- The instruction at that address is fetched from memory and stored in the MDR.
- The program counter is incremented (by 1).
Also accept: The address is sent along the address bus and the instruction comes back along the data bus.
Don't accept: Anything about decoding or executing. Those happen after the fetch stage.
1 mark for each point.
Hint
One of them holds where in memory, the other holds what is there.
Explain means say what happens and why. Words like “because” and “so” help.
2 marks: aim for 2 things said, such as a point and then the reason for it.
Show mark scheme
- The MAR holds the address of the memory location being read from or written to.
- The MDR holds the data or instruction that has been fetched from, or is about to be written to, memory.
Don't accept: Swapping them round. The MAR holds addresses and the MDR holds data or instructions.
1 mark for the MAR, 1 mark for the MDR.
Hint
Which part decodes the instruction? Then which part does the work, and where does the result go?
Describe means say what it is like or what happens. Make each point a separate fact.
3 marks: make 3 separate points.
Show mark scheme
- Decode: the control unit works out what the instruction means / decodes it.
- The control unit sends control signals to other parts of the CPU.
- Execute: the instruction is carried out.
- e.g. the ALU does a calculation or comparison.
- The result is stored in the accumulator / data is read from or written to memory.
Also accept: The control unit splits the instruction into an opcode and an operand.
Don't accept: "The instruction is fetched from memory". That is the fetch stage, not decode or execute.
Don't accept: "The CPU does the instruction" with no detail. Say what carries it out, e.g. the ALU does a calculation.
1 mark for each point, up to 3. For full marks, say something about both stages.