---
title: Problem set 6
heading: "Problem set 6: sequential circuits and timing"
eyebrow: C7 · Problem set 6
type: problems
---

::: hook
These problems use lessons 26 to 32: latches and flip-flops, the timing of sequential circuits, registers, counters and clocks, PWM and sigma-delta outputs, and shift registers, LFSRs and CRCs.
:::

::: pool
pick: 12

::: check
kind: parts
given: tpcq = 40 | 90; tpd = 300 | 1200; ts = 30 | 70; sk = 0 | 40

## A register-to-register path has $t_{pcq}$ = {tpcq} ps, logic of {tpd} ps, $t_\text{setup}$ = {ts} ps and up to {sk} ps of clock skew.

::: part
answer: tpcq + tpd + ts + sk
unit: ps
tolerance: 0.5%

### What is the shortest safe clock period?

::: misses
- [any] $t_{pcq} + t_{pd} + t_\text{setup} + t_\text{skew}$.
:::
:::

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

### What is the highest clock frequency?

::: misses
- [any] One over the period.
:::
:::
:::

::: check
kind: parts
given: tccq = 15 | 35; tcd = 0 | 25 | 70; th = 20 | 45; sk = 0 | 30

## A short path has $t_{ccq}$ = {tccq} ps and $t_{cd}$ = {tcd} ps, into a flip-flop with $t_\text{hold}$ = {th} ps, with up to {sk} ps of skew.

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

### What is the hold margin?

::: misses
- [any] $t_{ccq} + t_{cd} - t_\text{hold} - t_\text{skew}$.
:::
:::

::: part
answer: (th + sk - tccq - tcd)*step(th + sk - tccq - tcd)
unit: ps
tolerance: 0.5%

### How much delay must be added to the path (0 if none)?

::: misses
- [any] Enough to bring the margin to zero.
:::
:::
:::

::: check
kind: parts
given: f = 100 | 500; ts = 0.05 | 0.1; tau = 0.05 | 0.2; T0 = 0.1 | 0.5; N = 1 | 100

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

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

### How many time constants does the first flip-flop get to resolve?

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

::: 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] MTBF = $\frac{T_c}{NT_0}e^{(T_c - t_\text{setup})/\tau}$.
:::
:::
:::

::: check
kind: parts
given: t = 8 | 15; k = 3 | 5; o = 0.4 | 1

## Logic of {t} ns is pipelined into {k} equal stages with {o} ns of register overhead each.

::: part
answer: 1e3/(t/k + o)
unit: MHz
tolerance: 0.5%

### What clock rate does it reach?

::: misses
- [any] $1/(t/k + t_\text{overhead})$.
:::
:::

::: part
answer: k*(t/k + o)
unit: ns
tolerance: 0.5%

### What is its latency?

::: misses
- [any] k periods.
:::
:::
:::

::: check
kind: parts
given: N = 6 | 10 | 60 | 1000; f = 1 | 50

## A counter must divide a {f} MHz clock by {N}.

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

### How many flip-flops does a binary modulo-{N} counter need?

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

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

### What frequency does it produce?

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

::: check
kind: parts
given: f = 1 | 16 | 50; k = 0 | 3 | 7

## A free-running binary counter is clocked at {f} MHz.

::: part
answer: f*1000/2^(k + 1)
unit: kHz
tolerance: 0.5%

### At what frequency does bit {k} toggle (a full on-off cycle)?

::: misses
- [any] Bit k divides the clock by $2^{k+1}$.
:::
:::

::: part
answer: 2^(k + 1)
tolerance: 0

### How many clocks long is one cycle of bit {k}?

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

::: check
kind: parts
given: w = 4 | 8; d = 2 | 5; n = 7 | 40; let s = 2^w - d

## A {w}-bit counter starts at {s} and counts up once per clock.

::: part
answer: s + n - 2^w*floor((s + n)/2^w)
tolerance: 0

### What does it hold after {n} clocks?

::: misses
- [any] Add and wrap modulo $2^w$.
:::
:::

::: part
answer: d
tolerance: 0

