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.

RegisterRole
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 RegisterHolds flags, e.g. carry, overflow, negative, zero, interrupt

3. CPU components and buses

ComponentRole
ALUCarries out arithmetic and logic operations
Control Unit (CU)Decodes instructions and sends control signals to coordinate the processor
System clockGenerates timing signals that synchronise operations
Immediate Access Store (IAS)Memory the CPU can access directly (RAM)
BusDirectionCarries
Address busOne-way: CPU to memoryThe address of the memory location
Data busTwo-wayData and instructions
Control busTwo-wayControl signals, e.g. read, write, clock, interrupt

4. Factors affecting performance

FactorEffect
Processor type and number of coresMore cores can run more instructions in parallel, if the software supports it
Bus widthA wider data bus moves more bits at once; a wider address bus can address more memory
Clock speedMore cycles per second means more instructions per second (but more heat)
Cache memoryLarger 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.

  1. At the end of each fetch-execute cycle, the processor checks for interrupts.
  2. If there is one with higher priority than the current task, the current register contents are saved (on the stack).
  3. The Interrupt Service Routine (ISR) for that interrupt is loaded and run.
  4. 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.

ModeOperand meansExample
ImmediateThe value itselfLDM #5 loads 5
DirectThe address of the valueLDD 200 loads the contents of 200
IndirectThe address holding the address of the valueLDI 200
IndexedThe address plus the IX contentsLDX 200 loads from 200 + [IX]
RelativeAn offset from the current addressJMP +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

  1. Use register names correctly: MAR holds an address, MDR holds data.
  2. The PC is incremented in the fetch stage, before execution.
  3. Address bus is one-way; data and control buses are two-way.
  4. Interrupts are checked at the end of each cycle, and registers are saved before the ISR runs.
  5. In assembly traces, keep track of the ACC after every instruction.
  6. 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.

1. In Von Neumann architecture, programs and data...
2. The MDR holds...
3. The ACC holds...
4. Which unit decodes instructions?
5. The data bus is...
6. A wider address bus...
7. More cache memory usually...
8. Which port carries HD video and audio?
9. In RTN, [PC] means...
10. When are interrupts checked?
11. LDM #12 loads...
12. Indexed addressing adds the operand to...
13. The first pass of a two-pass assembler...
14. A logical right shift of an unsigned number by 1...
15. To clear a bit you AND it with...

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.

Was this page helpful?