AQA 7517, section 4.7.3.1
The processor (central processing unit, CPU) is the part of the computer that executes instructions. It is made up of several components that work together.
Arithmetic logic unit (ALU)
The ALU carries out arithmetic operations (add, subtract, multiply, divide) and logical operations (AND, OR, NOT, XOR, comparisons, shifts). It takes values from registers, works on them, and puts the result back in a register, and sets flags in the status register to describe the result.
Control unit (CU)
The control unit directs and coordinates everything the processor does.
- It fetches instructions from memory and decodes them.
- It sends control signals to the ALU, registers, memory and I/O to make the instruction happen.
- It manages the timing of the fetch-execute cycle, using the clock.
Clock
The clock produces a regular stream of pulses (ticks). Every step the processor takes is synchronised to these pulses. The clock speed is the number of pulses per second, measured in hertz (Hz), usually gigahertz (GHz). A 3 GHz clock gives 3 billion cycles per second.
Registers
A register is a very small, very fast storage location inside the processor. Each holds one word of data, and is faster than main memory.
General-purpose registers
General-purpose registers can be used by the program for any purpose, such as holding data being worked on, intermediate results or addresses. In assembly language they have names such as R0, R1, R2... The more there are, the less the processor has to go to main memory.
Dedicated (special-purpose) registers
These have one specific job.
| Register | Full name | Role |
|---|---|---|
| PC | Program counter | Holds the address of the next instruction to fetch. It is increased after each fetch |
| CIR | Current instruction register | Holds the instruction currently being decoded and executed |
| MAR | Memory address register | Holds the address of the memory location to be read from or written to |
| MBR | Memory buffer register (also called MDR, memory data register) | Holds the data or instruction just read from, or about to be written to, memory |
| Status register | Holds flags showing the result of the last operation, such as zero, negative, carry and overflow, and processor state |
Some processors also have an accumulator, a register that holds the results from the ALU.
Why registers?
Registers are much faster than main memory, so the processor keeps what it is working on right now in them. The MAR and MBR act as go-betweens for memory: the address goes in the MAR, and the data comes back in the MBR.
How the components work together
- The PC gives the address of the next instruction.
- The address goes into the MAR, and the instruction is read from memory into the MBR, then copied into the CIR.
- The control unit decodes the instruction.
- The ALU carries out any calculation, using the registers.
- The result is stored in a register (or in memory), and the status register is updated.
- The clock keeps all of this in step.
This is the fetch-execute cycle, covered in 4.7.3.2.
Worked example
Task: an instruction ADD R2, R0, R1 is executed. Say what each component does.
- The CIR holds the instruction
ADD R2, R0, R1. - The control unit decodes it and sends signals to read R0 and R1.
- The ALU adds the two values.
- The result goes into R2 (a general-purpose register).
- The status register might be updated if the result is zero, negative or caused overflow.
- The PC has already moved on to the next instruction.
Exam tip: give each component's role precisely: the PC holds the address of the next instruction, the MAR holds an address and the MBR holds data, and the CIR holds the instruction being executed. Mixing these up is a very common error.
Check yourself
What does the program counter hold?
The address of the next instruction to be fetched.
What is the difference between the MAR and the MBR?
The MAR holds the address of the memory location being accessed, and the MBR holds the data (or instruction) that has just been read from, or is about to be written to, that location.
What does the ALU do?
It carries out arithmetic and logical operations.
What is the job of the clock?
It produces regular pulses that synchronise all the steps the processor takes.