4.1.2 · HinglishComputer Architecture (Deep)

Harvard architecture — separate instruction - data memory

1,690 words8 min readRead in English

4.1.2 · Coding › Computer Architecture (Deep)


Harvard exist kyun karta hai?


YEH precisely kya hai?

Figure — Harvard architecture — separate instruction - data memory

Speed-up kaise aata hai? (First principles se derive karo)

Hum ek memory access ko 1 cycle maante hain. Socho instructions execute ho rahi hain jisme se fraction wale data bhi touch karte hain (loads/stores).

Von Neumann — har shared-bus cycle ya toh fetch ya data karta hai:

  • Har instruction ko 1 fetch cycle chahiye: cycles.
  • Un data-touching instructions mein se har ek ko same bus pe ek aur cycle chahiye: cycles.

Yeh step kyun? Single bus fetch aur data ko serialize karta hai, isliye unke cycle costs add hote hain.

Harvard — fetch (instruction bus) aur data (data bus) parallel mein chalte hain:

  • Saare fetches instruction bus pe hote hain: cycles.
  • data accesses andar unhi cycles ke data bus pe overlap ho jaate hain → 0 extra cost (jab collide na karein).

Yeh step kyun? Do buses → data access fetch ke "neeche chhup" jaata hai. Costs add nahi hote, woh overlap karte hain (sum nahi, max hota hai).

Speed-up:


"Modified Harvard" twist (real chips kya karte hain)


Worked Examples


Common Mistakes (Steel-manned)


Recall Feynman: ek 12-saal ke bachche ko explain karo

Ek chef (CPU) imagine karo. Use recipes (instructions) aur ingredients (data) chahiye. Ek kitchen (von Neumann) mein pantry ka single door hai, isliye use recipe ke liye bahar jaana padta hai, wapas aana padta hai, phir ingredients ke liye dobara bahar jaana padta hai — ek trip mein ek cheez. Harvard kitchen mein do doors hain: ek hamesha recipes laata hai, ek hamesha ingredients laata hai. Do helpers ek saath kaam karte hain, isliye chef kabhi wait nahi karta. Catch yeh hai: recipe-door usually one-way hoti hai (aasaani se naye recipes wapas andar nahi daal sakte), isliye zyaatar real kitchens ek clever mix use karti hain — chef ke paas alag doors, lekin peeche ek bada shared storeroom.


Active-Recall Flashcards

#flashcards/coding

Harvard architecture kaun si ek problem attack karta hai?
Von Neumann bottleneck — instruction fetch aur data access ek shared bus ke liye compete karte hain.
Harvard architecture mein kya physically alag hota hai?
Instruction memory + bus aur data memory + bus (aur aksar caches bhi).
Ek cycle mein Harvard CPU kya kar sakta hai jo von Neumann CPU nahi kar sakta?
Ek instruction fetch karo AUR saath mein data access karo simultaneously.
Idealized Harvard speed-up formula, symbol ka matlab bhi batao?
, jahan un instructions ka fraction hai jo data memory access karte hain.
Agar ho, toh speed-up kya hai aur kyun?
(koi nahi); jab data traffic hi nahi hai toh doosre bus ke paas overlap karne ko kuch nahi hai.
Modified Harvard architecture kya hai?
Unified main memory (von Neumann-jaisi) lekin alag L1 instruction aur data caches — vN jaisi flexible, CPU ke paas Harvard jaisi fast.
Pure Harvard mein programs load karna / self-modifying code kyun awkward hai?
Instruction memory alag (aksar read-only) hoti hai, isliye aasaani se program as data usme write nahi kar sakte.
Speed ke alawa alag memories ka ek practical advantage batao.
Instructions aur data ke liye alag word widths / address sizes (saste, tight embedded designs).
Kaun si real chip families Modified Harvard use karti hain?
AVR, PIC, ARM Cortex-M microcontrollers.
Steel-man: koi kyun soch sakta hai Harvard ka matlab do CPUs hai, aur fix kya hai?
"Separate + parallel" multiprocessing jaisa lagta hai; fix — yeh EK CPU hai jiske paas DO memory paths hain.

Connections

  • Von Neumann architecture — single-bus design jisse Harvard contrast karta hai.
  • Von Neumann bottleneck — woh exact problem jo Harvard target karta hai.
  • CPU instruction cycle — fetch/decode/execute; Harvard, fetch ko data access ke saath parallelize karta hai.
  • Cache memory — split I-cache/D-cache = modern CPUs mein Modified Harvard.
  • Pipelining — stages overlap karna; Harvard memory pe structural hazards remove karta hai.
  • Microcontrollers (AVR PIC ARM Cortex-M) — real-world Harvard/Modified-Harvard users.
  • Memory bus and bandwidth — do buses effective memory throughput double kyun karte hain.

Concept Map

shares one bus, causes

motivates

has

has

enables

enables

serializes, cost adds to

overlaps, cost is

divided by

divided by

relaxed into

allows load code as data

Von Neumann single bus

von Neumann bottleneck

Harvard architecture

Instruction memory + bus

Data memory + bus

Fetch and data in parallel

T_vN = N times 1+f

T_H = N

Speed-up S = 1+f

Modified Harvard