---
title: Final exam
heading: "Final exam: digital logic"
eyebrow: C7 · Final exam
type: problems
---

::: hook
Twelve problems from the whole course: logic levels and number systems, Boolean algebra and minimization, CMOS gates, building blocks and arithmetic, number formats, flip-flops and timing, counters and shift registers, state machines, memories and FPGAs, Verilog and CRCs. Give yourself three hours, work without the lessons open, and write out your reasoning before checking each answer. Number truth-table rows from 0, with the first-listed input as the top bit. "Another set" deals a different exam.
:::

::: pool
pick: 12

::: check
kind: parts
given: VOH = 2.4 | 3; VDD = 3.3 | 5; n = 130..250 int

## A {VOH} V output drives a CMOS input on {VDD} V ($V_{IH} = 0.7V_{DD}$); separately, a register holds {n:bin8}.

::: part
answer: VOH - 0.7*VDD
unit: V
tolerance: 0.5%

### What is the high noise margin?

::: misses
- [any] $V_{OH} - 0.7V_{DD}$.
:::
:::

::: part
answer: n - 256
tolerance: 0

### What is the register's two's-complement value?

::: misses
- [any] Subtract 256.
:::
:::
:::

::: check
kind: boolean
vars: A, B, C, D
answer: ~A & ~C | A & C
ops: and, or, not

## Minimize $\sum m(0, 1, 4, 5, 10, 11, 14, 15)$.

::: misses
- [any] Two blocks of four.
:::
:::

::: check
kind: boolean
vars: A, B, C, D
answer: C & D | ~A & ~B
dontcare: 0, 2, 5
ops: and, or, not

## Minimize $\sum m(1, 3, 7, 11, 15) + d(0, 2, 5)$.

::: misses
- [any] The column CD = 11 first.
:::
:::

::: check
kind: boolean
vars: A, B, C
answer: (A | ~B) & (~A | C)
ops: and, or, not

## Write a function equal to $\prod M(2, 3, 4, 6)$.

::: misses
- [any] Group the 0s, or write the maxterms and simplify.
:::
:::

::: check
kind: parts
given: n = 2 | 4; r = 2 | 3; a = 0.1 | 0.2; N = 1 | 50; C = 1 | 5; V = 0.8 | 1.1; f = 1 | 4

## A chip's gates are {n}-input NANDs, sized to match an inverter of NMOS width 1 and PMOS width {r}. It has {N} million such nodes of {C} fF switching with α = {a} at {f} GHz on {V} V.

::: part
answer: n
tolerance: 0

### How wide is each NMOS?

::: misses
- [any] n in series.
:::
:::

::: part
answer: a*N*1e6*C*1e-15*V^2*f*1e9
unit: W
tolerance: 0.5%

### What dynamic power do the nodes take?

::: misses
- [any] $\alpha CV^2f$ per node, times the count.
:::
:::
:::

::: check
kind: boolean
vars: I3, I2, I1, I0
answer: I3 | ~I2 & I1
ops: and, or, not

## Write the low output bit $Y_0$ of a 4-input priority encoder ($I_3$ highest).

::: misses
- [any] The winner is 3 or 1.
:::
:::

::: check
given: a = 10 | 33 | 70; b = 45 | 99 | 127
answer: a - b + 256*step(b - a)
base: 2
width: 8

## Compute {a} − {b} in 8-bit two's complement; give the 8 bits.

::: misses
- [any] Invert, add 1, add.
:::
:::

::: check
kind: parts
given: n = 16 | 64; tc = 2 | 3; e = 126 | 130; f = 0.5 | 0.75

## Arithmetic and formats.

::: part
answer: n*tc
tolerance: 0

### What is an {n}-bit ripple adder's worst carry delay, at {tc} gate delays per bit?

::: misses
- [any] n stages.
:::
:::

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

### What value is an IEEE single with sign 0, exponent field {e} and fraction {f}?

::: misses
- [any] $1.f \times 2^{e - 127}$.
:::
:::
:::

::: check
kind: parts
given: tpcq = 40 | 70; tpd = 250 | 800; ts = 25 | 50; sk = 0 | 30; tccq = 15 | 30; tcd = 0 | 30; th = 20 | 40

