Yeh page ek ladder hai. Har rung pichle se harder hai. Problem ko pehle khud try karo, uske baad solution kholo — collapsible callout answer tab tak hide karta hai jab tak tum click nahi karte. Yahan sab kuch Pipeline throughput and CPI pe based hai; agar koi symbol unfamiliar lage, toh parent note ne usse define kiya hai, aur yeh page usse use karta hai.
Shuru karne se pehle, un chaar symbols ko dobara anchor karte hain jinpe hum sabse zyada rely karenge, taaki koi bhi symbol bina wajah use na ho.
Goal: ek definition padho aur ek number plug in karo.
Recall Solution L1.1
KYA karna hai: slowest stage dhundho, phir register overhead add karo.
KYUN: har stage usi same edge pe clock karta hai, isliye tick itni lambi honi chahiye ki worst stage finish ho sake aur uska output register latch ho sake.
max(90,60,110,100,70)=110 ps (EX bottleneck hai)Tpipe=110+20=130 ps
Recall Solution L1.2
KYA: throughput =1/(CPI×T).
KYUN:CPI=1 ke saath, har tick mein ek instruction exit karti hai, aur ek tick T seconds ka hota hai.
Throughput=1×130×10−121=7.69×109instr/s≈7.69billion/s
Recall Solution L1.3
KYA: CPI = total cycles ÷ instructions.
KYUN: CPI ek per-instruction average hai, isliye hum poore bill ko count se divide karte hain.
CPI=400520=1.30
KYA: speedup = (time per instruction, single) ÷ (time per instruction, pipe).
KYUN: ideal CPI steady state mein dono ke liye 1 hai, isliye per-instruction comparison mein ratio sirf clock periods ka ratio hai.
Tsingle=90+60+110+100+70=430 psSpeedup=130430=3.31×5× nahi — kyunki EX ek bottleneck hai (unbalanced stages) aur hum har tick treg pay karte hain.
Recall Solution L2.2
KYA: har stall source ka expected cost ideal CPI of 1 pe add karo.
KYUN: expected stalls = (fraction of instructions affected) × (penalty each). Independent sources add hote hain.
Branch stalls=0.20×0.10×4=0.08Data stalls=0.30×1=0.30CPI=1+0.08+0.30=1.38
Recall Solution L2.3
KYA: throughput = clock rate / CPI.
KYUN: clock rate ticks per second hai; cycles-per-instruction se divide karne par ticks finished instructions mein convert hoti hain.
Throughput=1.382.5×109=1.812×109≈1.81billion instr/s
Goal: designs compare karo, reason karo "kaun better hai aur kyun."
Figure 2 dikhata hai ki "split the bottleneck" move clock ke saath exactly kya karta hai: lamba EX bar aadha ho jaata hai, aur ceiling (dashed red line = clock period) gir jaati hai jahan tak agle sabse uncha bar pahunchta hai.
Recall Solution L3.1
(a) Naya clock period.KYA: EX ab do 55-ps stages ho gaya hai, toh max(stage delays)+treg dobara run karo.
KYUN: clock hamesha ek sabse bure stage se set hoti hai; jab EX (110) chala jaata hai, toh naya worst stage MEM hai 100 ps pe (Figure 2 mein nayi red ceiling dekho).
Tnew=max(90,60,55,55,100,70)+20=100+20=120 ps
Purana T=110+20=130 ps tha.
(b) Naya CPI.KYA: deeper pipe jo extra stall introduce karti hai usse purane CPI 1.20 pe add karo.
KYUN: CPI =1+stalls/instr; purane 0.20 data-hazard stalls rehte hain, aur lambi forwarding distance 0.05 aur badhati hai, isliye stall term 0.20 se badh ke 0.25 ho jaata hai.
CPInew=1.20+0.05=1.25(c) Throughput ratio.KYA: dono throughputs ka ratio banao, har ek =1/(CPI×T) hai.
KYUN sirf CPI se compare nahi karte:time per instructionCPI×T hai — dono factors yahaan badle (CPI badha, T gira), isliye sirf CPI se judge karna galat taur pe kaheha ki naya design worse hai. Sirf product hi real speed capture karta hai.
oldnew=1/(1.20×130)1/(1.25×120)=1.25×1201.20×130=150156=1.04×Verdict: ek namoonaai 4% gain. KYUN itna kam? EX split karne se bottleneck sirf MEM pe shift hua — clock barely giri (130→120), aur extra stall ne us fayade ka kuch hissa kha liya. Yeh pipelines ko deeper karne ka law of diminishing returns hai. Compare karo 5.3.02-Superscalar-architecture se, jo T ki jagah CPI pe attack karta hai.
Recall Solution L3.2
Forwarding se pehle:CPIbefore=1+0.35×2=1.70Forwarding ke baad: sirf load-use subset stall karta hai, 1 cycle pe.
load-use fraction=0.35×0.20=0.07CPIafter=1+0.07×1=1.07Improvement:1.70−1.07=0.63 cycles/instr saved.
Dekho 5.2.07-Forwarding-and-bypassing un bypass wires ke liye jo 0-cycle path ko physical banate hain, aur 5.2.03-Data-hazards yeh jaanne ke liye ki load-use ko fully forward kyun nahi kiya ja sakta (data MEM tak ready nahi hota).
Goal: kaafi saari moving parts combine karo aur ek target ki taraf design karo.
Recall Solution L4.1
(a) Max CPI.KYA: throughput = clock/CPI ko invert karo taaki CPI = clock/throughput solve ho sake.
KYUN: throughput is baat se set hota hai ki har second mein kitne finished instructions milte hain; target aur clock fix karne ke baad sirf CPI unknown rehta hai.
CPImax=3.0×1093.0×109=1.00
Yeh kisi bhi stall ke saath impossible hai — ek ideal pipeline already CPI 1 pe baith jaati hai aur yeh hazards use usse upar push karte hain. Toh jaise stated hai target sirf prediction se meet nahi ho sakta; dekho hum kitne close hain aur kya chahiye.
(b) Mispredict rate m solve karo.KYA: CPI ko 1+branch stalls(m)+data stalls likho, required 1.00 ke barabar set karo, aur m solve karo.
KYUN: sirf m adjustable hai; equation ko target pe force karna exactly woh m batata hai jo target demand karta hai.
1+branch0.25⋅m⋅3+data0.30⋅2=1.000.75m+0.60=0.00⇒m=−0.80
Ek negative mispredict rate impossible hai. Conclusion: akela 0.60 data-stall term hi CPI ≥1.60 force kar deta hai, toh is clock pe 3 Ginstr/s unreachable hai. Design ko data stalls pe attack karna chahiye (forwarding) — branches pe nahi. Full forwarding ke saath dobara karo (data stalls → 0):
1+0.25⋅m⋅3=1.00⇒m=0,
yaani tab bhi tumhe perfect prediction chahiye. Practically clock raise karna padega. Exactly yahi dead-end designers ko 5.3.02-Superscalar-architecture ki taraf push karta hai (CPI below 1).
Recall Solution L4.2
KYA: har choice ke liye, us stall term ko current CPI se minus karo, phir throughputs compare karo.
KYUN: ek stall category eliminate karna CPI sum se exactly uska contribution remove karta hai; clock fixed hone par throughput ∝1/CPI hai, toh throughput ratio simply CPIold/CPInew hai.
Option A — branch stalls khatam karo: naya CPI =1.50−0.20=1.30.
Option B — data stalls khatam karo: naya CPI =1.50−0.30=1.20.
Current se throughput ratio (clock fixed) =CPIold/CPInew:
A: 1.301.50=1.154,B: 1.201.50=1.250Data stalls khatam karo (Option B):25% throughput gain 15.4% ke mukable. KYUN: bada stall term (0.30) bada lever hai — jo dominate karta hai usse speed up karo. Yeh Amdahl's Law disguise mein hai.
Goal: limits ke baare mein reason karo, degenerate cases, aur jahan simple model toot jaata hai.
Problems se pehle, hum fill-and-drain picture explicit karte hain, kyunki har Level-5 answer isi pe lean karta hai.
Figure 3 yeh literally dikhata hai: har column mein red exit-boxes ki count 0 se start hoti hai (pipe filling), 1 pe rise karti hai (full), aur busy boxes ki count wapas taper ho jaati hai jab last instructions drain hoti hain.
Recall Solution L5.1
(a) Exact CPI.KYA: total cycles ko instruction count se divide karo.
KYUN: CPI by definition total-cycles-per-instruction hai; hum sirf approximating ki jagah exact fill-and-drain count carry karte hain.
CPI(n)=instructionstotal cycles=nk+n−1=1+nk−1.
Term nk−1fill-and-drain tax hai: k−1 "wasted" edge cycles, sab n instructions pe amortise ki gayi. Bada pipe (large k) ya short program (small n) → bada tax.
(b) k=5 ke liye values (toh k−1=4).n=1:1+14=5.00,n=5:1+54=1.80,n=100:1+1004=1.04,n→∞:1+n4→1.(c) 1 ke 5% ke andar.KYA: tax term ≤0.05 demand karo aur n solve karo.
KYUN: "5% ke andar" matlab CPI ≤1.05 hai, yaani extra nk−1 0.05 se zyada nahi hona chahiye.
nk−1≤0.05⇒n≥0.054=80⇒n≥80.(d) Do edge cases, physically.
n=1 (single instruction, n<k): pipe kabhi fill nahi hoti. Woh ek instruction sab 5 stages se akele chalti hai; baaki 4 stages har cycle idle baithte hain. CPI =5=k — tumhe zero pipelining benefit milta hai, exactly wahi jaisa single-cycle machine ki latency hai. Yeh degenerate "short program" limit hai: pipe depth se chota program har instruction ke liye almost full latency pay karta hai.
n=k=5: pipe bahut mushkil se fill hoti hai, bilkul last instruction ke enter karne par, phir immediately drain shuru ho jaata hai. CPI =1.80 — phir bhi ideal se 80% upar, kyunki half run filling/draining mein guzar jaata hai. Sirf jab n≫k ho tabhi steady-state "har tick mein ek exit" dominate karta hai aur CPI 1 ki taraf settle hota hai.
Recall Solution L5.2
Pehle, woh symbol jo humhe chahiye — IPC.IPC (Instructions Per Cycle) woh average number of instructions hai jo har clock tick mein finish hoti hain — yeh CPI ka plain reciprocal hai: IPC=1/CPI, aur equivalently CPI=1/IPC. Jahaan CPI "ticks per instruction" count karta hai, IPC "instructions per tick" count karta hai. Ek scalar pipeline IPC =1 pe top out karta hai; ek superscalar isse exceed kar sakta hai.
(a) Yahaan sustained IPC directly 2.8 diya gaya hai (instructions finished per tick). Toh
CPI=IPC1=2.81=0.357.(b)Throughput=CPIclock=0.3574.0×109=1.12×1010=11.2billion instr/s
(Equivalently 4.0×109×2.8.)
(c) Ek scalar pipeline har tick mein at most ek instruction finish karta hai (CPI ≥1). Ek superscalar har tick mein kaafi saari finish karta hai, isliye CPI 1 se neeche ja sakta hai — dekho 5.3.02-Superscalar-architecture.
Recall Solution L5.3
(a) Clock period.KYA:max(delays)+treg apply karo.
KYUN: zero-delay stage max mein 0 contribute karta hai, isliye woh clock ke liye invisible hai — tick 100-ps stages se set hoti hai.
Tpipe=max(100,0,100,100,100)+15=100+15=115 ps(b) Do designs compare karo.KYA: stage remove karne ke baad time-per-instruction (CPI×T) ke dono factors check karo.
KYUN: stage remove karna T ya CPI dono badal sakta hai; yahaan worst stage unchanged hai isliye T 115 ps pe rehta hai, jabki CPI 0.02 se girta hai (ek kam register jo forward karna padta hai).
T4=115 ps (unchanged),CPI4=1.30−0.02=1.28
Kyunki T identical hai aur CPI gira, time per instruction CPI×T1.30×115=149.5 se 1.28×115=147.2 (ps) pe aa jaata hai. 4-stage version strictly faster hai.
Lesson: jo stage na max raise kare na kisi aur stage ko shorten kare woh pure overhead hai — use delete karo.
Recall Self-check clozes
Pipeline clock period equals ==max of stage delays +treg, sum nahi.
Actual CPI equals 1+ stalls per instruction ek scalar pipeline ke liye.
Throughput equals clock rate ÷ CPI.
CPI below 1 ke liye superscalar (multiple-issue)== execution chahiye.
Total cycles to run n instructions in a k-stage pipe ::: k+(n−1).
Fill-and-drain tax per instruction for n instructions in a k-stage pipe ::: nk−1 extra cycles.
Ek k-stage pipe pe n=1 instruction wale program ka CPI ::: exactly k (koi overlap nahi, pipe kabhi fill nahi hoti).