---
title: Final exam
heading: "Final exam: digital design with HDL"
eyebrow: S3 · Final exam
type: problems
---

::: hook
Twelve problems from the whole course: RTL and datapaths, floating point, timing, sizing, wires and power, pipelines and clock crossings, verification and FPGAs, high-level synthesis and the ASIC flow, DSP hardware, interfaces, test and error-correcting codes, processors and caches, clocks and physical design. Give yourself three hours and work without the lessons open. "Another set" deals a different exam.
:::

::: pool
pick: 12

::: check
kind: parts
given: N = 11 | 27; f = 25 | 80; t = 3.3 | 60

## A controller with {N} states, clocked at {f} MHz, generating a {t} kHz tick.

::: part
answer: ceil(log(N)/log(2))
tolerance: 0

### Binary state flip-flops?

::: misses
- [any] $\lceil\log_2N\rceil$.
:::
:::

::: part
answer: N
tolerance: 0

### One-hot flip-flops?

::: misses
- [any] One per state.
:::
:::

::: part
answer: ceil(log(f*1e3/t)/log(2))
tolerance: 0

### Divider counter bits?

::: misses
- [any] $\lceil\log_2(f/t)\rceil$.
:::
:::
:::

::: check
kind: parts
given: N = 16 | 64; t = 20 | 30; M = 16 | 24

## An {N}-bit adder at {t} ps per level, and an {M} × {M} multiplier reduced by a Dadda tree.

::: part
answer: (N - log(N)/log(2) - 2)*t
unit: ps
tolerance: 1%

### How much faster is Kogge–Stone than ripple?

::: misses
- [any] $(N - \log_2N - 2)t$.
:::
:::

::: part
answer: step(M - 2.5) + step(M - 3.5) + step(M - 4.5) + step(M - 6.5) + step(M - 9.5) + step(M - 13.5) + step(M - 19.5)
tolerance: 0

### Dadda reduction stages (heights 2, 3, 4, 6, 9, 13, 19, 28)?

::: misses
- [any] Count the heights below M.
:::
:::
:::

::: check
kind: parts
given: e = 120 | 135; f = 0.25 | 0.625; B = 400 | 1500; w = 150 | 200; r = 60 | 100

## An IEEE single with exponent field {e} and fraction {f}; and a {B}-word burst at {w} MHz into a FIFO read at {r} MHz.

::: part
answer: (1 + f)*2^(e - 127)
tolerance: 0.0001%

### The float's value?

::: misses
- [any] $(1 + f)2^{e-127}$.
:::
:::

::: part
answer: B*(1 - r/w)
tolerance: 0.5%

### FIFO depth?

::: misses
- [any] $B(1 - f_r/f_w)$.
:::
:::
:::

::: check
kind: parts
given: T = 800 | 1100; c = 40 | 55; L = 550 | 850; s = 25; m = 25 | 70; h = 20; k = -25 | 45; u = 20 | 40

## A path: {T} ps clock, {c} ps clock-to-Q, logic {m} to {L} ps, {s} ps setup, {h} ps hold, {k} ps skew and {u} ps of clock uncertainty on setup.

::: part
answer: T + k - u - (c + L + s)
unit: ps
tolerance: 0.5%

### Setup slack?

::: misses
- [any] $(T + k - u) - (t_{cq} + L + s)$.
:::
:::

::: part
answer: c + m - h - k
unit: ps
tolerance: 0.5%

### Hold slack?

::: misses
- [any] $(t_{cq} + m) - (h + k)$.
:::
:::
:::

::: check
kind: parts
given: G = 1.33 | 2.22; B = 1 | 2; H = 40 | 250; r = 0.3 | 0.8; l = 1.5 | 3

## A path with logical effort {G}, branching {B} and electrical effort {H}; and an {l} mm wire at {r} Ω/µm, 0.2 fF/µm.

::: part
answer: log(G*B*H)/log(4)
tolerance: 1%

### Best number of stages?

::: misses
- [any] $\log_4GBH$.
:::
:::

::: part
answer: 0.38*r*0.2e-15*(l*1000)^2*1e12
unit: ps
tolerance: 1%

### Wire delay, unrepeated?

::: misses
- [any] $0.38rcL^2$.
:::
:::
:::

::: check
kind: parts
given: a = 0.1 | 0.15; C = 3 | 8; V = 0.75 | 0.85; f = 1.5 | 2.5; K = 150 | 300; g = 0.5 | 0.7

## A block switching {C} nF at activity {a}, plus a {K} pF clock tree, at {V} V and {f} GHz.

::: part
answer: (a*C*1e-9 + K*1e-12)*V^2*f*1e9
unit: W
tolerance: 1%

### Total dynamic power?

::: misses
- [any] Logic plus clock, each $\alpha CV^2f$.
:::
:::

::: part
answer: K*1e-12*V^2*f*1e9*g
unit: W
tolerance: 1%

### Saving from gating {g} of the clock tree's load?

::: misses
- [any] That share of the clock power.
:::
:::
:::

