What are memory addressing modes, and what are their main objectives? Explain.
2025
What are memory addressing modes, and what are their main objectives? Explain.
Show answer & explanation
Concept
An addressing mode is the rule encoded in an instruction that tells the processor where an operand is located or how to compute its effective address. Different modes trade instruction size and execution cost for flexibility in accessing constants, registers, memory objects, pointers, arrays, control-flow targets, and stacks.
Application: common modes and their objectives
Mode | Operand or effective-address rule | Main objective |
|---|---|---|
Immediate | The constant value is part of the instruction. | Use a small constant without a separate memory read. |
Register | The operand is held in a named CPU register. | Provide fast access to frequently used values. |
Direct or absolute | The instruction contains the memory address. | Access a fixed memory location with a simple address calculation. |
Indirect or register-indirect | A register or memory location holds the address of the operand. | Support pointers and dynamically selected data. |
Indexed or base-plus-displacement | The effective address is a base value plus an index or constant displacement. | Access array elements, records, and stack-frame fields efficiently. |
Relative or PC-relative | The effective address is the program counter plus a signed displacement. | Encode nearby branches or data references compactly and support relocatable code. |
Auto-increment or auto-decrement | Register-indirect access is combined with an automatic register update. | Traverse sequential data or implement stack operations with fewer instructions. |
Implied or stack | The operand location, such as an accumulator or the top of the stack, is implied by the opcode. | Reduce instruction length when the operand location is fixed by the operation. |
Cross-check
For LOAD R1, 12(R2), a base-plus-displacement interpretation computes the effective address as the contents of R2 plus 12 and reads the operand from that memory location. This example confirms that an addressing mode specifies an address-generation rule, not a different arithmetic operation.
Result
Thus, memory addressing modes are alternative operand-location and effective-address rules. Their central objectives are compact instruction encoding, efficient operand access, and convenient support for common program structures such as constants, pointers, arrays, relocatable branches, and stacks.