Computer Organization
Addressing Modes
Write the Effective Address (EA) formula first — most addressing NATs collapse once EA is clear.
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.
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
| Mode | EA / operand | Extra data memory reads |
|---|---|---|
| Immediate | operand = Imm | 0 |
| Register | operand = R | 0 |
| Direct | EA = Addr | 1 (data) |
| Reg. indirect | EA = R | 1 (data) |
| Mem. indirect | EA = Mem[Addr] | 2 (addr + data) |
| Displacement | EA = R + Imm | 1 (data) |
| PC-relative | EA = PC + Imm | 0 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.
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.
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.
10 GATE-style MCQs for Addressing Modes with full explanations. Attempt each question before revealing the answer.
In PC-relative addressing, EA is typically:
Show answer & explanation
Answer: B
PC-relative EA = PC + offset.
Which mode embeds the operand in the instruction?
Show answer & explanation
Answer: B
Immediate carries the value in the instruction.
Register-indirect EA is:
Show answer & explanation
Answer: B
EA = contents of register R; then Mem[EA] is the operand.
Direct addressing means the instruction contains:
Show answer & explanation
Answer: B
Direct: address field is the EA.
Displacement EA with R=100, Imm=25 is:
Show answer & explanation
Answer: C
EA = R + Imm = 125.
Indirect addressing (memory indirect) typically needs:
Show answer & explanation
Answer: B
First read yields the address of the operand.
Autoincrement mode usually:
Show answer & explanation
Answer: B
Pointer register updates after (or before) access.
For branches, the most common mode is:
Show answer & explanation
Answer: B
Branches commonly use PC-relative offsets.
Indexed addressing is closest to:
Show answer & explanation
Answer: A
Index + base/displacement forms EA.
Immediate mode memory operand fetches:
Show answer & explanation
Answer: B
Operand comes from the instruction itself.
Extra page-specific practice beyond the GATE samples. Attempt all 10, then reveal answers to check your reasoning.
PC=2000 (updated), offset=+40. PC-relative target:
Show answer & explanation
Answer: C) 2040
EA = 2000 + 40.
R=50 holds address; register-indirect operand address is:
Show answer & explanation
Answer: A) 50
EA = R = 50; operand = Mem[50].
Mode with operand inside instruction word:
Show answer & explanation
Answer: B) Immediate
Immediate.
EA = 300 for direct mode means instruction address field is:
Show answer & explanation
Answer: A) 300
Direct address field equals EA.
Based+offset with base=1000, offset=−8:
Show answer & explanation
Answer: B) 992
1000 − 8 = 992.
Memory-indirect: instruction field = 80, Mem[80]=500. Operand EA is:
Show answer & explanation
Answer: B) 500
First fetch yields 500 as the operand address.
Which needs no data-memory read for the operand?
Show answer & explanation
Answer: B) Immediate
Value already in the instruction.
PC-relative helps mainly with:
Show answer & explanation
Answer: B) Relocatable / nearby branches
Short offsets from PC.
Register mode operand location:
Show answer & explanation
Answer: B) CPU register
Operand in a register.
If stem says “PC points to current instruction” vs “next”, you must:
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.
Hover a card to reveal the answer with a 3D flip. On touch devices, tap the card or use Show answer.