What Are The Registers For?

What Are The Registers For?
What Are The Registers For?

Video: What Are The Registers For?

Video: What Are The Registers For?
Video: Introduction to Registers 2024, April
Anonim

Processor registers are cells of ultra-fast random access memory, which are designed for temporary storage of intermediate data. Different registers contain information in different forms: addresses and pointers to memory segments or system tables, indexes of array elements, etc.

What are the registers for?
What are the registers for?

The processor contains a large number of registers, which can be divided into several main groups: accumulators, flags, pointers, index, segment and control registers. Processor registers are memory locations for receiving, storing and subsequent transmission of intermediate results of program execution.

Any register of the processor is a digital electronic circuit containing a sequence of binary numbers of different widths (16, 32 or 64) and the results of conversions between them. By the type of reception and transmission of information, they can be sequential (shift) and parallel.

Accumulator registers are universal, they contain most of the intermediate results of executing various commands (logical, arithmetic, input / output, etc.). A processor can contain more than one battery. Software developers use batteries to reduce the bit width of instructions, simplify the program code.

Flag registers are also known as condition registers. They show a definite result of the operation, which can be zero, positive, negative, or indicate an overflow. Usually condition codes are combined into groups and form a different type of register - a control register. It is possible to change the flag registers, but it is undesirable so as not to distort the whole result.

Registers containing pointers to special areas of memory (stack, base, command) are called pointer registers. The most important of these is the stack pointer. A stack is a piece of memory made up of cells that follow one after the other, i.e. you can take from the stack only the cell that lies on top. It is to this top that the stack register points.

The base pointer usually contains the address of a specific stack location, which can be anything. Typically, the stack register and the base register are used simultaneously when working in the current procedure to indicate the required state of the stack.

The instruction pointer register is sometimes called the instruction counter, it contains pointers to the instructions of the run cycle. When the command is executed, its value is incremented by 1 and the loop continues with the next command. Those. the command counter always points to the command following the one currently being executed.

There are two index registers - the source index and the destination index. They are used to get the address of the stack data in combination with pointer registers.

Segment registers are used for segment memory addressing. In this case, the memory is divided into blocks (segments) of different lengths. The address of the desired memory cell is determined by the address of the beginning of the block and the amount of shift relative to it. There are four segment registers in total: for a code segment, a data segment, a stack segment, and an additional segment.

Control registers control processor operation and are not available to the user. Their execution is mainly controlled by machine programs. They contain information about the current command being executed, the state of the processor, and they also localize the control structures when the processor is operating in a protected mode.

Recommended: