6.5.10 · D3Advanced & Emerging Architectures

Worked examples — FPGA-based acceleration

2,794 words13 min readBack to topic

Before we compute anything, let us name the symbols so nobody is lost. Every one of these will appear on the diagrams too.

The one formula the whole page revolves around, restated so we own it:


The scenario matrix

Every FPGA-timing question is one of these cells. The worked examples below each carry a tag [C#] telling you which cell they cover.

# Case class What is extreme about it Example
C1 Large (streaming limit) , speedup Ex 1
C2 Tiny (, single item) Fill cost dominates, no speedup Ex 2
C3 Degenerate pipeline () Nothing to pipeline — sanity floor Ex 3
C4 Balanced vs unbalanced stages One slow stage sets Ex 4
C5 Compute-bound side of roofline Ex 5
C6 Memory-bound side of roofline ; more logic useless Ex 6
C7 Real-world word problem Choose device from latency budget Ex 7
C8 Exam twist Clock unit trap + efficiency Ex 8

Related vault topics you should keep open while reading: 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.

Figure — FPGA-based acceleration

Look at the conveyor above: the first item (amber) must crawl across all benches — that crawl is the fill. After it exits, cyan items follow one per tick. That single picture is why every case below behaves the way it does.


C1 — The streaming limit (large )

  1. Compute pipelined cycles. . Why this step? The conveyor picture: the very first item needs all ticks to crawl the whole pipe (the fill), and the remaining items each add exactly one more tick as they pop out behind it. .
  2. Compute speedup. . Why this step? Comparing to the serial CPU that spends ticks.
  3. Interpret. We are within of the ceiling . Why this step? Confirms the limit as .
Recall Verify

As , divide top and bottom by : . With and , we sit at — essentially . Units: dimensionless (a ratio of times). ✓


C2 — One lonely item ()

  1. Cycles for the pipeline. ticks. Why this step? With there is nothing behind the item to overlap with; it just crawls the full length.
  2. Cycles for the serial CPU. ticks. Why this step? One item, eight serial operations.
  3. Speedup. . Why this step? Both machines take the same time — the pipeline gave zero benefit.
Recall Verify

at gives for any . Speedup is exactly . ✓


C3 — The degenerate pipeline ()

  1. Plug in. . Why this step? One stage means each item occupies the whole datapath alone — no room to overlap a second item.
  2. Interpret the ceiling. The limit as is . Why this step? You can never beat if there is only one stage. The ceiling is the stage count.
Recall Verify

for all . The degenerate case correctly reports "no speedup". ✓


C4 — Unbalanced stages set the clock

Figure — FPGA-based acceleration
  1. Find the bottleneck (a). The clock can tick no faster than the slowest bench: . Why this step? Every stage shares one clock; if it ticked faster than , the slow stage would not be finished when the tick arrives → wrong data (a timing-closure violation, see parent note).
  2. Total time before the split (b). . Why this step? Direct use of the pipeline-time formula.
  3. After splitting (c). Now , : . Why this step? Two more stages cost two extra fill ticks, but each tick is three times shorter — a huge net win.
  4. Speedup from re-balancing. faster. Why this step? Confirms the intuition: the slowest stage was throttling everyone; slicing it lets the clock breathe.
Recall Verify

Before: . After: . Ratio . Units all in ns → ratio dimensionless. ✓


C5 — Compute-bound (roofline, right side)

  1. Compute the memory ceiling. . Why this step? This is the fastest memory can feed you.
  2. Take the min. . Why this step? Memory could feed , but the silicon can only chew — compute is the wall.
  3. Verdict: compute-bound. Adding more BRAM caching won't help; you'd need more DSP slices / a deeper pipeline. Why this step? You fix the binding constraint, never the slack one.
Recall Verify

, , . Compute-bound because . ✓


C6 — Memory-bound (roofline, left side)

Figure — FPGA-based acceleration
  1. Ceiling (a). ; . Memory-bound. Why this step? Memory only feeds ; the of compute mostly sits idle.
  2. Double the compute (b). unchanged. Why this step? You widened the slack side; the bottleneck (memory) never moved. This is the "more logic used ≠ faster" mistake from the parent note.
  3. Raise intensity via BRAM (c). New ; . Why this step? Reusing cached data means fewer DRAM trips per op → higher → you slide up the diagonal onto the compute roof. faster.
Recall Verify

(a) . (b) (no change). (c) ; . ✓


C7 — Real-world word problem: pick the device

  1. FPGA latency (a). First result after ticks: . Why this step? Latency = pipeline fill = . Compare to the budget → passes with vast margin.
  2. FPGA throughput (b). After the pipe is full it emits one sample per tick, so a frame of samples takes . ✓ Why this step? Throughput is the sustained rate; multiplying the frame size (given in the problem) by the tick gives the per-frame time, and meets the deadline.
  3. GPU check (c). Throughput but latency ✗. Why this step? The GPU batches to get throughput, blowing the latency budget. Reject it.
  4. Decision. The FPGA meets both; the GPU fails latency. Choose the FPGA — the classic low-latency streaming win.
Recall Verify

FPGA latency ✓; frame time ✓; GPU latency ✗. FPGA is the only device passing both. ✓


C8 — Exam twist: the clock-unit trap + efficiency

  1. Convert the clock (the trap). . Why this step? MHz is millions of ticks per second; forgetting to invert gives nonsense. Always turn frequency into a period before plugging into a time formula.
  2. Pipeline time (a). . Why this step? Straight into the pipeline-time formula with the correct : 11 fill ticks plus pops, all .
  3. CPU time (b). . Why this step? The serial machine has no overlap: every one of the items costs its full operations, each , so total .
  4. Efficiency (c). ? No — efficiency here means the speedup . Why this step? Efficiency is the honest speedup ratio (same total work over the pipe's actual ticks). At we sit at of the ceiling , because the -tick fill cost is negligible against streamed items — this is exactly the limit approaching .
Recall Verify

; pipe ; CPU ; efficiency . Matches the parent note's numbers. ✓


Recall check

FPGA speedup for a single item () through any -stage pipeline?
Exactly — no overlap possible, so pipelining buys nothing.
Why does a memory-bound kernel ignore extra compute units?
Because and is the binding term; widening leaves the min unchanged. Raise (BRAM reuse) instead.
What sets a pipeline's clock period?
The slowest single stage, — never the average; violating it breaks timing closure.
Convert to a period.
.
Speedup ceiling of an -stage pipeline as ?
— one full computation finishes every cycle once the pipe is full.