Skip to main content

Computer Organization

Addressing Modes

Write the Effective Address (EA) formula first — most addressing NATs collapse once EA is clear.

~3 hrs ~1–1.5 marks · High 10 samples · 10 practice · 10 cards

GATE CSE addressing modes — immediate, direct, indirect, register, displacement, indexed, PC-relative effective addresses with samples and drills.

Learning outcomes

  • Compute EA for immediate, direct, register, register-indirect, and displacement modes
  • Handle PC-relative and memory-indirect modes with the stem’s PC convention
  • Count memory accesses (fetch + address + data) for each mode
  • Explain autoincrement/autodecrement side effects on pointer registers

Effective address idea

  • Effective Address (EA) is the final memory address of the operand after the addressing mode is applied. For register/immediate modes there may be no memory EA for the operand itself.
  • Always separate three ideas: (1) bits in the instruction field, (2) EA computed from those bits, (3) operand value = Mem[EA] or register contents.
  • Instruction fetch always costs at least one memory read (unless instruction cache hit — GATE usually counts logical accesses unless told otherwise).
  • Textbook names vary (based, indexed, displacement) — map every name back to an EA formula before calculating.

Formulas to remember

  • Operand (memory mode) = Mem[EA]
  • Never treat Imm as EA unless the mode is direct/absolute

Worked example

Problem. Instruction field contains 200. Is the operand 200?

Solution. Only in immediate mode. In direct mode 200 is the EA and the operand is Mem[200]. In memory-indirect, Mem[200] is itself an address of the operand.

Flow from instruction field through effective address to operand value
Field bits → EA → Mem[EA]/R — write EA on scrap before arithmetic.

Core modes & EA formulas

  • Immediate: operand value is inside the instruction (Imm). No data-memory read for the operand.
  • Register: operand is in a CPU register named in the instruction. No data-memory read.
  • Direct / absolute: instruction holds the memory address; EA = Addr; operand = Mem[Addr].
  • Register indirect: EA = R (contents of register R); operand = Mem[R].
  • Memory indirect: instruction holds Addr; first read Mem[Addr] to get the true EA; operand = Mem[Mem[Addr]].
  • Displacement / based / indexed: EA = Base + Offset (or Index + Displacement). Names differ; algebra is the same.
  • PC-relative: EA = PC + Imm — standard for branches and position-independent code. Confirm whether PC already points past the instruction.

Formulas to remember

  • Immediate: operand = Imm (no EA)
  • Register: operand = R
  • Direct: EA = Addr
  • Register indirect: EA = R
  • Memory indirect: EA = Mem[Addr]
  • Displacement: EA = R + Imm
  • PC-relative: EA = PC + Imm
ModeEA / operandExtra data memory reads
Immediateoperand = Imm0
Registeroperand = R0
DirectEA = Addr1 (data)
Reg. indirectEA = R1 (data)
Mem. indirectEA = Mem[Addr]2 (addr + data)
DisplacementEA = R + Imm1 (data)
PC-relativeEA = PC + Imm0 or 1 (branch target fetch later)

Worked example

Problem. PC-relative branch with PC=1000 (after fetch) and offset −20. Target?

Solution. If offset is relative to the updated PC, EA = 1000 − 20 = 980. Always match the stem’s PC convention.

Addressing mode map with EA formulas and extra data-memory reads
Mem-indirect costs two data-side reads — count carefully in access NATs.

Autoincrement, autodecrement & stacks

  • Autoincrement: use R as a pointer, then R ← R + size (post-increment) — or pre-increment variants. GATE may ask the final value of R after the instruction.
  • Autodecrement: R ← R − size then access (classic stack push), or post-decrement — read the stem carefully.
  • These modes implement walking through arrays or stacks with fewer explicit add instructions.
  • Side effect matters: even if you only need the operand, the pointer register changes — MCQs often test the post-update value of R.

Worked example

Problem. R=1000, post-autoincrement word access (size 4). EA and final R?

Solution. EA = 1000; after access R = 1004.

Post-autoincrement example with R changing from 1000 to 1004 after word access
EA uses the old pointer; final R is the usual follow-up question.

GATE exam tricks — addressing

  • Write EA = … on scrap paper before arithmetic — mode mix-ups are the #1 error.
  • Immediate ≠ direct: immediate is the value; direct is an address field.
  • For “number of memory accesses”, count instruction fetch + any address-indirection reads + data read/write separately.
  • PC-relative: if the stem says “PC points to the current instruction”, add Imm to that PC (or to PC+length if it says next). Never assume blindly.
  • Indexed vs based: both are “register + offset” ideas; GATE cares about the numeric EA, not the marketing name.
  • Negative offsets are normal for stacks and backward branches — keep signed Imm intact.

Worked example

Problem. Memory-indirect: Addr field=80, Mem[80]=500, Mem[500]=42. What is the operand?

Solution. EA = Mem[80] = 500; operand = Mem[500] = 42.

Exam tips

  • EA first, numbers second.
  • PC-relative: read whether PC is pre- or post-increment in the stem.
  • Indirect modes add extra memory reads for the address.
  • Autoincrement questions: report both EA and the final pointer.
  • Immediate needs no data-memory operand fetch.
Exam pattern · 10 questions

GATE sample questions & answers

10 GATE-style MCQs for Addressing Modes with full explanations. Attempt each question before revealing the answer.

Q1 PC-relative

In PC-relative addressing, EA is typically:

  • A) Imm only
  • B) PC + Imm
  • C) R + Imm with R a GPR only
  • D) Mem[Imm]
Show answer & explanation

Answer: B

PC-relative EA = PC + offset.

Q2 Immediate

Which mode embeds the operand in the instruction?

  • A) Direct
  • B) Immediate
  • C) Indirect
  • D) Register indirect
