Computer Science • Processor Architecture

Run the CPU

Standard

  • You are the control unit: drag each value where it needs to go (or tap it, then tap its destination) to run programs through the fetch–decode–execute cycle.
  • Fetch: PC → MAR, memory → MDR, MDR → CIR, and +1 on the PC. Then DECODE and carry the instruction out.
  • Right steps score; wrong ones cost clock ticks, and the clock speeds up with every program.
  • The Explanation has the registers, the cycle and the instruction set.

Instruction set

Each 8-bit instruction is a 4-bit opcode followed by a 4-bit operand: a memory address (0–15) or a register number (0–7).

Run the CPU — Explanation

You are the control unit. Every value a program uses has to be moved by you: from the program counter to the memory address register, out of memory, into the current instruction register and on to the ALU. Run each program through the fetch–decode–execute cycle before the clock runs out.

Playing

The stored program concept

In a Von Neumann computer, instructions and data are stored together in the same main memory, both as binary. The processor can't tell them apart by looking: a byte is an instruction only because the program counter pointed at it and it was fetched into the CIR.

Instructions are fetched from memory one at a time and executed in sequence, unless an instruction (such as a jump) changes the program counter. Because instructions and data share one memory and one system bus, only one can be moved at a time: the Von Neumann bottleneck.

Inside the CPU

PC
Program counter: the address of the next instruction to fetch.
MAR
Memory address register: the address about to be read from or written to. It drives the address bus.
MDR
Memory data register: the data just read from memory, or about to be written. It sits on the data bus.
CIR
Current instruction register: the instruction being decoded and executed, split into opcode and operand.
ACC
Accumulator: holds the result of each calculation the ALU does.
SR
Status register: flags set by the ALU: Z (zero), N (negative), C (carry) and V (overflow).
R0–R7
General-purpose registers: fast storage for values a program is working with, so it doesn't have to go back to memory.
ALU
Arithmetic logic unit: does the calculations and comparisons. Here, input A always takes the ACC.
CU
Control unit: decodes each instruction and sends control signals to carry it out. In this game, that's you.

The system bus joins the CPU to memory, in three parts. The address bus carries addresses one way, from the MAR to memory. The data bus carries data both ways between the MDR and memory. The control bus carries signals such as memory read and write. The clock keeps every step in time.

The fetch–decode–execute cycle

In register transfer notation, ← means "is copied into", [X] means "the contents of X", and [[MAR]] means "the contents of the memory location whose address is in the MAR".

  1. MAR ← [PC]the address of the next instruction is copied to the MAR
  2. PC ← [PC] + 1the PC is incremented, ready for the next cycle
  3. MDR ← [[MAR]]the instruction at that address travels over the data bus to the MDR
  4. CIR ← [MDR]the instruction is copied to the CIR
  5. Decodethe control unit splits the CIR into opcode and operand and works out what to do
  6. Executethe steps for that instruction, which might use the MAR and MDR again, the ALU, or the PC

Steps 1 and 2 can happen at the same time in a real CPU. Here you can press +1 any time after step 1, as long as it happens once before the cycle ends.

Instruction set

Each 8-bit instruction is a 4-bit opcode followed by a 4-bit operand: a memory address (0–15) or a register number (0–7).

Objective: describe the role of each register in a Von Neumann processor and carry out the fetch–decode–execute cycle, writing each step in register transfer notation; explain the stored program concept and how the address, data and control buses are used.

Where this fits

  • AQA: AQA A Level Computer Science (7517)
  • Cambridge: Cambridge IGCSE Computer Science (0478); Cambridge A Level Computer Science (9618); Cambridge AS Level Computer Science (9618) Goes beyond Cambridge IGCSE Computer Science (0478): Register transfer notation goes beyond 0478's FDE cycle.
  • IB: IB Computer Science HL; IB Computer Science SL
  • Pearson Edexcel International: Edexcel International GCSE Computer Science (4CP0)
  • USDP: USDP Computer Science

Run the CPU — Key Terms

Key concepts in English, with te reo Māori, Chinese (Simplified) and Korean.

EnglishTe reo Māori中文(简体)한국어What it means on this page
Stored program conceptno attested term存储程序概念저장 프로그램 개념Instructions and data are held together, as binary, in the same main memory, and instructions are fetched from it one at a time.
Processor (CPU)pūtukatuka matua中央处理器중앙 처리 장치The part of the computer that fetches, decodes and executes instructions — the orange block in the diagram.
Memorypūmahara内存메모리Main memory (RAM): 16 addresses here, each holding one 8-bit instruction or data value.
Programpapatono程序프로그램The sequence of instructions loaded into memory from address 0.
Instructiontohutohu指令명령어One 8-bit word: a 4-bit opcode followed by a 4-bit operand.
Opcodeno attested term操作码연산 코드The first four bits of an instruction — which operation to carry out.
Operandno attested term操作数피연산자The last four bits of an instruction — the address or register the operation uses.
Registerno attested term寄存器레지스터A very small, very fast store inside the CPU, holding one value.
Program counter (PC)no attested term程序计数器프로그램 카운터Holds the address of the next instruction to fetch. Incremented once every cycle.
Memory address register (MAR)no attested term存储器地址寄存器메모리 주소 레지스터Holds the address about to be read from or written to, and puts it on the address bus.
Memory data register (MDR)no attested term存储器数据寄存器메모리 데이터 레지스터Holds the data just read from memory, or about to be written to it.
Current instruction register (CIR)no attested term当前指令寄存器현재 명령어 레지스터Holds the instruction being decoded and executed.
Accumulator (ACC)no attested term累加器누산기Holds the result of each ALU calculation.
Arithmetic logic unit (ALU)no attested term算术逻辑单元산술 논리 장치Carries out calculations (here, ADD and SUB) and sets the status flags.
Control unit (CU)no attested term控制单元제어 장치Decodes instructions and co-ordinates every transfer between registers — your job in this game.
Flagkara标志位플래그One bit of the status register, set by the ALU: Z zero, N negative, C carry, V overflow.
Address (memory address)wāhitau pūmahara地址주소The number of a location in memory — 0000 to 1111 here.
Buspahi总线버스A set of parallel wires carrying addresses, data or control signals between parts of the computer.
Clockkaraka时钟클럭Sends regular pulses that keep every step in time. Each pulse here is one tick.
Clock speedterenga karaka时钟速度클럭 속도How many ticks the clock makes each second, in hertz (Hz). It rises as you finish programs.
Fetchtiki取指인출Copying the next instruction from memory into the CIR.
Decodewetewaehere译码해독Splitting the instruction in the CIR into opcode and operand and working out what it means.
Executekawe执行실행Carrying out the decoded instruction.
Register transfer notationno attested term寄存器传送表示法레지스터 전송 표기법A shorthand for each step: MAR ← [PC] means "copy the contents of the PC into the MAR".
Binarytāhūrua二进制이진법Base 2. Every register and memory location holds its value in binary.

On the te reo Māori column. Terms marked as gaps have no attested equivalent in the sources checked — Karaitiana Taiuru's Dictionary of Māori Computer and Social Media Terms, Paekupu, the Reserve Bank's te reo financial glossary, NZQA and Te Aka. No coinage is printed as though it were established; where a class needs one, commission it from Te Taura Whiri i te Reo Māori and credit the translator. Te reo Māori is not italicised and takes no plural "s".