---
title: Midterm exam
heading: "Midterm exam: RTL, datapaths, timing and power"
eyebrow: S3 · Midterm exam
type: problems
---

::: hook
Twelve problems from lessons 1 to 20: RTL and state machines, datapath arithmetic and number formats, memories and FIFOs, static timing and latches, logical effort, wires and power. Give yourself two and a half hours and work without the lessons open. Dadda heights: 2, 3, 4, 6, 9, 13, 19, 28, 42. "Another set" deals a different exam.
:::

::: pool
pick: 12

::: check
kind: parts
given: N = 9 | 22; c = 40 | 60; n = 8 | 20; g = 20 | 35; s = 20 | 40

## An {N}-state controller whose worst path is {n} gates of {g} ps, with {c} ps clock-to-Q and {s} ps setup.

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

### Binary state flip-flops?

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

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

### Unused codes?

::: misses
- [any] $2^b - N$.
:::
:::

::: part
answer: 1/((c + n*g + s)*1e-12)/1e9
unit: GHz
tolerance: 1%

### Maximum clock?

::: misses
- [any] $1/(t_{cq} + t_\text{logic} + t_\text{setup})$.
:::
:::
:::

::: check
kind: parts
given: N = 12 | 40; g = 25 | 35; L = 5 | 9

## Selecting one of {N} inputs ({g} ps per mux level), and a Moore detector for an {L}-bit pattern.

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

### Extra delay of a priority chain over a balanced tree?

::: misses
- [any] $(N - 1 - \lceil\log_2N\rceil)g$.
:::
:::

::: part
answer: L + 1
tolerance: 0

### Detector states?

::: misses
- [any] L + 1.
:::
:::
:::

::: check
kind: parts
given: f = 20 | 100; t = 1.7 | 47; n = 11 | 19

## A {f} MHz clock divided down to a {t} kHz tick, and an {n}-bit LFSR.

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

### Divider bits?

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

::: part
answer: 2^n - 1
tolerance: 0

### LFSR period?

::: misses
- [any] $2^n - 1$.
:::
:::
:::

::: check
kind: parts
given: N = 32 | 64; t = 20 | 30

## An {N}-bit adder at {t} ps per level.

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

### How much faster is Kogge–Stone (prefix levels + 2) than ripple?

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

::: part
answer: N*log(N)/log(2) - N + 1 - (2*N - 2 - log(N)/log(2))
tolerance: 0.4

### How many more prefix cells does Kogge–Stone use than Brent–Kung?

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

::: check
kind: parts
given: M = 16 | 32; s = 8 | 6; b = 53 | 24

## A {M} × {M} multiplier with Booth recoding, and a Newton–Raphson divider from an {s}-bit seed to {b} bits.

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

### Dadda stages after Booth (M/2 rows)?

::: misses
- [any] Count heights below M/2.
:::
:::

::: part
answer: ceil(log(b/s)/log(2) - 0.0001)
tolerance: 0

### Iterations?

::: misses
- [any] Doublings.
:::
:::
:::

::: check
kind: parts
given: m = 1 | 2; n = 15 | 23; K = 30 | 128

## Q{m}.{n} samples and coefficients, accumulated over {K} terms.

::: part
answer: 2*(m + n)
tolerance: 0

### Product width?

::: misses
- [any] Twice the format width.
:::
:::

::: part
answer: 2*(m + n) + ceil(log(K - 0.5)/log(2))
tolerance: 0

### Accumulator width?

::: misses
- [any] Plus $\lceil\log_2K\rceil$ guard bits.
:::
:::
:::

::: check
kind: parts
given: e = 126 | 140; f = 0.375 | 0.875

## An IEEE single: exponent field {e}, fraction {f}.

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

### Value?

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

::: part
answer: 2^(e - 150)
tolerance: 0.0001%

### ULP?

::: misses
- [any] $2^{e - 150}$.
:::
:::
:::

::: check
kind: parts
given: B = 200 | 800; w = 100 | 250; r = 40 | 90; D = 600 | 9000

## A burst of {B} words at {w} MHz into a FIFO read at {r} MHz; and a {D}-word memory.

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

### FIFO depth?

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

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

### Memory address bits?

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

::: check
kind: parts
given: T = 900 | 1400; c = 45 | 60; L = 700 | 1100; s = 25 | 35; m = 20 | 70; h = 20 | 30; k = -30 | 50

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

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

