3.
1 Data-Addressing Modes
Data-addressing modes define how a processor identifies the location of operands used in
instructions. These modes improve program flexibility, efficiency, and performance by
allowing different ways of accessing data in memory or registers. The following sections
describe major data-addressing modes used in modern CPU architectures.
3.1.1 Register Addressing
Register addressing is one of the fastest addressing modes because operands are stored in
CPU registers. The instruction specifies the register that contains the data. This mode
eliminates memory access time and is widely used for arithmetic and logical operations.
Characteristics:
• Operand is located in a register.
• Very fast execution.
• Limited by the number of available registers.
3.1.2 Immediate Addressing
In immediate addressing, the operand is included directly in the instruction. Instead of
referencing memory or a register, the instruction contains a constant value.
Characteristics:
• Fast execution since no memory access is required.
• Useful for loading constants.
• Limited by the size of the instruction field.
3.1.3 Direct Data Addressing
Direct addressing refers to instructions that contain the memory address of the operand. The
CPU accesses the specified memory location to retrieve the data.
Characteristics:
• Simple to understand and implement.
• Requires memory access.
• The address is fixed and cannot be easily modified.
3.1.4 Register Indirect Addressing
In register indirect addressing, a register contains the memory address of the operand rather
than the operand itself. The CPU reads the register to find the effective address.
Characteristics:
• Flexible because the address stored in the register can change.
• Allows access to arrays and pointers.
• Requires a memory access.
3.1.5 Base-Plus-Index Addressing
This addressing mode uses the sum of two registers to form the effective address: one is a
base register and the other is an index register. It is common in array and structure access.
Characteristics:
• Supports complex data structures.
• Useful for high-level language implementation.
• Effective in iterating through memory blocks.
3.1.6 Register Relative Addressing
Register relative addressing forms the effective address by adding a constant displacement
to a register value. This is used in accessing local variables or parameters.
Characteristics:
• Combines register value with a constant offset.
• Flexible for accessing stack frames.
• Common in procedure calls.
3.1.7 Base Relative-Plus-Index Addressing
This mode extends base-plus-index addressing by including an additional displacement
value. The effective address is calculated by adding base register, index register, and a
constant.
Characteristics:
• Very flexible for accessing structured data.
• Frequently used in multidimensional arrays.
• Useful for compiler-generated code.
3.1.8 Scaled-Index Addressing
Scaled-index addressing multiplies an index register by a scaling factor (1, 2, 4, or 8) before
adding it to a base register. This is ideal for accessing arrays of different data sizes.
Characteristics:
• Efficiently supports arrays of structures.
• Reduces instruction count in data processing.
• Common in 32-bit and 64-bit architectures.
3.1.9 RIP Relative Addressing
RIP-relative addressing, used in x86-64 architecture, calculates the effective address by
adding a displacement to the instruction pointer (RIP). This supports position-independent
code.
Characteristics:
• Used in shared libraries and dynamic loading.
• Enables relocatable code.
• Enhances security by enabling ASLR.
3.1.10 Data Structures
Addressing modes play a major role in efficient handling of data structures such as arrays,
linked lists, stacks, and records. Each addressing mode suits different data-structure access
patterns.
Key connections:
• Arrays benefit from scaled-index and base-plus-index addressing.
• Linked lists depend on register indirect addressing.
• Stacks use register relative addressing.
• Records and objects rely on base-relative-plus-index addressing.
This completes the overview of major data-addressing modes used in modern computer
architecture.