### After how many clocks does it first wrap to 0?

::: misses
- [any] It wraps when it would reach $2^w$.
:::
:::
:::

::: check
kind: parts
given: n = 5 | 10 | 20

## Compare shift-register counters with {n} flip-flops.

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

### How many states does a maximal-length LFSR have?

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

::: part
answer: 2*n
tolerance: 0

### How many does a Johnson counter have?

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

::: check
kind: parts
given: rate = 9600 | 115200; bits = 10 | 11; L = 64 | 1500

## A serial link sends {bits} bit times per byte at {rate} bits per second.

::: part
answer: rate/bits
tolerance: 0.5%

### How many bytes per second?

::: misses
- [any] Rate over bits per byte.
:::
:::

::: part
answer: L*bits/rate*1000
unit: ms
tolerance: 0.5%

### How long does a {L}-byte message take?

::: misses
- [any] Bytes times bit times, over the rate.
:::
:::
:::

::: check
given: s = 4 | 6 | 9 | 11; let b3 = floor(s/8) - 2*floor(s/16); let b2 = floor(s/4) - 2*floor(s/8)
answer: 2*s - 16*floor(2*s/16) + abs(b3 - b2)
tolerance: 0

## A 4-bit LFSR shifts left, dropping bit 3, and puts $Q_3 \oplus Q_2$ into bit 0. From state {s} (decimal), what is the next state?

::: misses
- [any] Shift within four bits, then add the feedback bit.
:::
:::

::: check
answer: 7
base: 2
width: 3

## What is the 3-bit CRC of the message 110101 with generator 1011?

::: misses
- [any] Append 000 and divide by 1011 with XOR.
:::
:::

::: check
kind: parts
given: M = 8 | 12 | 20

## A sequencer needs {M} states decoded with no logic.

::: part
answer: M
tolerance: 0

### How many flip-flops does a ring counter use?

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

::: part
answer: M/2
tolerance: 0

### How many does a Johnson counter use (each state decoded by a two-input gate)?

::: misses
- [any] A Johnson counter has 2n states.
:::
:::
:::

::: check
kind: parts
given: n = 3 | 5 | 8; f = 16 | 48

## An n-bit register with n = {n} on a {f} MHz clock.

::: part
answer: 2*n
tolerance: 0

### How many states as a Johnson counter?

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

::: part
answer: n
tolerance: 0

### As a ring counter (one 1 circulating)?

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

::: check
kind: parts
given: n = 6 | 10 | 20

## A maximal-length LFSR has n = {n} bits.

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

### What's its period?

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

::: part
answer: 1
tolerance: 0

### How many states does it never visit?

::: misses
- [any] Only the all-zero state.
:::
:::
:::

::: check
kind: parts
given: Y = 0.6 | 0.85; FC = 0.9 | 0.99

## A chip yields {Y} and is tested with {FC} coverage.

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

### What defect level ships?

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

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

### And without any test?

::: misses
- [any] $1 - Y$.
:::
:::
:::

::: check
kind: parts
given: f = 16 | 48; N = 8 | 10; RC = 1 | 4; V = 3.3 | 5

## An {N}-bit PWM on a {f} MHz clock drives a {V} V output into an RC filter with $RC$ = {RC} ms.

::: part
answer: f*1e3/2^N
unit: kHz
tolerance: 0.5%

### What's its frequency?

::: misses
- [f*1e3/N] There are $2^N$ counts per period.
- [any] Not yet. $f_{clk}/2^N$.
:::
:::

::: part
answer: V*0.25*2^N/(f*1e6)/(RC*1e-3)*1e3
unit: mV
tolerance: 1%

### What's the worst-case peak-to-peak ripple, in mV?

::: misses
- [V*2^N/(f*1e6)/(RC*1e-3)*1e3] The worst case is $D(1 - D) = \tfrac14$.
- [any] Not yet. $\Delta V = VD(1 - D)T/RC$ at $D$ = ½.
:::
:::

::: right
Right. Compare it with one step, $V/2^N$, to see whether the filter is slow enough.
:::
:::
:::
