C727 of 57
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

C7 · Lesson 27 · Timing of sequential circuits

Setup, hold, clock skew, metastability and pipelining

A synchronous circuit works only if every signal leaving one flip-flop reaches the next in time for the following clock edge, and not so quickly that it disturbs the value being captured on the current one. Those two conditions, setup and hold, decide a chip's top clock speed and whether it works at all. Signals that arrive from outside, unsynchronized to the clock, add a third problem: a flip-flop caught mid-change can hang between 0 and 1. And when the logic between registers is too slow, the cure is to cut it into stages: pipelining.

  • One register feeds two paths to two more registers: N1 inverts it after 3 ticks, N2 after 12. The clock period is 8 ticks.
  • R1 always captures the new value of N1. N2 hasn't settled when the next edge arrives, so R2 captures a stale value: the slow path violates setup.
  • A slow path can be fixed by a slower clock, a faster circuit, or by adding a register in the middle of it.

Predict

A flip-flop's clock-to-Q delay is 50 ps, the logic after it takes 600 ps, and the next flip-flop needs 40 ps of setup. What is the highest clock frequency?

Name it

Setup

From one clock edge, data leaves a flip-flop after at most tpcq (clock-to-Q), passes logic of at most tpd, and must arrive tsetup before the next edge:

Tc≥tpcq+tpd+tsetupfmax=1/Tc

The slowest such path is the critical path. A setup violation can always be fixed by slowing the clock.

Hold

The new data must not reach the next flip-flop so soon that it corrupts what that flip-flop is capturing on the same edge. With the shortest delays, tccq (contamination clock-to-Q) and tcd (contamination logic delay):

tccq+tcd≥thold

This doesn't involve the clock period, so slowing the clock can't fix it: the fix is adding delay (buffers) to the short path.

Clock skew

If the receiving flip-flop's clock arrives late by up to tskew, the setup constraint gets easier only if skew is known; in the worst case both tighten: Tc≥tpcq+tpd+tsetup+tskew and tccq+tcd≥thold+tskew.

Metastability and synchronizers

An input that changes asynchronously can violate setup, leaving a flip-flop between 0 and 1 for an unbounded (but exponentially unlikely) time. The probability that it's still unresolved after time t is about T0Tce−t/τ, with τ and T0 properties of the flip-flop. A synchronizer, two flip-flops in series, gives the first nearly a whole period to resolve, so for N asynchronous changes per second

MTBF=TcNT0e(Tc−tsetup)/τ

Pipelining

Splitting logic of total delay tlogic into k stages with registers between them gives Tc=tlogic/k+toverhead (the tpcq+tsetup of each register): throughput rises almost k-fold, but each result's latency grows to kTc.

Worked example

A synchronizer runs at 100 MHz with tsetup = 0.1 ns; its flip-flops have τ = 0.2 ns and T0 = 0.15 ns, and the input changes 10⁶ times a second. Find its MTBF.

Show the solution
  1. The prefactor. TcNT0=10ns106×0.15ns=6.7×10−5s
  2. The exponential. The flip-flop has the period less the setup time, 9.9 ns, to resolve: e9.9/0.2=e49.5
  3. MTBF. MTBF=6.7×10−5s×e49.5≈2×1017s billions of years.
  4. With half a period. With only half a period to resolve it would be about 3×106 s, a failure every month: the exponential makes every extra picosecond count.

Answer about 2×1017 s, billions of years.

Worked example

Logic taking 9 ns sits between registers with 1 ns of overhead. Compare 1, 3 and 9 pipeline stages.

Show the solution
  1. One stage. 9+1=10ns 100 MHz, with a latency of 10 ns.
  2. Three stages. 3+1=4ns 250 MHz, with a latency of 12 ns.
  3. Nine stages. 1+1=2ns 500 MHz, with a latency of 18 ns.
  4. Compare. Throughput rises with depth, but the overhead stops it reaching 900 MHz, and latency grows.

Answer 100 MHz, 250 MHz and 500 MHz, with latencies of 10 ns, 12 ns and 18 ns.

Worked example

Registers with tpcq = 0.1 ns, tccq = 0.05 ns, setup 0.05 ns and hold 0.03 ns surround logic with tpd = 0.8 ns and tcd = 0.1 ns. The capture clock arrives 0.2 ns late. Check setup and hold.

Show the solution
  1. Check setup. Skew that delays the capture clock gives the data extra time: Tc≥0.1+0.8+0.05−0.2=0.75ns a gain.
  2. Check hold. Hold gets worse by the same amount, since the new data must not arrive before the late edge's hold window closes: tccq+tcd=0.15nsthold+tskew=0.23ns a violation by 0.08 ns.
  3. The fix. No clock frequency fixes it; delay buffers in the short path do.
  4. The trade. Skew helps one constraint exactly as much as it hurts the other.

Answer setup passes for any Tc≥0.75 ns, but hold fails by 0.08 ns.

Check

A path has tpcq = 30 ps, logic of 200 ps and tsetup = 60 ps. What is the highest clock frequency?

Write units the way you normally would: 1.5 GHz, 1500 MHz and 0.0015 THz are the same answer.

Check

With up to 50 ps of clock skew, what is the shortest period for that path (tpcq = 30, tpd = 200, tsetup = 60 ps)?

Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.

Check

A short path has tccq = 20 ps and tcd = 0 ps; the next flip-flop needs thold = 50 ps, with up to 20 ps of skew. What is the hold margin (negative means a violation)?

Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.

Check

A synchronizer clocked at 50 MHz (tsetup = 0.05 ns, τ = 0.3 ns, T0 = 1 ns) samples an input changing 0.1 million times a second. What is log10⁡ of its MTBF in seconds?

Write units the way you normally would: 1.5 s and 1500 ms are the same answer.

Check

Logic of 12 ns is split into 2 equal pipeline stages, with 1 ns of register overhead each. What clock frequency results?

Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.

Check

What is the latency through that pipeline (12 ns of logic, 2 stages, 1 ns overhead)?

Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.

Check

Static timing analysis reports a hold violation. Which fix works?

Check

Registers (tpcq = 0.05, tccq = 0.03, setup 0.04, hold 0.02 ns) surround logic with tpd = 1.5 ns and tcd = 0.2 ns; the capture clock arrives 0.05 ns late.

(a)

What's the minimum clock period?

Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.

(b)

What's the hold slack (negative means a violation)?

Check

A two-flop synchronizer is clocked with period T; its flip-flops have τ = t and T0 = u, setup w, and the input changes N times a second.

Step 1

What's its mean time between failures?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why can't a hold violation be fixed by slowing the clock?

Practice

Keep practicing

10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.