Phase 1: Prepare
Step 1 Warm-up recall
From M7.L2: 3,000 MB equals how many GB (decimal)?
Private: nothing you type here is sent or stored.
Step 2 Learning goal
By the end of this lesson you can:
- describe the fetch, decode, execute cycle (Foundation);
- trace a toy-machine program (Core);
- write a short program for a calculation (Core).
Phase 2: Teach
Step 3 A familiar example
A recipe is followed one line at a time. The cook reads a line, understands it and does it, then reads the next. A processor does exactly this, billions of times a second on modern machines.
Step 4 Clear explanation
A program is a list of instructions stored in memory. The processor repeats a cycle for each one.
To see this at work, use an invented toy machine. It has one working register, the accumulator, and four instructions.
| Instruction (invented toy machine) | Effect |
|---|---|
| LOAD n | Put the number n into the accumulator (the working register) |
| ADD n | Add n to the accumulator |
| SUB n | Subtract n from the accumulator |
| STORE a | Copy the accumulator into memory address a |
Trace the program LOAD 5, ADD 3, STORE 0, LOAD 2, ADD 9.
| Step | Instruction | Accumulator after | Memory after |
|---|---|---|---|
| 1 | LOAD 5 | 5 | empty |
| 2 | ADD 3 | 8 | empty |
| 3 | STORE 0 | 8 | address 0 holds 8 |
| 4 | LOAD 2 | 2 | address 0 holds 8 |
| 5 | ADD 9 | 11 | address 0 holds 8 |
Each row is one pass of the cycle. After step 3 the value 8 has been copied to memory address 0 and stays there; the accumulator is then overwritten. Real processors have many more instructions and registers, and they use binary codes, but they follow the same pattern. This is why a program that is correct in a high-level programming language is translated into many such small steps. The entry on Alan Turing describes the early theory behind this idea of a machine that follows stored instructions.
Step 5 Worked example (4 marks)
Trace LOAD 10, SUB 4, ADD 7, STORE 2 on the toy machine.
- LOAD 10: accumulator is 10. (1 mark)
- SUB 4: accumulator is 6. (1 mark)
- ADD 7: accumulator is 13. (1 mark)
- STORE 2: address 2 holds 13. (1 mark)
Phase 3: Practise
Step 6 Learner practice (instant-marked)
1. The cycle for each instruction is:
The processor repeats it for every instruction.
2. On the toy machine, LOAD 6 then ADD 4 leaves the accumulator at:
6 + 4 = 10.
3. STORE 3 does what?
It writes the accumulator to memory.
4. LOAD 9, SUB 2, STORE 0 leaves address 0 holding:
9 − 2 = 7.
Phase 4: Close
Step 7 Recap
- The processor fetches, decodes and executes in a loop.
- The accumulator holds the working value.
- STORE copies it to memory.
Step 8 Exit ticket (ungraded)
Trace LOAD 3, ADD 4, STORE 1, LOAD 1 and give the accumulator.
Private: nothing you type here is sent or stored.
Step 9 Go further (Extension)
Read the entry on Alan Turing and note what a stored program is.
Common mistakes
| Mistake | Why it fails |
|---|---|
| Forgetting that LOAD replaces the accumulator | LOAD overwrites the old value. |
| Thinking STORE empties the accumulator | It copies; the accumulator is unchanged. |
| Skipping a step in the trace | Write one row per instruction. |
Limits. The toy machine is invented and far simpler than a real processor.