Types of Register in Computer Organization
In computer architecture, the register has a special place. It has a small high-speed memory inside the central processor unit. The computer contains temporary storage space, which is used to store the newly fetched data. We can use the registers to store the results temporarily. Registers are designed in a way that they can access the data at a much higher speed. Many resisters are classified on the basis of the function they perform, and the remaining resisters are the general-purpose registers.
The register can also be described as a sequential circuit. It contains a group of flip flops which is used to store the information. Each flip flop is used to store one bit of information. If there are n registers, it will contain the n flip flop, which is able to store the information in bits. The gate and flip flop is contained by the register as a whole. Here flip flops are used to store the information in bits while the gate is used to transfer the information in register.
Today in the market, we have various types of registers, which are capable of storing both registers and flip flops. But when the resisters contain only flip flops, we can call those registers the best and simple. In computer architecture, the register usually differs in the operations of bits. Here, some registers are 8, 16, 32 bits, but now we also have 64 bits. On the basis of operations such as fetching the instructions, we can differentiate these registers. A 32-bit register is able to get 32-bit of information at a time, and it can only process 32-bit information.
Functions of Registers
In terms of processing, the registers can be called the most important and useful memory because there are many commands that cannot be directly processed with the help of CPU and cannot deliver the output. These types of commands must be processed before delivering the output. In this case, the CPU (Central processing unit) uses the assembler unit and replaces the main command into a group of commands, which is known as the sub-command.
When we follow this process, each and every subcommand is processed with the help of ALU of the processor. The ALU of the processor is also stored the output in one of its registers that can be instruction register, address register, etc. The output of other subcommands affects the result of each subcommand. That's why just like the other memories, registers also have to work logically. If there is stability in one subcommand, then it will also affect the other subcommand. Hence, the output of each subcommand is temporarily stored with the help of registers.
The size of a register is used to show the amount of information this register can store. In bytes, the size of a register is described. Each byte is used to store one character of data. The size of a register can be one byte, two bytes, three bytes or up to eight bytes. If the register has a large size, the performance of CPU will also be increased.
Types of Register in Computer organization
Registers are mainly of two types. Some registers are user-accessible, while other registers are in process internally.
The two types of registers are as follows:
1. Processor Registers or Internal Registers
Process registers are also known as internal registers. These types of registers can be internally used in the processor. CPU uses these registers so that they can perform various operations. The users are not able to access these types of resisters. The processor can only access these CPU registers at the time of processing. IR can be used during the different phases of instruction, like fetching the instructions, decode the instructions, and execute the instructions. These phases can be called the function of register, which belongs to the microprocessor. These phases are described as follows:
In the phase of fetch, the memory is used to fetch the instructions.
With the help of memory, when the instruction is fetched, then instruction will be decoded to interpret the instruction. Here, the CPU is used to perform this operation, and this operation can be denoted by the opcode.
In the decode phase, when the operation is identified, then that operation will be performed with the help of arithmetic and logical unit. The result of the operation will be stored in the memory from where the users are able to see the result.
Here the processes of fetching the instructions or data are performed internally and then directly sent to the processor.
Types of Internal Registers
There are various types of internal registers in CPU, which are described as follows:
i) Program counter register
The program counter register is used to contain the address of next instruction in the sequence, which is required to fetch. It is a type of digital counter that is mainly used for fast execution and tracking the point of current execution. The program counter specifies the address from which the instruction can be fetched. Each data or instruction contained in the memory has a specified address.
When the instruction is successfully fetched, the stored value of program counter (PC) will be increased by 1, and the PC will also point to the next instruction. A program counter can also be called instruction address register, instruction pointer (IP), sequence control register, or instruction counter.
ii) Memory Address Register
The address specified with the help of program counter first goes to the memory address register (MAR). This address is found by the CPU from the memory address register to read the data or instruction from memory. Suppose there is some data that the CPU wants to write in the memory. In this case, the memory address register also defines at which address the data will be written.
So we can say that the memory address register stores the address from where the instruction or data can be stored in the memory and store the address from which the CPU is able to fetch the data or instruction. In another way, we can say that the memory address register stores the memory location of instruction or data that require to be accessed. The data is stored in the MR temporary because, without the help of MR, the CPU will never find the address to stored instruction. So logically, the memory address register can be called a registry.
iii) Instruction Register
With the help of memory, when the data is fetched, it will be stored in the IR (Instruction register). In another word, we can say that it contains the most recent fetched data or instruction. The instruction register contains a decoder, which decodes the fetched instruction or data and converts it into the machine code. The program cannot access this process.
iv) Memory Buffer Register (MBR)
The memory buffer register (MBR) is used to store the commands or contents of data that are written in the memory or read from it. The main function of MBR is to buffer the memory so that data or instruction is not halted abruptly to the processor. The main function of a memory buffer register is to store the instruction that is loaded on the memory or called from memory. The MDR (Memory data register) and the MBR (memory buffer register) are similar to each other.
MBR acts as a buffer that means if there are some minor differences in the operation, the memory buffer register acts as a buffer and allows the memory unit and processor to act separately without being affected by these changes. The data that is needed to store must be transferred to the memory buffer register and from this register to the specific memory location. If there is arithmetic data, it will be processed in the ALU (Arithmetic logic unit), but first, it will go to the memory buffer register (MBR), and after that, it will process in ALU.
v) Memory Data Register (MDR)
The memory data register is referred to as the most important CPU register. When the data is decoded in the above phase, we will get the address field, mode, and opcode information. The information about the operand address is directly or indirectly provided by this address field. When we are able to find the operand address, then with the help of this address, the operand will be fetched and then saved in a register, which is known as MDR (Memory Data Register).
MDR contains that type of data that is already fetched or can be fetched from memory. The memory data register is used to store the data which must be stored in the memory. The working of MDR (memory data register) and MBR (Memory buffer register) is the same. Like the buffer, when the information or data is fetching from memory, the CPU processes this operation and MDR will hold a copy of data, which is shifted from memory to register.
The memory data register is also known as a two-way register. When the information is fetched with the help of memory and placed into the memory data register, it is written to go only in a single direction. If there is a write instruction, with the help of another CPU register, the data to be written will be placed into the memory data register, and after that, that data will be put into the memory. The memory data register contains two parts. The first part contains the memory address register, and the other part contains the minimal interface between the computer storage and micro-program.
vi) Accumulator Register (AC)
The accumulator registers work as a temporary location, which is used to hold the logical and mathematical operations. These registers can be described as a part of ALU (Arithmetical Logical Unit). The accumulator register can be divided into four parts that are EAX, EBX, ECX, and EDX. The data registers of two bytes have two parts like AX, BX, CX, and DX. The size of two bytes is 8 bit. We can access these parts separately. The bytes, which has higher-order, is designed as AH, BH, CH, and DH. The bytes, which has lower order designed as AL, BL, CL, and DL.
It has the ability to add a sequence of numbers, and it is the most elementary use of an accumulator register. The results of the sum of numbers are progressively written to the accumulator. After each value, the previous value will be overwritten. In other word, when each number is added, the accumulator's numerical value will be increased. The simple desktop calculation also has the same process, but the accumulator is must faster than desktop calculation. When we find the result of the sum, it will be written on the memory or some other register. For example: suppose we want to add "6 + 7 + 8". In this operation, the accumulator will first hold the value 6. After that, it will hold the value 13, and then it will hold 21.
A huge variety of non-competing applications and activities contains the term accumulator like stock trading, which is a type of contract or agreement, hydraulics, which is a type of mechanical energy storage device, electrical engineering, which is a type of energy storage device like a rechargeable battery, and even in gambling, which is a parlay bet. In modern CPU's, the general-purpose register replaces the accumulator register because they provide us more flexibility.
2. User Accessible Register
As the name implies, the user-accessible registers can be accessed by the users with the help of entering commands. The user-accessible registers are also called general-purpose registers. These registers are very important to fetch the signals and to enable the accessibility of instruction in the computer organization. The size of user-accessible register is larger than the internal register. That's why these registers are able to store and perform operations larger as compared to the internal register.
The memory size of user-accessible registers is larger, but when they perform their operation, it takes a long time compared to the internal registers. The data registers are also included in these registers to temporarily store the data or instructions. There are some major accessible registers, which are described as follows:
General Purpose Registers: These types of registers can be accessed by the users, and they can also change them. The addresses or operand data is also included in the general-purpose registers.
Special Purpose Registers: These types of registers can only be accessed by the processor. The users cannot directly access these types of registers. For example: The program counter is contained in the special purpose register, which is used to address commands for processing.
Program Counter: This register is used to contain the address of next command. The program counter uses the main memory to store the address and to process it. After every command, the location of next address will be indicated with the help of number 1. So we can say that 1 is used here to show the next address.