{"base":{"id":"cs9-27","subject":"Systems","title":"Fetch, decode, execute","scene":"sys9","steps":[{"mode":"stored","eyebrow":"Stored programs","title":"Instructions in memory","body":"A program's instructions are stored in memory, one after another. The program counter (PC) holds the address of the next instruction. Move the PC along.","controls":[{"id":"pc","label":"Program counter","min":0,"max":4,"step":1,"value":0}]},{"mode":"fde","eyebrow":"One instruction at a time","title":"Fetch, decode, execute","body":"Step through a 5-instruction program that adds 12 and 30. Watch the PC, the current instruction register (CIR) and the accumulator (ACC) at each stage.","actions":[{"id":"step","label":"Move one stage"},{"id":"reset","label":"Start again"}]},{"mode":"cycle2","eyebrow":"Again and again","title":"The cycle never stops","body":"The processor repeats fetch, decode, execute for as long as the computer is on, billions of times a second."},{"mode":"quiz","eyebrow":"Check yourself","title":"Program counter","body":"The PC holds 3. The processor fetches the instruction.","question":"What does the PC hold after the fetch?","options":["3","0","4"],"answer":2,"right":"Correct. During fetch, the PC goes up by 1 so it points to the next instruction.","wrong":"Not quite. What happens to the PC during fetch?","look":"fde"}],"more":[{"type":"cards","id":"ideas","eyebrow":"Popular idea vs science","title":"Common mix-ups","items":[{"tag":"Popular idea","title":"\"The processor reads the whole program at once.\"","body":"It handles one instruction at a time."},{"tag":"Popular idea","title":"\"Data and instructions are stored in separate places.\"","body":"In a stored-program computer both are in the same memory."},{"tag":"Popular idea","title":"\"The PC holds the current instruction.\"","body":"It holds the address of the next instruction; the CIR holds the current one."}]},{"type":"cards","id":"code","eyebrow":"Program","title":"Adding two numbers","items":[{"tag":"Memory","title":"Addresses 0–8","body":"0 LOAD 6     ACC ← memory[6]\n1 ADD 7      ACC ← ACC + memory[7]\n2 STORE 8    memory[8] ← ACC\n3 OUTPUT 8\n4 STOP\n6 12   7 30   8 (result)","code":true}]},{"type":"activities","id":"try","eyebrow":"Try it at home","title":"Human CPU","items":[{"title":"Act out the cycle","time":"20 minutes","need":["Paper cards","3 people"],"steps":["Write the 5 instructions on numbered cards (memory).","One person is the PC (holds a number), one is the CIR, one is the ACC (a whiteboard).","Fetch: PC reads the card, CIR takes it, PC adds 1. Decode: CIR says what it means. Execute: ACC changes.","Repeat until STOP. What is the output?"],"why":"Acting out the cycle shows exactly what each register does.","safety":"No safety risks."}]},{"type":"quiz","id":"quiz","eyebrow":"Quiz","title":"Six more questions","questions":[{"question":"What are the three stages of the cycle?","options":["Input, process, output","Save, load, run","Fetch, decode, execute"],"answer":2,"right":"Correct. The instruction cycle.","wrong":"Not quite. Get it, understand it, do it."},{"question":"Where are instructions stored while a program runs?","options":["The monitor","Memory","The keyboard"],"answer":1,"right":"Correct. Stored-program idea.","wrong":"Not quite. Where is the program?"},{"question":"Which register holds the address of the next instruction?","options":["ACC","CIR","PC"],"answer":2,"right":"Correct. Program counter.","wrong":"Not quite. It counts through the program."},{"question":"What happens during decode?","options":["The instruction is copied from memory","The instruction is worked out","The result is stored"],"answer":1,"right":"Correct. Understanding it.","wrong":"Not quite. Decode = interpret."},{"question":"LOAD 6 then ADD 7, with 12 at address 6 and 30 at 7. ACC = ?","options":["42","13","30"],"answer":0,"right":"Correct. 12 + 30.","wrong":"Not quite. Load, then add."},{"question":"Why can processors do billions of instructions a second?","options":["The cycle repeats with every clock tick","They skip decode","They use many keyboards"],"answer":0,"right":"Correct. GHz clock speeds.","wrong":"Not quite. Think of the clock."}]},{"type":"checklist","id":"check","eyebrow":"Self-check","title":"I can explain…","items":["how instructions are stored in memory","what happens in fetch, decode and execute","what the PC, CIR and ACC do","why the cycle repeats continuously"]},{"type":"keywords","id":"words","eyebrow":"Key words","title":"Words to know","items":[{"word":"fetch","meaning":"Copy the next instruction from memory."},{"word":"decode","meaning":"Work out what the instruction means."},{"word":"execute","meaning":"Carry out the instruction."},{"word":"program counter","meaning":"Holds the address of the next instruction."},{"word":"accumulator","meaning":"Holds the result of calculations."}]},{"type":"sources","id":"sources","title":"Sources","items":["BBC Bitesize KS3 Computer Science","Raspberry Pi Foundation, Computing curriculum resources"]}]},"overlay":null}