::: check
kind: parts
given: T = 4 | 7; k = 4 | 8; r = 0.1 | 0.2; Lg = 3 | 5; R = 2 | 3

## A {T} ns block pipelined into {k} stages with {r} ns of register overhead; elsewhere, a loop with {Lg} ns of logic and {R} registers.

::: part
answer: T/k + r
unit: ns
tolerance: 0.5%

### Pipeline clock period?

::: misses
- [any] $T/k + r$.
:::
:::

::: part
answer: T + k*r
unit: ns
tolerance: 0.5%

### Pipeline latency?

::: misses
- [any] $T + kr$.
:::
:::

::: part
answer: Lg/R
unit: ns
tolerance: 0.5%

### Loop's iteration bound?

::: misses
- [any] L/R.
:::
:::
:::

::: check
kind: parts
given: t = 500 | 800; u = 20 | 25; f = 1000 | 1600; d = 50 | 200; Y = 10 | 1000

## A synchronizer: τ = {u} ps, $T_0$ = 20 ps, {f} MHz clock, data at {d} MHz.

::: part
answer: exp(t/u)/(20e-12*f*1e6*d*1e6)
unit: s
tolerance: 1%

### MTBF with {t} ps of settling?

::: misses
- [any] $e^{t/\tau}/T_0f_cf_d$.
:::
:::

::: part
answer: u*ln(Y*3.156e7*20e-12*f*1e6*d*1e6)
unit: ps
tolerance: 0.5%

### Settling time for an MTBF of {Y} years?

::: misses
- [any] Solve for $t_r$.
:::
:::
:::

::: check
kind: parts
given: N = 100 | 400; n = 200 | 1500; w = 12 | 18; R = 10 | 100

## A coverpoint of {N} bins after {n} random tests; and a {w}-bit adder tested exhaustively at {R} million tests per second.

::: part
answer: 100*(1 - (1 - 1/N)^n)
unit: %
tolerance: 0.5%

### Coverage?

::: misses
- [any] $1 - (1 - 1/N)^n$.
:::
:::

::: part
answer: 2^(2*w)/(R*1e6)
unit: s
tolerance: 0.5%

### Exhaustive test time?

::: misses
- [any] $2^{2w}$ pairs.
:::
:::
:::

::: check
kind: parts
given: n = 20 | 36; k = 5 | 6; D = 1800 | 3500; W = 30 | 50; m = 1 | 2; let d = 1024*m; let x = 36/m

## An {n}-input AND on {k}-LUTs; and a {D} × {W} memory in {d} × {x} block RAMs.

::: part
answer: ceil((n - 1)/(k - 1) - 0.001)
tolerance: 0

### LUTs?

::: misses
- [any] $\lceil (n - 1)/(k - 1) \rceil$.
:::
:::

::: part
answer: ceil(D/d - 0.0001)*ceil(W/x - 0.0001)
tolerance: 0

### Block RAMs?

::: misses
- [any] Round depth and width up separately.
:::
:::
:::

::: check
kind: parts
given: A = 100 | 350; D = 0.1 | 0.2; W = 7000 | 14000; N = 1 | 3; a = 5 | 9; f = 40 | 70

## A {A} mm² ASIC on {W}-dollar wafers with {D} defects/cm² and {N} million dollars of NRE, against a {f}-dollar FPGA. The ASIC's unit cost is {a} dollars.

::: part
answer: W/((pi*150^2/A - pi*300/sqrt(2*A))*exp(-D*A/100))
tolerance: 1%

### Die cost, in dollars?

::: misses
- [any] Wafer cost over good dies.
:::
:::

::: part
answer: N*1e6/(f - a)
tolerance: 0.5%

### Break-even volume?

::: misses
- [any] NRE over unit savings.
:::
:::
:::

::: check
kind: parts
given: N = 63 | 255; f = 10 | 40; c = 300 | 500; M = 4 | 5; R = 16 | 64; b = 12 | 14

## A symmetric {N}-tap FIR at {f} MHz on a {c} MHz clock; and a CIC decimator with {M} stages, R = {R}, {b}-bit input.

::: part
answer: ceil(ceil(N/2 - 0.0001)*f/c - 0.0001)
tolerance: 0

### Time-shared multipliers, using symmetry?

::: misses
- [any] $\lceil \lceil N/2 \rceil f_s/f_\text{clk} \rceil$.
:::
:::

::: part
answer: b + ceil(M*log(R)/log(2) - 0.0001)
tolerance: 0

### CIC register width?

::: misses
- [any] $B + \lceil M\log_2R \rceil$.
:::
:::
:::

::: check
kind: parts
given: F = 150000 | 500000; C = 50 | 160; P = 5000 | 20000; f = 50 | 100; Y = 0.8 | 0.9; T = 0.98 | 0.995

## Scan test of {F} flip-flops in {C} chains with {P} patterns at {f} MHz; yield {Y} and coverage {T}.

::: part
answer: P*(ceil(F/C - 0.0001) + 1)/(f*1e6)
unit: s
tolerance: 0.5%

### Test time?

::: misses
- [any] $P(\lceil F/C \rceil + 1)/f$.
:::
:::

