Registers in computer are the fast storage devices present in the processor. However, it is a small storage device that can hold only one word of data. The one-word data is a standard data unit. In most the computer it is an 8-bit word i.e., a byte.
A processor does not contain only one register instead it has several registers that are meant for several different purposes. As the registers are already placed in the processor they can be directly processed by the processor and its access time is even shorter than the time required to access the cache memory.
Registers are allowed to hold any type of information. Well, there is lots more to learn about the registers of computers let’s move ahead with our content.
How do Registers in Computer Work?
As we know that the instructions that are currently in execution must be present in the main memory of the computer. Similarly, the registers are nothing but the additional storage device that accepts, holds or transfers instructions or data under the direction of the control unit.
Registers help in performing the arithmetic calculation or logical comparisons at a high speed. However, the registers hold the instruction or data temporarily.
To understand the working of registers easily consider an example, a control unit uses a register for the immediate use of instructions and data. Such as a store uses a cash register where it stores some cash temporarily that can be used for current transactions.
The main advantage of using the registers along with the cache and memory is the speeding of tasks. Operations performed by registers are as follow:
Fetch
The fetch operation determines what operation the client wants to perform. It means it provides the direction to the processor. The instruction on which the processor has to work are stored in the main memory which is later fetched by the register for further processing.
Decode
This operation decodes the instruction provided by the client.
Execute
The processor then performs the decoded operation and stores the intermediate result or final result on the registers. X`
Types of Registers in Computer
On the basis of their functions, the registers can be classified into different types. We will discuss some common types of registers.
AC (Accumulator)
Accumulators are simply used for storing the intermediate results of the operations. If the intermediate result were stored on the main memory, then it would have created the overhead of accessing the memory in mid of the operation.
But as the registers can be accessed faster than the main memory. The accumulator plays a vital role in the speed up the execution of the instruction. However, modern systems have different kinds of accumulators but the more the number of accumulators more the complex will be designed.
Data Registers (DR)
The data register is used to store the data fetched from the computer’s main memory. Thus, we can determine the data registers as a buffer between the main memory and the processor as it holds the data that is copied from the main memory of the computer and which would be used by the processor for conducting further operations.
The data register is even used to hold the data that would be shifted to other memory components of the system.
Address Registers
The address register is used to fetch the instruction or data from the main memory of the system. It stores the address of the instruction or data that is to be fetched. The main task of the address register is to hold the address of the location in the main memory from where the data is to be read or to where the data has to be written.
Program Counter
The program counter indicates the address of the instruction that has to be executed next in the program. When the instruction is fetched the value of the program counter gets incremented by one. Thus, it further indicates the address of the instruction that has to be executed next in the program.
Index Registers
The index register is mainly used to alter the address of the operands when the program instruction is in execution. The content of this register is added or subtracted from an immediate address in order to obtain an effective address.
Memory Buffer Registers
The registers stores instruction or data that need to be transferred between the processor and the main memory. These registers are efficient to perform memory-related operations.
Instruction Register
This register mainly stores the instruction that is currently in execution. Even the instruction has to be decoded before going to execution.
Thus, the computer’s central processing unit has these types of registers. Remember it is the fastest and smallest memory of the computer. Registers play an important role in the execution of the program.