Addressing Modes in a CPU: Concepts and Worked Examples

Addressing Modes in a CPU: Concepts and Worked Examples

Verified Sources
Nov 4, 2026

In a CPU, an instruction often needs an operand (a value to use or a memory location to read/write). An addressing mode specifies how the CPU interprets the operand field in the instruction—either as an immediate value or as a way to compute an effective address (EA). This matters for both performance (how quickly operands are found) and correctness (which exact memory location is referenced).

At a high level, addressing modes fall into two categories:

  • Register/immediate-like modes: the operand is in the instruction itself or in a CPU register.
  • Memory-reference modes: the operand is found by computing an address using a base register, index register, displacement/offset, scaling, or indirection.

A useful mental model is:

  • The instruction contains some bits naming registers and/or constants.
  • The CPU applies the addressing-mode rule to determine either:
    • the operand value directly, or
    • the effective address, then reads/writes memory at that EA.

Key terms you’ll see repeatedly:

  • effective address
  • displacement/offset
  • base register
  • index register
  • indirection

Addressing Modes (General CPU Concepts)

Common addressing modes (with what they mean)

Different CPU ISAs describe addressing modes slightly differently, but the underlying patterns are consistent.

  1. Immediate addressing

    • The operand value is embedded in the instruction itself.
    • Example idea: ADD R1, #5 means “add 5 to R1”.
  2. Register addressing

    • The operand is in a named register.
    • Example idea: ADD R1, R2.
  3. Direct (absolute) memory addressing

    • The instruction contains (or refers to) a full memory address constant.
    • Example idea: LOAD R1, [0x1000].
  4. Register indirect

    • A register contains the memory address (a pointer).
    • Example idea: LOAD R1, [R3] where R3 points to the memory location.
  5. Base + displacement (base-relative)

    • Effective address is formed as EA = Base + displacement.
    • Example idea: LOAD R1, [Rbp + 8].
  6. Index (indexed) addressing

    • Effective address includes an index register (often with a scale).
    • Example idea: LOAD R1, [Rbase + Rindex] or EA = base + index*scale.
  7. Base + index + displacement

    • Common in array access and data structures.
    • Often: EA = base + index*scale + displacement.
  8. Scaled indexed addressing

    • A scale factor accounts for element size (e.g., 4 bytes for 32-bit ints).
    • Example idea: EA = base + index*4.

Note: Exact syntax differs by ISA (e.g., x86 uses “effective address” with forms like base+index*scale+disp; ARM uses variants for load/store and register+offset forms). The conceptual structures above still apply.

Pro Tip: Translate every memory operand into an EA formula

When you see LOAD/STORE with brackets like [ ... ], write an explicit EAEA expression (e.g., EA=Base+index∗scale+dispEA = Base + index*scale + disp). This makes it immediately clear which memory location is accessed.

Worked example: computing an operand address with multiple addressing modes

  1. 1
    Step 1

    Assume: Rbase=1000R_{base}=1000, Ridx=3R_{idx}=3, and memory is byte-addressed. Suppose M[1012]=42 M[1012]=42 (so the word at/starting near address 1012 has value 42 for this example).

  2. 2
    Step 2

    If the instruction is ADD R1, #5, then the operand value is 55 directly—no EA computation.

  3. 3
    Step 3

    If the instruction is ADD R1, R2 and R2=7R2=7, then the operand value is 77 (again, no EA).

  4. 4
    Step 4

    For LOAD R1, [Rptr] with Rptr=1012R_{ptr}=1012, compute EA=Rptr=1012EA=R_{ptr}=1012, then read M[EA]M[EA].

  5. 5
    Step 5

    For LOAD R1, [Rbase + 12]: compute EA=1000+12=1012EA = 1000 + 12 = 1012, then read M[1012]=42M[1012] = 42.

  6. 6
    Step 6

    For an array of 4-byte ints, LOAD R1, [Rbase + Ridx*4]: compute EA=1000+3∗4=1012EA = 1000 + 3*4 = 1012, then read M[1012]=42M[1012]=42.

  7. 7
    Step 7

    For LOAD R1, [Rbase + Ridx*4 + 8]: compute EA=1000+3∗4+8=1020EA = 1000 + 3*4 + 8 = 1020. The operand is at M[1020]M[1020].

Visual comparison of the EA rules

The table below focuses on how the effective address EAEA is computed (or whether an EA is needed at all).

Addressing modeExample operand syntax (conceptual)Effective address EAEA rule
Immediate#constNo EAEA; operand value is constconst
RegisterRkNo EAEA; operand value is RkRk
Direct/absolute memory[addr]EA=addrEA = addr
Register indirect[Rptr]EA=RptrEA = Rptr
Base + displacement[Rbase + disp]EA=Rbase+dispEA = Rbase + disp
Indexed (base + index)[Rbase + Ridx]EA=Rbase+RidxEA = Rbase + Ridx
Scaled indexed[Rbase + Ridx*scale]EA=Rbase+Ridx⋅scaleEA = Rbase + Ridx\cdot scale
Base + index + displacement[Rbase + Ridx*scale + disp]EA=Rbase+Ridx⋅scale+dispEA = Rbase + Ridx\cdot scale + disp

Relative conceptual complexity of finding the operand

A qualitative view: fewer computations for immediate/register; more arithmetic for base+index+disp forms.

Common pitfalls when reasoning about addressing modes

Worked “one loop” example: array element access via different modes

Consider accessing A[i] where A is an array of 4-byte integers.

Assume:

  • RbaseR_{base} holds the base address of A
  • RiR_i holds the integer index ii
  • Each element is 4 bytes

Then the memory read uses:

  • Scaled indexed addressing: EA=Rbase+Ri⋅4EA = R_{base} + R_i \cdot 4

So a conceptual LOAD Rval, [Rbase + R_i*4] reads M[EA]M[EA], i.e., the value at A[i].

In contrast:

  • Immediate addressing would not make sense for array indexing because ii varies per iteration, and immediate addressing fixes the operand value at assembly time.
  • Register indirect could be used if you first compute a pointer to A[i] (e.g., compute Rptr=Rbase+Ri∗4R_{ptr}=R_{base}+R_i*4 somewhere, then LOAD Rval, [Rptr]).

This is why modern compilers and ISAs emphasize addressing-mode arithmetic: it reduces extra instructions by folding address calculation into the load/store itself.

Addressing Modes Quick Check

1 / 5
Question · Term

What does addressing mode determine in an instruction?

Click to reveal
Answer · Definition

How the CPU interprets operand bits to get either the operand value directly or an effective address (EA) for memory access.

Knowledge Check

Question 1 of 4
Q1Single choice

In base+displacement addressing, the effective address is best modeled as: