Har FPGA-timing question inn cells mein se ek hai. Neeche ke worked examples mein har ek [C#] tag carry karta hai jo batata hai ki woh kaunsi cell cover karta hai.
#
Case class
Isme kya extreme hai
Example
C1
Large M (streaming limit)
M→∞, speedup →S
Ex 1
C2
Tiny M (M=1, single item)
Fill cost dominate karta hai, koi speedup nahi
Ex 2
C3
Degenerate pipeline (S=1)
Pipeline karne ko kuch nahi — sanity floor
Ex 3
C4
Balanced vs unbalanced stages
Ek slow stage T set karta hai
Ex 4
C5
Compute-bound roofline side
Ppeak<B⋅I
Ex 5
C6
Memory-bound roofline side
B⋅I<Ppeak; zyada logic useless
Ex 6
C7
Real-world word problem
Latency budget se device choose karo
Ex 7
C8
Exam twist
Clock unit trap + efficiency →S
Ex 8
Related vault topics jo padhte waqt open rakhne chahiye: Pipelining and Throughput, Roofline Model & Arithmetic Intensity, Configurable Logic Blocks (LUTs & Flip-Flops), GPU vs FPGA vs ASIC trade-offs, High-Level Synthesis (HLS), Dataflow architectures.
Upar ke conveyor ko dekho: pehla item (amber) sabhi S benches ke upar crawl karta hai — yahi fill hai. Jab woh exit karta hai, cyan items ek per tick follow karte hain. Yahi ek tasveer hai kyun neeche ke har case ka behavior waise hi hota hai.
Pipelined cycles compute karo.cycles=S+(M−1)=8+99,999=100,007.
Yeh step kyun? Conveyor picture: pehle item ko pure pipe mein crawl karne ke liye sabhi S=8 ticks chahiye (the fill), aur baaki M−1=99,999 items mein se har ek ek aur tick add karta hai jaise woh uske peechhe pop out hote hain. 8+99,999=100,007.
Speedup compute karo.S+M−1MS=100,007100,000×8=100,007800,000≈7.9994.
Yeh step kyun? Serial CPU se compare kar rahe hain jo M⋅S ticks spend karta hai.
Interpret karo. Hum ceiling S=8 ke 0.008% ke andar hain.
Yeh step kyun? Limit S+M−1MS→S as M→∞ confirm karta hai.
Recall Verify
Jab M→∞, top aur bottom dono ko M se divide karo: 1+(S−1)/MS→S. M=100,000 aur S=8 ke saath, hum 7.9994 par hain — essentially 8. Units: dimensionless (times ka ratio). ✓
Pipeline ke liye cycles.S+(M−1)=8+0=8 ticks.
Yeh step kyun?M=1 ke saath item ke peechhe overlap karne ke liye kuch nahi hai; woh bas full length crawl karta hai.
Serial CPU ke liye cycles.M⋅S=1×8=8 ticks.
Yeh step kyun? Ek item, aath serial operations.
Speedup.8+1−11×8=88=1.
Yeh step kyun? Dono machines same time lete hain — pipeline ne zero benefit diya.
Recall Verify
S+M−1MS at M=1 gives SS=1 for anyS. Speedup exactly 1 hai. ✓
Plug in karo.S+M−1MS=1+5000−15000×1=50005000=1.
Yeh step kyun? Ek stage matlab har item poore datapath ko akele occupy karta hai — doosre item ko overlap karne ki jagah nahi.
Ceiling interpret karo.M→∞ par limit S=1 hai.
Yeh step kyun? Agar sirf ek stage ho to 1× se aage nahi ja sakte. Ceiling hi stage count hai.
Recall Verify
S=1⇒MM=1 for all M. Degenerate case correctly "no speedup" report karta hai. ✓
Bottleneck dhundho (a). Clock slowest bench se tez tick nahi kar sakti: T=tmax=9 ns.
Yeh step kyun? Har stage ek clock share karta hai; agar 9 ns se tez tick karta to slow stage tick aane par finish nahi hota → galat data (ek timing-closure violation, parent note dekho).
Split se pehle total time (b).(S+M−1)T=(4+999)×9=1003×9=9027 ns.
Yeh step kyun? Pipeline-time formula ka seedha use.
Split ke baad (c). Ab S=6, T=3 ns: (6+999)×3=1005×3=3015 ns.
Yeh step kyun? Do aur stages se do extra fill ticks lagte hain, lekin har tick teen guna chhota hai — ek bada net win.
Re-balancing se speedup.9027/3015≈2.994× faster.
Yeh step kyun? Intuition confirm karta hai: slowest stage sabko throttle kar rahi thi; usse slice karne par clock breathe kar sakta hai.
Recall Verify
Before: 9027 ns. After: 3015 ns. Ratio ≈2.994. Units sab ns mein → ratio dimensionless. ✓
Compute double karo (b).min(1000,100)=100 GOP/s — unchanged.
Yeh step kyun? Tumne slack side wide ki; bottleneck (memory) kabhi nahi hila. Yahi "more logic used ≠ faster" wali galti hai parent note se.
BRAM se intensity raise karo (c). Naya B⋅I=20×30=600; min(500,600)=500 GOP/s.
Yeh step kyun? Cached data reuse karne ka matlab per op fewer DRAM trips → higher I → tum diagonal ke upar slide ho ke compute roof par aa jaate ho. 5× faster.
Recall Verify
(a) min(500,100)=100. (b) min(1000,100)=100 (no change). (c) min(500,600)=500; 500/100=5×. ✓
FPGA latency (a). Pehla result S ticks ke baad: 20×5 ns=100 ns=0.1μs.
Yeh step kyun? Latency = pipeline fill = ST. 10μs budget se compare karo → vast margin ke saath pass.
FPGA throughput (b). Pipe full hone ke baad har tick mein ek sample emit hota hai, isliye N=1000 samples ka frame NT=1000×5 ns=5μs≤8μs leta hai. ✓
Yeh step kyun? Throughput sustained rate hai; frame size N (problem mein given) ko tick T se multiply karne par per-frame time milta hai, aur 5μs<8μs deadline meet karta hai.
GPU check (c). Throughput 6μs≤8μs ✓ lekin latency 50μs>10μs ✗.
Yeh step kyun? GPU throughput pane ke liye batch karta hai, latency budget blow karta hai. Reject karo.
Decision. FPGA dono meet karta hai; GPU latency fail karta hai. FPGA choose karo — classic low-latency streaming win.
Recall Verify
FPGA latency =100 ns≤10,000 ns ✓; frame time 5μs≤8μs ✓; GPU latency 50μs>10μs ✗. FPGA hi ek device hai jo dono pass karta hai. ✓
Clock convert karo (the trap).T=200×106Hz1=5×10−9 s=5 ns.
Yeh step kyun? MHz millions of ticks per second hai; invert karna bhool jaane par nonsense milta hai. Time formula mein plug karne se pehle hamesha frequency ko period mein turn karo.
Pipeline time (a).(S+M−1)T=(12+9999)×5 ns=10,011×5 ns=50,055 ns≈50.06μs.
Yeh step kyun? Seedha pipeline-time formula mein correct T ke saath: 11 fill ticks plus M−1=9999 pops, sab ×5 ns.
CPU time (b).M×S×1 ns=10,000×12×1 ns=120,000 ns=120μs.
Yeh step kyun? Serial machine mein koi overlap nahi: M=10,000 items mein se har ek ko apne poore S=12 operations ka cost lagta hai, har ek 1 ns, toh total =M⋅S⋅1 ns.
Efficiency (c).pipeline timeCPU time=50,055120,000≈2.40? Nahi — efficiency yahan speedup matlab hai S+M−1MS=10,011120,000≈11.99.
Yeh step kyun? Efficiency honest speedup ratio S+M−1MS hai (same total work MS pipe ke actual S+M−1 ticks ke upar). 11.99 par hum ceiling S=12 ke 99.9% par hain, kyunki 11-tick fill cost 10,000 streamed items ke against negligible hai — yeh exactly M→∞ limit hai jo S approach karta hai.
Recall Verify
T=5 ns; pipe =50,055 ns; CPU =120,000 ns; efficiency =120,000/10,011≈11.99≈S=12. Parent note ke numbers se match karta hai. ✓