Show answer & explanation

Answer: B

Immediate carries the value in the instruction.

Q3 Register indirect

Register-indirect EA is:

  • A) Imm
  • B) R
  • C) PC + Imm
  • D) Mem[Imm]
Show answer & explanation

Answer: B

EA = contents of register R; then Mem[EA] is the operand.

Q4 Direct

Direct addressing means the instruction contains:

  • A) Operand value
  • B) Memory address of operand
  • C) Only opcode
  • D) PC offset only
Show answer & explanation

Answer: B

Direct: address field is the EA.

Q5 Displacement

Displacement EA with R=100, Imm=25 is:

  • A) 25
  • B) 100
  • C) 125
  • D) 75
Show answer & explanation

Answer: C

EA = R + Imm = 125.

Q6 Indirect

Indirect addressing (memory indirect) typically needs:

  • A) No memory access
  • B) Extra memory read to get the true EA
  • C) Only registers
  • D) DMA
Show answer & explanation

Answer: B

First read yields the address of the operand.

Q7 Autoincrement

Autoincrement mode usually:

  • A) Freezes R
  • B) Uses R as pointer then increments R
  • C) Deletes Imm
  • D) Ignores memory
Show answer & explanation

Answer: B

Pointer register updates after (or before) access.

Q8 Branches

For branches, the most common mode is:

  • A) Immediate data only
  • B) PC-relative
  • C) I/O mapped
  • D) DMA
Show answer & explanation

Answer: B

Branches commonly use PC-relative offsets.

Q9 Indexed

Indexed addressing is closest to:

  • A) EA = index + base/displacement idea
  • B) Immediate only
  • C) No address
  • D) Stack pop only
Show answer & explanation

Answer: A

Index + base/displacement forms EA.

Q10 Access count

Immediate mode memory operand fetches:

  • A) Always 2 data reads
  • B) Typically none for the operand (value in IR)
  • C) Infinite
  • D) Only DMA
Show answer & explanation

Answer: B

Operand comes from the instruction itself.

Topic drill · 10 questions

10 practice questions — Addressing Modes

Extra page-specific practice beyond the GATE samples. Attempt all 10, then reveal answers to check your reasoning.

P1

PC=2000 (updated), offset=+40. PC-relative target:

  • A) 40
  • B) 2000
  • C) 2040
  • D) 1960
Show answer & explanation

Answer: C) 2040

EA = 2000 + 40.

P2

R=50 holds address; register-indirect operand address is:

  • A) 50
  • B) Mem[50] as EA wait — EA is 50
  • C) 0
  • D) PC
Show answer & explanation

Answer: A) 50

EA = R = 50; operand = Mem[50].

P3

Mode with operand inside instruction word:

  • A) Direct
  • B) Immediate
  • C) Indirect
  • D) Stack only
Show answer & explanation

Answer: B) Immediate

Immediate.

P4

EA = 300 for direct mode means instruction address field is:

  • A) 300
  • B) Mem[300]
  • C) PC
  • D) Unknown
Show answer & explanation

Answer: A) 300

Direct address field equals EA.

P5

Based+offset with base=1000, offset=−8:

  • A) 1008
  • B) 992
  • C) 8
  • D) 1000
Show answer & explanation

Answer: B) 992

1000 − 8 = 992.

P6

Memory-indirect: instruction field = 80, Mem[80]=500. Operand EA is:

  • A) 80
  • B) 500
  • C) 580
  • D) 0
Show answer & explanation

Answer: B) 500

First fetch yields 500 as the operand address.

P7

Which needs no data-memory read for the operand?

  • A) Direct
  • B) Immediate
  • C) Indirect
  • D) Register-indirect
Show answer & explanation

Answer: B) Immediate

Value already in the instruction.

P8

PC-relative helps mainly with:

  • A) Disk geometry
  • B) Relocatable / nearby branches
  • C) DMA setup
  • D) Cache tags
Show answer & explanation

Answer: B) Relocatable / nearby branches

Short offsets from PC.

P9

Register mode operand location:

  • A) Main memory only
  • B) CPU register
  • C) Disk
  • D) Immediate ROM
Show answer & explanation

Answer: B) CPU register

Operand in a register.

P10

If stem says “PC points to current instruction” vs “next”, you must:

  • A) Ignore PC
  • B) Apply that convention when adding Imm
  • C) Always subtract 4
  • D) Use DMA
Show answer & explanation

Answer: B) Apply that convention when adding Imm

PC convention changes the numeric target.

Topic FAQs

What is effective address?

The memory address of the operand after applying the addressing mode (not always the raw instruction field).

Why use PC-relative addressing?

Position-independent branches/jumps with short offsets; the target moves with the code when the program is relocated.

How many memory accesses does register-indirect need for the operand?

One data-memory access at EA = R (plus the instruction fetch itself).

What is the difference between immediate and direct modes?

Immediate places the operand value in the instruction; direct places the memory address of the operand in the instruction.

Quick revision · 10 cards

10 flashcards — Addressing Modes

Hover a card to reveal the answer with a 3D flip. On touch devices, tap the card or use Show answer.

Q1 How do you compute the effective address in PC-relative addressing?
Q2 In immediate addressing mode, where is the operand value found?
Q3 In direct (absolute) addressing, what does the instruction’s address field represent?
Q4 What is the effective address in register-indirect addressing?
Q5 How is the effective address formed in displacement (based/indexed) addressing?
Q6 Why does memory-indirect addressing need an extra memory read before reading the operand?
Q7 What side effect does autoincrement addressing typically have on the pointer register?
Q8 Which addressing mode is most commonly used for nearby branches and jumps?
Q9 What should be your first written step on any addressing-mode numerical in GATE?
Q10 What is the key difference between immediate mode and direct mode?