### Setup slack?

::: misses
- [any] Required minus arrival.
:::
:::

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

### Hold slack?

::: misses
- [any] Earliest arrival minus hold plus skew.
:::
:::
:::

::: check
kind: parts
given: G = 1.5 | 3; H = 50 | 400; P = 5 | 8

## A path with logical effort {G}, no branching, electrical effort {H}, parasitic delay {P}.

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

### Best stage count?

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

::: part
answer: 3*(G*H)^(1/3) + P
tolerance: 1%

### Delay with 3 stages?

::: misses
- [any] $3F^{1/3} + P$.
:::
:::
:::

::: check
kind: parts
given: r = 0.3 | 1; L = 1.5 | 5; d = 2 | 4

## A {L} mm wire at {r} Ω/µm and 0.2 fF/µm.

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

### Distributed delay?

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

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

### Wire delay alone if split into {d} equal segments by ideal repeaters?

::: misses
- [any] d segments of length L/d.
:::
:::
:::

::: check
kind: parts
given: a = 0.1 | 0.2; C = 1 | 4; V = 0.7 | 0.9; f = 1 | 2; v = 0.6 | 0.75; p = 0.5 | 0.7

## A block switching {C} nF at activity {a}, {V} V, {f} GHz.

::: part
answer: a*C*1e-9*V^2*f*1e9
unit: W
tolerance: 1%

### Dynamic power?

::: misses
- [any] $\alpha CV^2f$.
:::
:::

::: part
answer: a*C*1e-9*v^2*p*f*1e9
unit: W
tolerance: 1%

### After DVFS to {v} V at {p} of the clock?

::: misses
- [any] Scale by $V^2f$.
:::
:::
:::

::: check
kind: parts
given: a = 2 | 6; b = 1 | 4; c = 3 | 8

## Registers a = {a}, b = {b}, c = {c}.

::: part
answer: b
tolerance: 0

### a after `a <= b; b <= c; c <= a;`?

::: misses
- [any] Old b.
:::
:::

::: part
answer: c
tolerance: 0

### a after the blocking `a = b; b = c; a = b;`?

::: misses
- [any] Run in order: b becomes c, then a copies it.
:::
:::
:::

::: check
kind: parts
given: N = 8 | 16; a = 90 | 120; b = 30 | 60

## An {N}-bit two's complement adder with saturation adds {a} and {b}.

::: part
answer: 2^(N - 1) - 1
tolerance: 0

### Largest representable value?

::: misses
- [any] $2^{N-1} - 1$.
:::
:::

::: part
answer: (a + b + 2^(N - 1) - 1 - abs(a + b - 2^(N - 1) + 1))/2
tolerance: 0.4

### Saturated result?

::: misses
- [any] The smaller of the sum and the limit.
:::
:::
:::

::: check
kind: parts
given: n = 3 | 4; h = 2 | 5

## An {n}-input NOR and an {n}-input NAND, each with electrical effort {h}.

::: part
answer: (2*n + 1)/3*h + n - ((n + 2)/3*h + n)
tolerance: 1%

### How much slower is the NOR, in τ?

::: misses
- [any] Difference of the effort delays.
:::
:::

::: part
answer: (2*n + 1)/(n + 2)
tolerance: 1%

### Ratio of their logical efforts?

::: misses
- [any] $\frac{2n + 1}{n + 2}$.
:::
:::
:::

::: check
kind: parts
given: a = 0.7 | 1.0; b = 0.2 | 0.4; d = 40 | 60; q = 130 | 180

## A design's logic splits into blocks of {a} and {b} ns. A two-phase latch version uses latches with {d} ps from D to Q; a flip-flop version puts each block in its own stage, with {q} ps of clock-to-Q plus setup.

::: part
answer: a + b + 2*d/1000
unit: ns
tolerance: 0.5%

### What period does the latch version need?

::: misses
- [any] $t_1 + t_2 + 2t_{DQ}$.
:::
:::

::: part
answer: 2*(a + q/1000)
unit: ns
tolerance: 0.5%

### How long do the two flip-flop stages take together, at a period set by the slower one?

::: misses
- [any] Two periods of $t_\text{slow} + $ overhead.
:::
:::
:::
:::
