4.1.8 · HinglishComputer Architecture (Deep)

Memory addressing modes — immediate, register, direct, indirect, indexed

1,798 words8 min readRead in English

4.1.8 · Coding › Computer Architecture (Deep)


Addressing modes exist kyun karte hain?

Har mode jo central cheez produce karta hai woh hai Effective Address (EA): woh final memory address jahan se operand fetch hota hai (ya write hota hai).


Paanch modes — har ek ka MATLAB kya hai

Figure — Memory addressing modes — immediate, register, direct, indirect, indexed

CPU har mode ko HOW execute karta hai (step by step)

Maano: M[100]=200, M[200]=350, M[204]=999, register R2=4, A=100.


Forecast-then-Verify (answer padhne se pehle yeh karo)


Common mistakes (Steel-man → Fix)


Recall Feynman: 12-saal ke bacche ko explain karo

Socho ek treasure hunt hai. Ek addressing mode har card par clue ka type hota hai.

  • Immediate: card likhta hai "tera khazana number 5 hai" — prize card par hi likha hai.
  • Register: "apni pocket #2 mein dekh" — jaldi, woh tumhare paas hi hai.
  • Direct: "ghar number 100 par jao" — address seedha likha hai.
  • Indirect: "ghar 100 par jao, andar note padho, woh asli ghar batayega" — do trips.
  • Indexed: "ghar 100 se shuru karo, phir utne gharon aage chalo jitna tumhara counter kahe" — poori street ek-ek karke check karne ke liye perfect (ek array!).

Flashcards

Effective address (EA) kya hota hai?
Ek operand ka final memory address, jo CPU instruction bits se addressing mode ke according compute karta hai.
Immediate mode — operand kahan hota hai aur kitne memory accesses lagte hain?
Instruction word ke andar hi; 0 operand memory accesses.
Register mode mein operand kahan hota hai?
CPU register mein; 0 memory accesses (memory bus ke liye fastest).
Direct mode EA formula?
(instruction mein literal address); operand , 1 access.
Indirect mode EA aur operand?
, operand ; 2 memory accesses; pointers ke liye use hota hai.
Indexed mode EA formula?
(base + index register); operand , 1 access.
Arrays ke liye best mode kaun sa hai aur kyun?
Indexed — loop mein index register increment karo aur har element ke liye same instruction reuse karo.
Pointers / linked lists ke liye best mode kaun sa hai?
Indirect — instruction us address ka address hold karta hai.
Indirect aur indexed mein key difference?
Indirect ek extra MEMORY read karta hai (, 2 accesses); indexed ADDITION karta hai (, 1 access).
Har mode ke liye operand fetch karne ke liye memory access count (Imm, Reg, Direct, Indirect, Indexed)?
0, 0, 1, 2, 1.
Immediate mode kyun use karte hain?
Constants supply karne ke liye bina kisi extra memory access ke (operand instruction ke saath hi pre-fetched hota hai).

Connections

Concept Map

rule computes

type

type

type

type

type

operand in instruction, 0 access

operand in R i, 0 access

EA = A, 1 access

EA = M A, 2 accesses

EA = A + R i, 1 access

used for

used for

used for

used for

used for

Addressing mode

Effective Address EA

Immediate

Register

Direct absolute

Indirect pointer

Indexed

Memory access to fetch operand

Constants

Fast temporaries

Global variables

Pointers, linked lists

Arrays and loops