C7 · Lesson 34 · Timing lab
Slack, pipelining, synchronizers and timing yield, in Python
A design that works in simulation can still fail in silicon because a path is too slow, a hold check is violated, a synchronizer is too short, or the manufactured gates come out slower than the typical ones. Timing engineers answer all four with arithmetic on delays. In this lab you'll compute setup and hold slack with clock skew, cut a chain of logic into the best pipeline stages, size a synchronizer, and estimate how many chips meet a clock target when every gate's delay varies.
Play
- The curves are a pipeline's throughput and latency against its number of stages, for a fixed amount of logic plus a fixed overhead per stage.
- Throughput rises with depth but levels off: each stage pays the register overhead again.
- Latency only grows. Find the depth where adding a stage buys little throughput for a lot of latency.
Predict
A path's delay is the sum of ten stages, each 0.95 ns on average with a standard deviation of 0.1 ns, independent. What fraction of chips meet a 10 ns clock?
About 94%. The sum's mean is 9.5 ns and its standard deviation is = 0.32 ns, so 10 ns is 1.58 standard deviations above the mean: = 0.943. The 6% that fail must be sold at a lower clock or discarded, which is why designers add margin and why chips are speed-binned.
Name it
Slack
For a path between registers with clock period T and skew s (positive when the capture clock is late):
Negative setup slack means the clock must slow down; negative hold slack can't be fixed by the clock at all.
Pipelining
Logic of total delay L split into k stages, each paying overhead o: the period is if the split is even, the throughput its reciprocal, and the latency . Real logic comes in pieces that can't be cut anywhere, and the best split into k stages minimizes the largest stage's delay. Bisection on that maximum, checking whether a greedy pass fits the pieces into k stages, finds it.
Synchronizers
with the resolution time: a clock period less setup, per extra stage.
Timing yield
If a path is the sum of n independent stage delays with mean μ and standard deviation σ, its delay is approximately normal with mean nμ and standard deviation , and the fraction of chips meeting period T is .
Worked example
Split logic blocks of 3, 1, 4, 1, 5, 9, 2 and 6 ns, in order, into three pipeline stages for the fastest clock.
Show the solution
- Lower bounds. The 9 ns block alone sets a lower bound, and the total is 31 ns, so a stage must hold at least
- Bisect on the stage limit. Packing blocks greedily, 13 ns doesn't fit in three stages, and 14 ns does, for example as 3 + 1 + 4 + 1 + 5 = 14, then 9 + 2 = 11, then 6.
- The clock. The best clock period is 14 ns plus the register overhead: the uneven blocks cost 3.7 ns against an ideal split.
Answer 3 + 1 + 4 + 1 + 5, then 9 + 2, then 6, for a 14 ns period plus the register overhead.
Worked example
A 1 GHz path has = 80 ps, 750 ps of logic and 40 ps of setup; its shortest path has = 50 ps and 30 ps of logic, against 60 ps of hold. The capture clock is 100 ps late. Find both slacks.
Show the solution
- Setup slack. comfortable.
- Hold slack. a violation.
- The skew. The skew that helped setup by 100 ps hurt hold by the same amount.
- The fix. About 80 ps of delay buffers in the short path, which leaves setup at 230 ps since the long path is a different path.
Answer the setup slack is 230 ps and the hold slack −80 ps, a violation.
Worked example
Ten stages of 0.95 ns mean and 0.1 ns standard deviation must meet a 10 ns clock. What's the timing yield, and what clock gives 99.9%?
Show the solution
- Timing yield.
- Clock for 99.9%. The clock must sit 3.09 standard deviations above the mean:
- Long paths. Independent variations average out along a path, so long paths have relatively less spread than short ones.
- Die-wide variation. Correlated variation, such as a whole die running slow, doesn't average out, and needs separate margin.
Answer the timing yield is 94.3%, and a 10.48 ns clock gives 99.9%.
Check
Step 1. Write slacks(T, skew, tpcq, tpd, tsu, tccq, tcd, thold) returning (setup_slack, hold_slack).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 2. Write best_split(delays, k) returning the smallest possible maximum stage delay when the list of block delays is cut, in order, into at most k contiguous stages. Use bisection on the maximum with a greedy feasibility check (assume whole-number delays).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 3. Write pipeline(L, k, o) returning (period, throughput, latency) for logic of total delay L split evenly into k stages with overhead o per stage.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 4. Write mtbf(T, tsu, tau, T0, fd, stages=2) returning a synchronizer's MTBF in seconds, where each stage after the first adds a clock period T of resolution time, less setup: = (stages − 1)(T − tsu).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 5. Write timing_yield(n, mu, sigma, T) returning the fraction of chips whose path, a sum of n independent normal stage delays, meets the period T. Use math.erf.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
A path is the sum of 16 independent stages, each 0.5 ns on average with standard deviation 0.1 ns.
(a)
What's the path delay's standard deviation?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
What period gives a yield of about 99.87%, three standard deviations of margin?
Explain why
Why does a longer path have relatively less timing variation than a short one, when its stages vary independently?
Each stage's delay is a little faster or slower than average, at random. Along a path of many stages, the fast ones and slow ones partly cancel, so the total's standard deviation grows only as the square root of the number of stages, while the total delay itself grows in proportion to it. The spread relative to the mean therefore shrinks as one over the square root of the length. This only holds for independent variation; variation that affects every gate on a chip the same way, like a slow wafer or a hot die, doesn't average out and needs its own margin.
Practice
Keep practicing
2 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.