## A path has $t_{pcq}$ = {tpcq}, $t_{pd}$ = {tpd}, $t_\text{setup}$ = {ts}, skew up to {sk}, $t_{ccq}$ = {tccq}, $t_{cd}$ = {tcd} and $t_\text{hold}$ = {th} (all ps).

::: part
answer: 1e3/(tpcq + tpd + ts + sk)
unit: GHz
tolerance: 0.5%

### What is the highest clock frequency?

::: misses
- [any] Period covers clock-to-Q, logic, setup and skew.
:::
:::

::: part
answer: tccq + tcd - th - sk
unit: ps
tolerance: 0.5%

### What is the hold margin?

::: misses
- [any] Short path minus hold and skew.
:::
:::
:::

::: check
kind: parts
given: f = 100 | 400; ts = 0.05 | 0.1; tau = 0.05 | 0.15; T0 = 0.1 | 0.4; N = 1 | 10

## A two-flip-flop synchronizer at {f} MHz ($t_\text{setup}$ = {ts} ns, τ = {tau} ns, $T_0$ = {T0} ns) sees {N} million input changes a second.

::: part
answer: log(1e3/f/(N*1e6*T0)*exp((1e3/f - ts)/tau))
unit: s
tolerance: 0.5%

### What is $\log_{10}$ of its MTBF in seconds?

::: misses
- [any] $\frac{T_c}{NT_0}e^{(T_c - t_\text{setup})/\tau}$.
:::
:::

::: part
answer: (1e3/f - ts)/tau
tolerance: 0.5%

### How many time constants does it allow?

::: misses
- [any] $(T_c - t_\text{setup})/\tau$.
:::
:::
:::

::: check
kind: parts
given: n = 7 | 16; N = 6 | 50; f = 10 | 100

## Counters and shift registers on a {f} MHz clock.

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

### How many states does a maximal {n}-bit LFSR have?

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

::: part
answer: f*1000/N
unit: kHz
tolerance: 0.5%

### What does a modulo-{N} counter put out?

::: misses
- [any] $f/N$.
:::
:::
:::

::: check
kind: boolean
vars: Q1, Q0, X
answer: Q0 & ~X | Q1 & ~Q0 & X
ops: and, or, not

## A Moore 101 detector codes S0 = 00, S1 = 01, S2 = 10, S3 = 11. Write $Q_1^+$.

::: misses
- [any] Transitions into S2 and S3.
:::
:::

::: check
kind: parts
given: Wt = 256 | 1024; mt = 32 | 64; Wc = 64 | 128; mc = 8 | 16; k = 4 | 6

## A {Wt}K × {mt} memory is built from {Wc}K × {mc} chips; an FPGA beside it has {k}-input LUTs.

::: part
answer: Wt/Wc*mt/mc
tolerance: 0

### How many memory chips?

::: misses
- [any] Depth ratio × width ratio.
:::
:::

::: part
answer: 2^k
tolerance: 0

### How many bits configure one LUT?

::: misses
- [any] $2^k$.
:::
:::
:::

::: check
kind: parts
given: a = 2 | 6 | 11; b = 3 | 8

## Registers a = {a} and b = {b} run one clock of `a <= a + b; b <= a;`.

::: part
answer: a + b
tolerance: 0

### What is a afterward?

::: misses
- [any] Nonblocking: both right sides use the old values.
:::
:::

::: part
answer: a
tolerance: 0

### What is b afterward?

::: misses
- [any] b takes a's old value.
:::
:::
:::

::: check
kind: parts
given: n = 8 | 16 | 32; L = 100 | 9000

## A protocol appends an {n}-bit CRC to {L}-byte messages.

::: part
answer: -n*log(2)/log(10)
tolerance: 0.5%

### What is $\log_{10}$ of the chance a random corruption goes undetected?

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

::: part
answer: L
tolerance: 0

### How many table lookups does a byte-wide CRC take per message?

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

::: check
kind: parts
given: N = 5 | 11 | 30; n = 4 | 6

## A state machine has {N} states; its sequence detector variant must find an {n}-bit pattern.

::: part
answer: ceil(log(N)/log(2))
tolerance: 0.5%

### How many flip-flops for a binary encoding of {N} states?

::: misses
- [any] $\lceil\log_2 N\rceil$.
:::
:::

::: part
answer: n + 1
tolerance: 0

### How many states for a Moore detector of the {n}-bit pattern?

::: misses
- [any] One per matched prefix.
:::
:::
:::
:::
