Processor fundamentals
Cambridge AS & A Level Computer Science 9618 · Paper 1 · Unit 4
Paper 1 · Unit 4. CPU architecture, the fetch-execute cycle, assembly language and bit manipulation.
1. Von Neumann architecture
In the Von Neumann model, a single processor executes instructions one at a time, and programs and data are stored together in the same main memory (the stored program concept). Instructions are fetched from memory, decoded and executed in sequence.
2. Registers
Registers are very fast storage locations inside the CPU. General-purpose registers hold data temporarily; special-purpose registers have fixed roles.
| Register | Role |
|---|---|
| PC (Program Counter) | Holds the address of the next instruction |
| MAR (Memory Address Register) | Holds the address being read from or written to |
| MDR (Memory Data Register) | Holds the data or instruction just read, or about to be written |
| CIR (Current Instruction Register) | Holds the instruction being decoded and executed |
| ACC (Accumulator) | Holds the result of calculations |
| IX (Index Register) | Holds a value added to an address in indexed addressing |
| Status Register | Holds flags, e.g. carry, overflow, negative, zero, interrupt |
3. CPU components and buses
| Component | Role |
|---|---|
| ALU | Carries out arithmetic and logic operations |
| Control Unit (CU) | Decodes instructions and sends control signals to coordinate the processor |
| System clock | Generates timing signals that synchronise operations |
| Immediate Access Store (IAS) | Memory the CPU can access directly (RAM) |
| Bus | Direction | Carries |
|---|---|---|
| Address bus | One-way: CPU to memory | The address of the memory location |
| Data bus | Two-way | Data and instructions |
| Control bus | Two-way | Control signals, e.g. read, write, clock, interrupt |
4. Factors affecting performance
| Factor | Effect |
|---|---|
| Processor type and number of cores | More cores can run more instructions in parallel, if the software supports it |
| Bus width | A wider data bus moves more bits at once; a wider address bus can address more memory |
| Clock speed | More cycles per second means more instructions per second (but more heat) |
| Cache memory | Larger cache means frequently used data is found faster, without going to RAM |
5. Ports
Peripherals connect through ports. USB is a universal serial port for many devices and also supplies power. HDMI carries high-definition digital video and audio. VGA is an older analogue video port.
6. The fetch-execute cycle
In register transfer notation, [x] means “the contents of x”:
MAR ← [PC] PC ← [PC] + 1 ; MDR ← undefined CIR ← [MDR] (decode, then execute)
The PC is incremented during the fetch so it always points to the next instruction. Jumps change the PC directly.
Try it: step through the fetch-execute cycle
Memory: address 100 holds LDD 200, address 200 holds 42. Press Next step to fetch and execute the instruction.
7. Interrupts
An interrupt is a signal from hardware or software that needs the processor's attention, e.g. a printer out of paper, a key press, a timer, or a division by zero.
- At the end of each fetch-execute cycle, the processor checks for interrupts.
- If there is one with higher priority than the current task, the current register contents are saved (on the stack).
- The Interrupt Service Routine (ISR) for that interrupt is loaded and run.
- The saved registers are restored and the original task continues.
8. Assembly language
Assembly language uses mnemonics (e.g. LDD, ADD, STO) that map one-to-one onto machine code. An assembler translates it. A two-pass assembler first builds a symbol table of labels and their addresses, then on the second pass replaces labels and mnemonics with machine code.
| Mode | Operand means | Example |
|---|---|---|
| Immediate | The value itself | LDM #5 loads 5 |
| Direct | The address of the value | LDD 200 loads the contents of 200 |
| Indirect | The address holding the address of the value | LDI 200 |
| Indexed | The address plus the IX contents | LDX 200 loads from 200 + [IX] |
| Relative | An offset from the current address | JMP +3 |
Instruction groups: data movement (LDM, LDD, LDI, LDX, LDR, MOV, STO), input/output (IN, OUT), arithmetic (ADD, SUB, INC, DEC), comparisons and jumps (CMP, CMI, JPE, JPN, JMP), and END.
9. Bit manipulation
Logical shift: bits move left or right and 0s fill the gap. Shifting left once multiplies an unsigned value by 2; shifting right divides by 2. Arithmetic shift right keeps the sign bit. Cyclic shift moves bits off one end and back in at the other.
Masks test or change specific bits: AND with a mask clears bits (keep bits where the mask is 1), OR sets bits, and XOR toggles bits. This is used to test flags or monitor device status.
10. Examiner tips
- Use register names correctly: MAR holds an address, MDR holds data.
- The PC is incremented in the fetch stage, before execution.
- Address bus is one-way; data and control buses are two-way.
- Interrupts are checked at the end of each cycle, and registers are saved before the ISR runs.
- In assembly traces, keep track of the ACC after every instruction.
- Immediate vs direct: # means the number itself.
11. Practice questions
Practice: answer and check instantly
Type a short answer, then press Check or Enter.
Show answer
Program Counter.
Show answer
Current Instruction Register.
Show answer
The address bus.
Show answer
Interrupt Service Routine.
Show answer
Immediate addressing.
Show answer
Bits move left; 0 fills the right.
Show answer
OR with 1 sets a bit.
Show answer
A two-pass assembler.
Exam-style questions
9. Describe the fetch stage of the fetch-execute cycle, using register transfer notation. [4]
Show mark guide
MAR ← [PC] [1] · PC ← [PC] + 1 [1] · MDR ← [[MAR]] [1] · CIR ← [MDR] [1].
10. Explain how the processor handles an interrupt. [4]
Show mark guide
Interrupts are checked at the end of each fetch-execute cycle [1] · if the interrupt has higher priority, the current register contents are saved/pushed onto the stack [1] · the appropriate ISR is called and executed [1] · the registers are restored and the previous task resumes [1].
12. Topic test: predict your grade
Topic test: predict your grade
15 questions, about 10 minutes. Answer them all, then press Mark my test.
Frequently asked questions
What are the registers used in the fetch-execute cycle?
The main registers are the PC, MAR, MDR, CIR and ACC. In the fetch stage, MAR takes the PC value, the PC is incremented, the instruction goes to the MDR and then to the CIR.
What is the difference between immediate and direct addressing?
In immediate addressing the operand is the value itself, for example LDM #5. In direct addressing the operand is the address of the value, for example LDD 200.
How are interrupts handled?
At the end of each fetch-execute cycle the processor checks for interrupts. It saves the register contents, runs the interrupt service routine, then restores the registers and continues.