CIE AS & A Level Computer Science, section 4.1 (Central Processing Unit (CPU) architecture)
What a register is
A register is a small, very fast storage location inside the CPU. It holds a value the processor is currently working on, such as an address, an instruction or the result of a calculation.
- General-purpose registers can be used by the programmer to hold any data during processing.
- Special-purpose registers have a fixed role in the CPU, and are used by the processor for specific tasks.
Special-purpose registers
| Register | Role |
|---|---|
| Program Counter (PC) | holds the address of the next instruction to be fetched |
| Memory Address Register (MAR) | holds the address of the memory location being read from or written to |
| Memory Data Register (MDR) | holds the data that has just been read from memory, or is about to be written |
| Current Instruction Register (CIR) | holds the instruction currently being decoded and executed |
| Accumulator (ACC) | holds the result of calculations by the ALU (and is the register used by the CIE instruction set) |
| Index Register (IX) | holds a value that is added to an address, used in indexed addressing to step through arrays |
| Status Register | holds flags that show the result of an operation, such as zero, carry, negative and overflow, and interrupt information |
Why registers matter
Registers are much faster than main memory, so keeping the values being used in registers makes the processor quicker.
Worked example
The instruction at address 100 is LDD 200. The PC contains and is later updated to . The MAR is first loaded with so the instruction can be fetched. The MDR receives the instruction, which is copied to the CIR. Then the MAR is loaded with , and the MDR receives the data from address .
Common mistake: saying the PC holds "the current instruction". It holds the address of the next instruction. The CIR holds the instruction being executed. Also, the MDR holds data or instructions moving to and from memory, not the address.
Exam tip: when asked for the role of a register, give what it holds and when it is used. Learn the differences between the PC, MAR, MDR and CIR.
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 MDR?
The MAR holds the address of the memory location being accessed, while the MDR holds the data read from or to be written to it.
What is the purpose of the index register?
It holds a value added to an address to form the address used in indexed addressing.