Types of Addressing Modes in Computer Architecture
Addressing Modes in Computer Architecture:
It is an aspect of the instruction set architecture in most central processing unit (CPU) designs. Computers use the addressing mode techniques to accommodate one or both of the following provisions:
1. To give programming versatility to the user by providing such facilities as pointers to memory, counters for loop control, indexing of data, and program relocation.
2. To reduce the number of bits in the addressing field of the instruction. PC holds the address of the instruction to be executed next and is incremented each time an instruction is fetched from memory.
Types of Addressing Modes:
Immediate Mode: In this mode, the operand is specified in the instruction itself. In other words, an immediate-mode instruction has an operand field rather than an address field.
Register Mode: In this mode the operands are in registers that reside within the CPU. The particular register is selected from a register field in the instruction.
Register Indirect Mode: In this mode the instruction specifies a register in the CPU whose contents give the address of the operand in memory.
Auto-increment or Auto-decrement Mode: This is similar to the register indirect mode except that the register is incremented or decremented after (or before) its value is used to access memory. The effective address is defined to be the memory address obtained from the computation dictated by the given addressing mode.
Direct Address Mode: In this mode the effective address is equal to the address part of the instruction.
Indirect Address Mode: In this mode, the address field of the instruction gives the address where the effective address is stored in memory.
The effective address in these modes is obtained from the following computation:
effective address = address part of instruction + content of CPU register
Relative Address Mode: In this mode, the content of the program counter is added to the address part of the instruction to obtain the effective address.
Indexed Addressing Mode: In this mode, the content of an index register is added to the address part of the instruction to obtain the effective address.
Base Register Addressing Mode: In this mode, the content of a base register is added to the address part of the instruction to obtain the effective address.