::: part
answer: 1e6*(1 - Y^(1 - T))
unit: ppm
tolerance: 0.5%

### Defect level?

::: misses
- [any] $1 - Y^{1-T}$.
:::
:::
:::

::: check
kind: parts
given: rs2 = 5 | 13; rs1 = 1 | 9; imm = 44 | 700; l = 0.2 | 0.3; u = 0.3 | 0.5; Bf = 0.1 | 0.2; mr = 0.1 | 0.3

## The store `sw x{rs2}, {imm}(x{rs1})`, and a five-stage pipeline with forwarding running {l} loads ({u} used at once) and {Bf} branches mispredicted {mr} of the time (2-cycle penalty).

::: part
answer: floor(imm/32)*2^25 + rs2*2^20 + rs1*2^15 + 2*2^12 + (imm - 32*floor(imm/32))*2^7 + 35
base: 16
width: 8

### Encoding, in hex?

::: misses
- [any] imm[11:5], rs2, rs1, 010, imm[4:0], 0100011.
:::
:::

::: part
answer: 1 + l*u + Bf*mr*2
tolerance: 0.5%

### CPI?

::: misses
- [any] $1 + f_Lu + f_BmP$.
:::
:::
:::

::: check
kind: parts
given: S = 32 | 256; W = 4 | 16; A = 32 | 48; h = 1 | 4; q = 0.02 | 0.1; L = 40 | 200

## A {S} KB, {W}-way cache with 64-byte lines and {A}-bit addresses, hitting in {h} cycles; misses ({q}) wait {L} cycles and move the line over a 16-byte bus.

::: part
answer: A - log(S*1024/W)/log(2)
tolerance: 0.4

### Tag bits?

::: misses
- [any] A − log₂(bytes per way).
:::
:::

::: part
answer: h + q*(L + 4)
tolerance: 0.5%

### AMAT, in cycles?

::: misses
- [any] Hit plus miss rate times (latency + 64/16).
:::
:::
:::

::: check
kind: parts
given: f = 20 | 25; N = 80 | 128; M = 1 | 2; P = 2 | 4; I = 50 | 120; R = 3 | 9; T = 900 | 1200; e = 0.92 | 0.95; l = 1.05 | 1.08; Lc = 350 | 420; Dd = 500 | 650; Cc = 330 | 400

## A PLL ({f} MHz reference, N = {N}, M = {M}, P = {P}); a {R} Ω rail carrying {I} mA spread along it, fed from both ends; and a path with a {T} ps clock, launch clock {Lc} ps, data {Dd} ps, capture clock {Cc} ps, 25 ps setup, derates {l} and {e}.

::: part
answer: f*N/(M*P)
unit: MHz
tolerance: 0.5%

### PLL output?

::: misses
- [any] $fN/(MP)$.
:::
:::

::: part
answer: I*R/8
unit: mV
tolerance: 0.5%

### Worst IR drop?

::: misses
- [any] $IR/8$.
:::
:::

::: part
answer: T + e*Cc - l*(Lc + Dd) - 25
unit: ps
tolerance: 0.5%

### OCV setup slack?

::: misses
- [any] Capture early, launch late.
:::
:::
:::

::: check
kind: parts
given: p = 11 | 24 | 53; e = -10 | 0 | 20

## A floating-point format has a {p}-bit significand; x lies between $2^e$ and $2^{e+1}$, with e = {e}.

::: part
answer: 2^(e - p + 1)
tolerance: 0.5%

### What is the ULP at x?

::: misses
- [any] $2^{e - p + 1}$.
:::
:::

::: part
answer: 2^(e - p)
tolerance: 0.5%

### What is the largest rounding error there, rounding to nearest?

::: misses
- [any] Half an ULP.
:::
:::
:::

::: check
kind: parts
given: N = 512 | 4096; I = 1 | 2 | 3; D = 6 | 10; U = 4 | 8

## An HLS loop of {N} iterations is {D} cycles deep and reaches II = {I}; unrolled by {U} with partitioned arrays it reaches II = 1.

::: part
answer: (N - 1)*I + D
unit: cycles
tolerance: 0

### How many cycles does the rolled loop take?

::: misses
- [any] $(N - 1)\text{II} + D$.
:::
:::

::: part
answer: N/U - 1 + D
unit: cycles
tolerance: 0

### And the unrolled one?

::: misses
- [any] $N/U - 1 + D$.
:::
:::
:::

::: check
kind: parts
given: m = 32 | 64 | 128; b = 2 | 4 | 6

## An SRAM stores {m}-bit words with SECDED; strikes flip up to {b} adjacent cells.

::: part
answer: m + ceil(log(m + 1 + ceil(log(m + 1)/log(2)))/log(2)) + 1
unit: bits
tolerance: 0

### How wide is each stored word?

::: misses
- [any] Data + Hamming + parity.
:::
:::

::: part
answer: b
tolerance: 0

### What interleaving keeps every word correctable?

::: misses
- [any] At least one word per cell in the burst.
:::
:::
:::
:::
