CIE AS & A Level Computer Science, section 4.1 (Central Processing Unit (CPU) architecture)
The fetch-execute (F-E) cycle
The processor repeats this cycle for every instruction.
- Fetch: the instruction is copied from memory into the CPU.
- Decode: the control unit works out what the instruction means.
- Execute: the instruction is carried out.
Register transfer notation (RTN)
RTN describes data movement between registers. means "the contents of B are copied into A". Square brackets mean "the contents of": is the value in the PC, and is the value stored in the memory location whose address is in the MAR.
The fetch stage
- The address of the next instruction is copied from the PC to the MAR.
- The PC is incremented so that it points to the next instruction.
- The instruction at that address is copied into the MDR (via the data bus).
- The instruction is copied into the CIR.
Decode and execute
The control unit decodes the instruction in the CIR into an opcode and an operand, then executes it. For a direct load (LDD 200):
A jump instruction sets the PC to the operand, so the next fetch is from a different address.
Check at the end of the cycle
After each execute stage the processor checks for interrupts. If none is pending, the cycle starts again.
Common mistake: forgetting that the PC is incremented during the fetch stage, before the instruction is executed. Also, writing the PC into the MDR: the address goes to the MAR, and the instruction comes back through the MDR.
Exam tip: write the fetch stage in RTN in exactly the right order: MAR from PC, PC incremented, MDR from memory, CIR from MDR. Use brackets for contents of registers.
Check yourself
Write the first step of the fetch stage in register transfer notation.
.
Why is the PC incremented during the fetch stage?
So that it holds the address of the next instruction ready for the following cycle.
Which register holds the instruction while it is decoded?
The current instruction register (CIR).