What are the types of registers in computers?
The ALU and Control Unit (CU) communicate with each other and perform operations in memory locations using a register. Registers are used to quickly accept, store, and transfer data and instructions that are being used immediately by the CPU.
1. Memory Address Register(MAR)
This register holds the memory addresses of data and instructions. It is used to access data and instructions from memory during the execution phase of instruction. Suppose CPU wants to store some data in the memory or to read the data from the memory. It places the address of the required memory location in the MAR.
2. Program Counter
The program counter (PC) is a processor register. It is a 16 bit special function register in the 8085 microprocessor. It keeps track of the next memory address of the instruction that is to be executed once the execution of the current instruction is completed. In other words, it holds the address of the memory location of the next instruction when the current instruction is executed by the microprocessor.
3. Accumulator Register
This Register is used for storing the results that are produced by ALU.
4. Memory Data Register(MDR)
It is the register of a computer’s control unit that contains the data to be stored in the RAM. It is the data that gets stored after being fetched from the computer storage. It acts like a buffer and holds anything that is copied from the memory ready for the processor to use it. MDR holds the information before it goes to the decoder.
The MDR is a two-way register. When data is fetched from memory and placed into the MDR, it is written to in one direction. When there is a write instruction, the data to be written is placed into the MDR from another CPU register, which then puts the data into memory.
5. Index Register
A register which holds a number that can be added to (or, in some cases, subtracted from) the address portion of a computer instruction to form an effective address. Also known as a base register used for modifying operand addresses during the run of a program.
6. Memory Buffer Register (MBR)
This register holds the contents of data or instruction, read from, or written in memory. It means that this register is used to store data/instruction coming from the memory or going to the memory.