In computer architecture, a register is a data structure that contains information that is frequently used. It may be an instruction, a memory address, or a status. Its scope is local to the block in which it is declared. When a block exits, its contents are freed.
A computer processor typically has two types of registers: internal and external. The internal registers are used for processor operations, whereas external registers are not accessible by instructions. The processor enables the fastest access to data, and is often the first component of a memory hierarchy.
Processor registers are a special type of register that is used to store data. These are normally the smallest data-holding elements of a processor. In some systems, there are multiple processor registers, each with its own set of memory addresses.
The most common type of register is the accumulator, which stores a block of information. The accumulator is accessed by the processor during the execution phase of an instruction. An instruction might specify multiplying the contents of two registers, which would place the two contents in a particular register. The next time the instruction is executed, the processor would fetch the contents from the specific register.
Other types of registers are the stack pointer, which is often used by high-level language compilers. The stack pointer is often helpful when a program is running in a debugger. The stack pointer is considered a hardware special register. It has a bit set if the signed result of an operation is positive or zero, if a signed overflow is encountered, or if a borrowed result is returned.
Another type of register is the flag register, which is a status register. A flag defines a condition. The size of the flag register is usually one to two bytes. It is divided into eight bits, which are used to indicate the exact condition. The bit set is a zero if the condition is met, a one if it is not, or a negative sign if the condition is not met.
The size of a register should be at least 32-bits, but some computer designs may have smaller registers. The number of registers is determined by the purpose, the rules of the language, and the computer’s configuration. If the machine has a 64-bit CPU, the registers must be 64-bits.
Some of the most common types of registers are the formal register and the informal register. A formal register is used in professional settings, such as in a business presentation or a business letter. An informal register is used in a group setting, such as in a family or an employee-employer relationship. In a social setting, such as a debate, a casual register is used. It is not rigid and can contain off-color language and contractions.
There are also sociolinguistic registers, which are a variety of language used for a particular communicative situation. The words and tone of voice, along with other characteristics, are all part of a register.