PLAY · A-Level · AQA 7517

Run the machine.

Flip bits into two's complement, single-step a processor through fetch–decode–execute, and race linear against binary search while the comparison counters tell the truth.

Eight switches, two meanings

FIG. 01 · 4.5.4 · UNSIGNED & TWO'S COMPLEMENT

0

How the register is read

The eight bits never change. Only the agreement about what the leftmost one is worth does.

Operations

Flip a switch, or negate to watch “invert every bit, then add one” happen for real.

Denary
0
Hex
0x00
Other reading
0 unsigned
Range
0 … 255

What the exam wants. 4.5.4.3 asks you to convert between two's complement and denary both ways, and 4.5.4.9 asks when a result overflows. Every mark scheme accepts the same working you can see here: the leftmost column is worth −128, everything else is positive, and negating means invert-then-add-one. Shifting left is ×2 — until the sign flips, which is exactly the overflow they want you to spot.

One cycle at a time

FIG. 02 · 4.7.3.2 · FETCH–DECODE–EXECUTE
MAIN MEMORY ADDR DATA PROCESSOR PC · PROGRAM COUNTER 0 MAR · ADDRESS 0 MBR · DATA 0 CIR · INSTRUCTION ACC · ACCUMULATOR 0 CONTROL UNIT idle ALU

Reset. The PC points at address 0 — the first instruction.

Drive the cycle

The program is four instructions: load 12, add 30, store the answer, halt. Nothing is hidden — every register write is one step.

Phase
READY
Step
0 / 0
Decoded
Cycles done
0

What the exam wants. 4.7.3.2 is nearly always “describe the fetch–execute cycle, referring to the registers” — and the marks are for the order: MAR ← PC, PC incremented, MBR ← memory, CIR ← MBR, then decode, then execute. Notice the PC increments before the instruction is even understood. Notice too that 0x15 in memory is just a number: it is an instruction only because the processor fetched it. That is the stored program concept (4.7.2.1) in one screen.

O(n) against O(log n)

FIG. 03 · 4.3.4 · 4.4.4 · SEARCH COMPLEXITY

Linear search waiting

Binary search waiting

Pick a target and step. Linear checks the boxes in order; binary throws half of them away each time.

The list is sorted — that is the whole price of admission for binary search.

Run it
Linear comparisons
0
Binary comparisons
0
Worst case, n = 16
O(n) = 16
Worst case, n = 16
O(log n) = 5

What the exam wants. 4.4.4.1–4.4.4.3 ask you to compare algorithms by order of complexity, not by seconds on your laptop. Search a 16-item list and binary wins by about three comparisons; search a million-item list and it wins by 999,980. Two marks usually go for the reason binary needs a sorted list, and one for saying that halving the search space is what makes it logarithmic.

Six real questions

LIVE FROM THE BANK · NO ACCOUNT
Practise A-Level Computer Science → Read the lessons All subject labs