CECS EduKate Try the questions

OCR A Level Computer Science · H446 · 1.1.1(b)

The fetch–decode–execute cycle

The program counter holds 24. Which register gets 24 next? Follow one instruction from memory to its result in the accumulator.

Watch the EduKate video lesson on YouTube (6 min 52 sec)
The video starts at address 40. Try a fresh example at address 24 below.

Memory before the instruction runs
AddressContents
24ADD 60
25STORE 61
607

Initially, the program counter holds 24 and the accumulator holds 5.

Trace one instruction

The CPU fetches an instruction from memory, decodes what it means and executes it. In this example, each instruction occupies one memory location and an operand such as 60 refers to a memory address.

  1. Fetch

    The processor copies 24 from the program counter (PC) to the memory address register (MAR). Memory returns the instruction ADD 60 to the memory data register (MDR). The instruction is copied to the current instruction register (CIR). During fetch, the PC advances to 25.

  2. Decode

    The control unit interprets the instruction in the CIR. ADD specifies the operation. The operand 60 tells the processor where to find the value to add to the accumulator.

  3. Execute

    The processor places address 60 in the MAR. Memory returns the value 7 to the MDR. The arithmetic logic unit (ALU) adds 7 to the accumulator’s current value of 5. The result, 12, is stored in the accumulator (ACC).

After this cycle the accumulator holds 12. The PC holds 25, ready for the next fetch. The instruction at address 25 will run in the following cycle.

Check your understanding

Answer each question aloud or on paper. Select the question to reveal its model answer.

1. The program counter holds 24. Which register receives 24 at the start of fetch, and why?

Model answer. The memory address register (MAR) receives 24. It holds the address of the memory location the processor needs to read to fetch the instruction.

2. Memory returns ADD 60. Which two registers hold the instruction in turn before decoding?

Model answer. The instruction arrives in the memory data register (MDR). A copy goes into the current instruction register (CIR), where the control unit decodes it.

3. Suppose address 60 held 9 instead of 7. After this ADD, what would the ACC and PC hold?

Model answer. The ACC would hold 14, because 5 + 9 = 14. The PC would still hold 25. It advanced during fetch, and the addition does not change the next instruction address.

OCR A Level Computer Science qualification and specification

EduKate the robot asks what happens next when the program counter holds 24.

Keep revising with Kate Cass

Watch a full Computer Science lesson on YouTube or try an EduKate revision song on TikTok.