Logic and computer systems · GCSE · OCR J277 1.1.1, AQA 8525 3.4.5, Edexcel 1CP2 3.1.1 · about 20 min
The ALU, control unit, registers and buses, and tracing the fetch-decode-execute cycle.
[1 mark]Which register holds the address of the next instruction to fetch?
[1 mark]What does the ALU do?
[1 mark]Put these steps of the cycle in order.
Number the lines 1 to 4 to put them in the right order.
The instruction is executedThe address in the PC is copied to the MARThe instruction at that address is copied to the MDRThe control unit decodes the instruction[1 mark]Which bus carries addresses from the CPU to memory?
[1 mark]What does the memory data register hold?
[1 mark]What does this program print?
pc = 4 mar = pc pc = pc + 1 print(mar, pc)
Complete the fetch-decode-execute loop so it runs the program in memory and supports LOAD, ADD, SUB, STORE, OUT and HALT. During each fetch, print fetch <MAR>: <instruction> (for example fetch 0: LOAD 6). The program outputs output: 35.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() memory = ["LOAD 6", "SUB 7", "ADD 8", "STORE 9", "OUT 9", "HALT", 40, 12, 7, 0] pc = mar = acc = 0 mdr = None
Plan your program here, then type it in and press Run.
JUMPZ a instruction that jumps to address a if the accumulator is 0. Write a countdown program with it.