Processor register
Adapted from Wikipedia · Adventurer experience
A processor register is a very fast place to store information inside a computer's processor. These tiny memory spots are quicker to use than the main memory of the computer. They help the computer do calculations and other tasks faster.
Most computers move data from its larger memory into registers before doing things like arithmetic operations or bitwise operations. After the work is done, the results are saved back to the main memory. This helps the computer work more efficiently.
Registers are at the top of the memory hierarchy, meaning they are the fastest places to store and get data. They are important for making modern computers powerful. When programs need to use the same data many times, keeping it in a register can make the program run faster. This process of choosing which values to keep in registers is called register allocation. It is done by the compiler or by a person writing assembly language code.
Size
Registers are tiny storage spaces inside a computer’s processor. They are measured by how many bits they can hold, like an 8-bit, 32-bit, 64-bit, or 128-bit register. Some processors can split this storage into smaller parts. This lets them handle many pieces of data at the same time. Processors that work on many pieces of data together are called vector processors.
Types
A processor has many kinds of registers. Registers are special storage spots that help the processor do its job. They can hold different types of information or help with different tasks.
- User-accessible registers are the ones that programs can read and write to. These include:
- Data registers that hold numbers, characters, or small groups of bits.
- Address registers that hold locations in memory where data can be found.
- General-purpose registers that can hold either data or addresses.
- Floating-point registers that are good for storing numbers with decimals.
- Constant registers that always hold special unchanging values.
- Vector registers that help with processing many pieces of data at once.
- Status registers that show whether certain conditions are true or false.
- Special-purpose registers that keep track of important parts of a program’s state, like where the program is currently running.
- Control registers that control how the processor works.
- Internal registers are used only inside the processor and cannot be directly accessed by programs. Examples include:
- The instruction register that holds the current instruction being carried out.
- Registers that help fetch data from memory.
Some registers are special because they always return a certain value when read, like zero, which helps make things work more easily.
Examples
This table shows how many registers are used in some common computer chips. Even though these chips are different, they all follow a basic design idea called the von Neumann architecture. One interesting thing is that graphics chips, known as GPUs, usually have many more registers than regular computer chips, called CPUs.
| Architecture | GPRs/data+address registers | FP registers |
|---|---|---|
| AT&T Hobbit | 000 | stack of 7 |
| Cray-1 | 8 scalar data, 8 address | 8 scalar, 8 vector (64 elements) |
| 4004 | 1 accumulator, 16 others | 000 |
| 8008 | 1 accumulator, 6 others | 000 |
| 8080 | 1 accumulator, 6 others, 1 stack pointer | 000 |
| Z80 | 17: 1 accumulator, 6 others, alternate set of 1 accumulator and 6 others, 2 index registers, 1 stack pointer | 000 |
| 1802 | 1 8-bit accumulator, 16 16-bit registers | 000 |
| iAPX432 | 000 | stack of 6 |
| 16-bit x86 | 008 | stack of 8 (if FP present) |
| IA-32 | 008 | stack of 8 (if FP present), 8 (if SSE/MMX present) |
| x86-64 | 16 (or 32 if APX available) | 16 or 32 (if AVX-512 available) |
| Fairchild F8 | 1 accumulator, 64 scratchpad registers, 1 indirect scratchpad register (ISAR) | 000 |
| COP400 | 1 accumulator, 1 pointer | 000 |
| Geode GX | 1 data, 1 address | 008 |
| Sunplus μ'nSP | 8 (sp, r1-r4, bp, sr, pc) | 000 |
| VM Labs Nuon | 000 | 001 |
| Nios II | 031 | 008 |
| Motorola 6800 | 2 accumulators, 1 index, 1 stack | 000 |
| Motorola 68k | 8 data (d0–d7), 8 address (a0–a7) | 008 (if FP present) |
| MSP430 | 0013 | 000 |
| SuperH | 0016 | 006 |
| Emotion Engine | 3(VU0)+ 32(VU1) | 32 SIMD (integrated in UV1) + 2 × 32 Vector (dedicated vector co-processor located nearby its GPU) |
| CUDA | configurable, up to 255 per thread | |
| CDC 6000 series | 016 | 008 |
| System/360, System/370, System/390, z/Architecture | 016 | 4 (if FP present); 16 in G5 and later S/390 models and z/Architecture |
| MMIX | 256 | 256 |
| NS320xx | 008 | 008 (if FP present) |
| Xelerated X10 | 001 | 032 |
| Parallax Propeller | 000 | 002 |
| Itanium | 128 | 128 |
| SPARC | 031 | 032 |
| IBM POWER | 032 | 032 |
| PowerPC/Power ISA | 032 | 032 |
| Blackfin | 8 data, 2 accumulator, 6 address | 000 |
| IBM Cell SPE | 128 | |
| PDP-10 | 016 | |
| PDP-11 | 007 | 006 (if FPP present) |
| VAX | 016 | |
| Alpha | 031 | 031 |
| 6502 | 1 accumulator, 2 index, 1 stack | 000 |
| W65C816S | 001 | 000 |
| MeP | 004 | 008 |
| PIC microcontroller | 001 | 000 |
| AVR microcontroller | 032 | 000 |
| ARM 32-bit (ARM/A32, Thumb-2/T32) | 014 | Varies (up to 32) |
| ARM 32-bit (Thumb) | 008 | 016 |
| ARM 64-bit (A64) | 031 | 032 |
| MIPS | 031 | 032 |
| RISC-V | 031 | 032 |
| Epiphany | 64 (per core) | |
Usage
The number of registers a processor has and what they can do helps decide how well computer programs work. Special tools that speed up programs can use these registers to get better results. The Strahler number of an expression tree shows the fewest registers needed to finish some jobs.
Related articles
This article is a child-friendly adaptation of the Wikipedia article on Processor register, available under CC BY-SA 4.0.
Safekipedia