Published by Patrick Mutisya · 14 days ago
Show understanding of the purpose and role of registers, including the difference between general‑purpose and special‑purpose registers.
Registers are small, fast storage locations inside the CPU. They hold data that the processor is currently working with, reducing the need to access slower main memory. This improves execution speed and allows the control unit to coordinate operations efficiently.
GPRs are typically named R0, R1, … or given functional names in specific architectures. They can store operands, intermediate results, or addresses.
| Register | Typical Use | Example Architecture |
|---|---|---|
| Accumulator (ACC) | Holds results of arithmetic/logic operations | 8085, ARM |
| Base Register (BR) | Provides a base address for indexed addressing | IBM System/360 |
| Counter Register (CTR) | Controls loop iteration counts | Motorola 68000 |
| Data Register (DR) | Temporarily stores data being transferred to/from memory | Intel x86 |
| Index Register (IX) | Used for array indexing and pointer arithmetic | Z80, MIPS (as \$t0‑\$t9) |
SPRs support the internal operation of the CPU and are not generally available for arbitrary data storage.
| Register | Function | Typical Symbol |
|---|---|---|
| Program Counter (PC) | Holds the address of the next instruction to fetch | PC |
| Instruction Register (IR) | Stores the currently decoded instruction | IR |
| Memory Address Register (MAR) | Contains the address of memory location being accessed | MAR |
| Memory Data Register (MDR) | Holds data read from or to be written to memory | MDR |
| Status Register / Flags (SR/FLAGS) | Indicates the outcome of the last operation (zero, carry, overflow, sign, etc.) | SR, FLAGS |
ADD R1, R2).A simplified data path for an arithmetic instruction can be described as:
\$\$\text{IR} \leftarrow \text{Memory}[ \text{PC} ] \quad
\text{PC} \leftarrow \text{PC} + 1 \quad
\text{ACC} \leftarrow \text{ACC} \; \text{op} \; \text{R}_n\$\$
where op is an arithmetic or logical operation, R_n is a general‑purpose register, and the result is stored back in the accumulator.
Registers are essential for the rapid execution of instructions. General‑purpose registers provide flexible storage for data and addresses, while special‑purpose registers manage the internal control flow, memory interfacing, and status reporting of the CPU. Understanding their distinct roles is fundamental to analysing instruction sets and CPU performance.