Setup Analysis, Step by Step
This is the volume the whole course leans on. A setup check is one subtraction - the time the data is needed, minus the time it arrives - but each side is built from several terms, and every term has a reason. Build both sides here, one line at a time, work ten problems, find a design's top speed, and then read a real timing report as easily as a receipt.
- How arrival time is built: launch edge, clock latency, clock-to-Q and every delay
- How required time is built: capture edge, clock latency, uncertainty and setup
- How to compute setup slack, and what its sign means
- How to find the most logic a path can hold, and a design's maximum frequency
- How to read a setup timing report line by line
- Volume 03, for timing paths, launch and capture edges, and clock latency
4.1 Arrival time
The arrival time is when the data really reaches the capture flip-flop. It is built by starting at the launch edge and adding every delay the data meets, in the order it meets them.
Volume 01 did this with three numbers. A real path has more, and each one is there for a reason. This volume uses one path throughout, on a 200 MHz clock (5.00 ns).
Build it, term by term
| Step | Adds | Running total |
|---|---|---|
| Launch edge | - | 0.00 ns |
| Clock source latency | 0.50 | 0.50 ns |
| Clock tree to u_ff1 | 0.35 | 0.85 ns |
| Clock-to-Q of u_ff1 | 0.21 | 1.06 ns |
| u1, NAND2 | 0.12 | 1.18 ns |
| u2, XOR2 | 0.23 | 1.41 ns |
| u_add, the adder | 2.10 | 3.51 ns |
| u3, AOI21 | 0.18 | 3.69 ns |
| u4, MUX2 | 0.26 | 3.95 ns |
| Data arrival time | 3.95 ns |
The first three steps are the clock. The data cannot leave u_ff1 until the clock edge has got there, so 1.06 ns passes before the data even starts moving. The logic itself is 2.89 ns.
Arrival time is a stopwatch started at the launch edge and stopped when the data reaches the capture flip-flop's D pin. Everything the edge and the data pass through adds to it.
Starting the stopwatch at the flip-flop's Q. The clock needed 0.85 ns just to reach u_ff1, and leaving that out makes the path look 0.85 ns faster than it is.
The clock reaches the launch flop after 0.70 ns. Its clock-to-Q is 0.20 ns, and the logic takes 3.50 ns. What is the arrival time?
Show the answer
Answer: C. Add everything from the launch edge onward: 0.70 + 0.20 + 3.50 = 4.40 ns. The trap answers leave out the clock latency, the clock-to-Q, or both.
4.2 Required time
The required time is the deadline. It starts at the capture edge, adds the time the clock takes to reach the capture flip-flop, and then takes off two margins: the clock uncertainty and the setup time.
| Step | Changes it by | Running total |
|---|---|---|
| Capture edge, one period later | - | 5.00 ns |
| Clock source latency | +0.50 | 5.50 ns |
| Clock tree to u_ff2 | +0.38 | 5.88 ns |
| Clock uncertainty | -0.08 | 5.80 ns |
| Library setup time of u_ff2 | -0.09 | 5.71 ns |
| Data required time | 5.71 ns |
Why is the clock latency added? Because the capture edge also has to travel. It reaches u_ff2 0.88 ns after it leaves the source, so the flip-flop actually captures at 5.88 ns, not at 5.00 ns.
Clock uncertainty
A clock is never perfect. Its edges wobble a little from cycle to cycle, and early in a project the clock tree does not exist yet. So a margin is taken off every setup check: the clock uncertainty. Here it is 0.08 ns.
Arrival adds the launch clock; required adds the capture clock. That is why the same source latency of 0.50 ns appears on both sides, and cancels. Only the difference in clock arrival - the skew - is left over.
Subtracting the capture clock latency instead of adding it. A later capture clock gives the data more time, not less, so it must push the deadline later.
A 4 ns clock reaches the capture flop after 0.55 ns. The setup time is 0.10 ns and there is no uncertainty. What is the required time?
Show the answer
Answer: B. Required = 4.00 + 0.55 - 0.10 = 4.45 ns. The capture clock latency is added, because the edge reaches the flip-flop 0.55 ns after it leaves the source.
4.3 Setup slack
Setup slack is the required time minus the arrival time. Everything in this sub-module is that one subtraction, looked at from different sides.
For the Volume 04 path:
The path has 1.76 ns to spare.
The same sum on one line
Put both sides together, and let the source latency cancel. What is left is worth memorising:
Here, skew is the capture clock arrival minus the launch clock arrival: 0.88 - 0.85 = +0.03 ns.
5.00 + 0.03 - 0.21 - 2.89 - 0.09 - 0.08 = 1.76 ns, the same answer.
Every term either gives the data time or takes it away. The period and a late capture clock give. Clock-to-Q, the logic, the setup time and the uncertainty take. Slack is what remains.
What the sign tells you
| Slack | Meaning | What to do |
|---|---|---|
| Positive | The data arrives early, with that much to spare | Nothing - or use the spare elsewhere |
| Zero | It arrives exactly on the deadline | Nothing, but there is no margin left |
| Negative | It arrives late by that much | Fix the path, or run the clock slower |
Treating a slack of +0.01 ns as comfortable. It passes, but a slightly hotter chip or a slightly different route takes it away. Designers watch the paths closest to zero, not just the failing ones.
A 6 ns path has clock-to-Q 0.30 ns, logic 4.90 ns, setup 0.12 ns and uncertainty 0.10 ns. There is no skew. What is the setup slack?
Show the answer
Answer: A. slack = 6.00 - 0.30 - 4.90 - 0.12 - 0.10 = 0.58 ns. The 0.68 answer forgets the uncertainty; the 0.80 answer forgets the setup time too.
4.4 Ten worked setup problems
Setup analysis is learned by doing it. Ten problems follow, each adding one idea. Try each one before opening its answer.
Use the one-line formula: slack = T + skew - clock-to-Q - logic - setup - uncertainty, where skew is the capture clock arrival minus the launch clock arrival.
A plain path
T = 10.00 ns. Clock-to-Q 0.30 ns, logic 6.20 ns, setup 0.10 ns. No skew, no uncertainty.
Show the solution
Arrival 0.30 + 6.20 = 6.50 ns. Required 10.00 - 0.10 = 9.90 ns. Slack = 3.40 ns, met.
Uncertainty joins in
T = 5.00 ns. Clock-to-Q 0.25 ns, logic 4.10 ns, setup 0.12 ns, uncertainty 0.10 ns.
Show the solution
Arrival 0.25 + 4.10 = 4.35 ns. Required 5.00 - 0.10 - 0.12 = 4.78 ns. Slack = 0.43 ns, met.
The capture clock is late
T = 4.00 ns. The clock reaches the launch flop after 0.60 ns and the capture flop after 0.75 ns. Clock-to-Q 0.20 ns, logic 3.60 ns, setup 0.10 ns.
Show the solution
Arrival 0.60 + 0.20 + 3.60 = 4.40 ns. Required 4.00 + 0.75 - 0.10 = 4.65 ns. Slack = 0.25 ns, met.
The skew is +0.15 ns, and it is what saves the path. Without it the slack would be 0.10 ns.
The capture clock is early
The same path, but now the clock reaches the capture flop after only 0.45 ns.
Show the solution
Arrival is still 4.40 ns. Required 4.00 + 0.45 - 0.10 = 4.35 ns. Slack = -0.05 ns, violated.
Nothing about the logic changed. The skew went from +0.15 to -0.15 ns, and 0.30 ns of slack went with it.
How much logic fits?
T = 8.00 ns, clock-to-Q 0.30 ns, setup 0.15 ns, uncertainty 0.05 ns. What is the most logic delay the path can have?
Show the solution
Set the slack to zero and solve for the logic: 8.00 - 0.30 - 0.15 - 0.05 = 7.50 ns.
This number is called the logic budget. Designers work it out before writing a line of logic, so they know how deep each stage may be.
A violation, and the period that fixes it
T = 3.00 ns. Clock-to-Q 0.18 ns, logic 2.95 ns, setup 0.07 ns. What is the slack, and what is the fastest clock this path can take?
Show the solution
Arrival 0.18 + 2.95 = 3.13 ns. Required 3.00 - 0.07 = 2.93 ns. Slack = -0.20 ns, violated.
Add the shortfall to the period: 3.00 + 0.20 = 3.20 ns, which is 1000 / 3.20 = 312.5 MHz.
Five stages at 400 MHz
T = 2.50 ns (400 MHz). Clock-to-Q 0.22 ns. Five gates of 0.31, 0.44, 0.27, 0.52 and 0.19 ns. Setup 0.08 ns.
Show the solution
The logic is 0.31 + 0.44 + 0.27 + 0.52 + 0.19 = 1.73 ns. Arrival 0.22 + 1.73 = 1.95 ns. Required 2.50 - 0.08 = 2.42 ns. Slack = 0.47 ns, met.
Mixed units
The clock is 250 MHz. Clock-to-Q 180 ps, logic 3450 ps, setup 60 ps, uncertainty 50 ps.
Show the solution
Convert first. 250 MHz is 1000 / 250 = 4 ns, which is 4000 ps. Then work in ps throughout: 4000 - 180 - 3450 - 60 - 50 = 260 ps, or 0.26 ns, met.
A deep clock tree
T = 6.00 ns. The clock reaches the launch flop after 1.60 ns and the capture flop after 1.75 ns. Clock-to-Q 0.25 ns, logic 5.30 ns, setup 0.10 ns.
Show the solution
Arrival 1.60 + 0.25 + 5.30 = 7.15 ns. Required 6.00 + 1.75 - 0.10 = 7.65 ns. Slack = 0.50 ns, met.
The arrival is later than the period itself, and that is fine. Both clock branches are long; only their difference, +0.15 ns, matters.
Uncertainty decides it
T = 2.00 ns. Clock-to-Q 0.12 ns, logic 1.70 ns, setup 0.05 ns, uncertainty 0.10 ns. Then work it again with an uncertainty of 0.15 ns.
Show the solution
With 0.10 ns: 2.00 - 0.12 - 1.70 - 0.05 - 0.10 = 0.03 ns, met.
With 0.15 ns: the same sum gives -0.02 ns, violated. At high frequencies the margins are a large share of the cycle, so the choice of uncertainty can decide whether a path passes.
At 500 MHz, a path has clock-to-Q 0.10 ns, setup 0.06 ns and uncertainty 0.05 ns. What is its logic budget?
Show the answer
Answer: D. The period is 2.00 ns. Take away everything that is not logic: 2.00 - 0.10 - 0.06 - 0.05 = 1.79 ns. With 1.62 ns of logic in it, the path would have 0.17 ns of slack.
4.5 Maximum frequency
A path's shortest possible period is its current period minus its slack. The maximum frequency of the whole design is set by the path whose shortest period is the longest.
Slack moves one-for-one with the period: take 1 ns off the period and the slack drops by exactly 1 ns. So the period at which the slack would be zero is easy to find.
For the Volume 04 path: 5.00 - 1.76 = 3.24 ns, and 1000 / 3.24 = 308.6 MHz.
| Period | Frequency | Setup slack |
|---|---|---|
| 6.00 ns | 166.7 MHz | 2.76 ns |
| 5.00 ns | 200.0 MHz | 1.76 ns |
| 4.00 ns | 250.0 MHz | 0.76 ns |
| 3.50 ns | 285.7 MHz | 0.26 ns |
| 3.24 ns | 308.6 MHz | 0.00 ns |
| 3.00 ns | 333.3 MHz | -0.24 ns |
The whole design runs at its worst path's speed
A design has many paths. Each one has its own shortest period, and the chip can go no faster than the longest of them.
| Path | Slack at 5 ns | Shortest period | f_max |
|---|---|---|---|
| The adder path | 1.76 ns | 3.24 ns | 308.6 MHz |
| A shorter path | 2.22 ns | 2.78 ns | 359.7 MHz |
| A longer path | 1.22 ns | 3.78 ns | 264.6 MHz |
This design runs at 264.6 MHz. The other two paths could go faster, but that does not help: the longer path is the critical path.
To raise f_max, work on the critical path only. Speeding up any other path changes nothing until the critical path is faster than it.
Computing f_max from the logic delay alone. The clock-to-Q, setup time, uncertainty and skew are all part of the cycle. Leave them out and the answer is too optimistic, sometimes by a lot.
At 5 ns a path has +0.30 ns of setup slack. What is its maximum frequency?
Show the answer
Answer: B. The shortest period is 5.00 - 0.30 = 4.70 ns, and 1000 / 4.70 = 212.8 MHz. The 188.7 MHz answer adds the slack to the period instead of taking it away.
4.6 Reading a setup report line by line
A timing report is this volume's arithmetic, printed by the tool. Read it as two columns of stopwatch times, one for the data and one for the deadline, and it holds no surprises.
Here is the setup report for the Volume 04 path, in the layout sign-off tools use.
Startpoint: u_ff1
Endpoint: u_ff2
Path Group: clk
Path Type: max
Point Incr Path
----------------------------------------------------------------
clock clk (rise edge) 0.00 0.00
clock source latency 0.50 0.50
clock network delay (propagated) 0.35 0.85
u_ff1/CK 0.00 0.85
u_ff1/Q (clock-to-Q) 0.21 1.06
u1/Y (NAND2_X1) 0.12 1.18
u2/Y (XOR2_X1) 0.23 1.41
u_add/S (ADD16_X1) 2.10 3.51
u3/Y (AOI21_X1) 0.18 3.69
u4/Y (MUX2_X2) 0.26 3.95
u_ff2/D 0.00 3.95
data arrival time 3.95
clock clk (rise edge) 5.00 5.00
clock source latency 0.50 5.50
clock network delay (propagated) 0.38 5.88
u_ff2/CK 0.00 5.88
clock uncertainty -0.08 5.80
library setup time -0.09 5.71
data required time 5.71
----------------------------------------------------------------
data required time 5.71
data arrival time -3.95
----------------------------------------------------------------
slack (MET) 1.76
Line by line
- The header. Startpoint and Endpoint name the two flip-flops. "Path Type: max" means the slow delays were used: this is a setup check.
- Incr and Path. Incr is what each line adds. Path is the running total - the stopwatch.
- The top half is the arrival. Launch edge at 0, the clock reaching u_ff1 at 0.85, then clock-to-Q and each cell. Each cell line is named by its output pin and its cell type.
- "data arrival time" is 3.95, the same number sub-module 4.1 built.
- The bottom half is the deadline. The capture edge at 5.00, the clock reaching u_ff2 at 5.88, then the uncertainty and setup taken off. The deadline is 5.71.
- The last three lines subtract the two, and give the slack with its verdict: MET.
Top half: when the data gets there. Bottom half: when it had to be there. Last line: the difference. Every setup report in every tool is this shape.
What to look at first
When a path fails, read the Incr column, not the Path column. Here the adder alone is 2.10 of the 2.89 ns of logic: 73%. That one line is where any fix would start.
Reading the Path column for a cell's delay. The Path column is cumulative: 3.51 next to the adder is when the data leaves it, not how long it took. The adder's own delay is its Incr, 2.10 ns.
In the report above, the library setup time grows from 0.09 to 0.19 ns. What does the slack line say now?
Show the answer
Answer: C. The setup time is subtracted on the required side, so a 0.10 ns larger setup lowers the required time from 5.71 to 5.61 ns. The arrival stays at 3.95 ns, and the slack becomes 1.66 ns.
What you learned
- Arrival time adds the launch clock latency, clock-to-Q and every delay after the launch edge.
- Required time adds the capture clock latency to the capture edge, then subtracts uncertainty and setup.
- Setup slack is required minus arrival: T + skew - clock-to-Q - logic - setup - uncertainty.
- The logic budget is what is left of the period after everything that is not logic.
- A path's shortest period is T minus its slack; the design's f_max is set by its worst path.
- A timing report is the same sum: the arrival on top, the deadline below, the slack at the end.
Key words from this volume
Every word below has a plain-English entry in the glossary.
- Arrival time
- Required time
- Clock uncertainty
- Maximum clock frequency (fmax)
- Critical path
- Timing report
- Pipelining
Practice
Pipeline the adder path
A flip-flop is added straight after the adder in the Volume 04 path, with the same clock tree, clock-to-Q and setup as the others. What is the new f_max, and which half limits it?
Show the solution
The first half now ends at the new flip-flop: 0.85 + 0.21 + 0.12 + 0.23 + 2.10 = 3.51 ns. The deadline is still 5.71 ns, so its slack is 2.20 ns and its shortest period is 5.00 - 2.20 = 2.80 ns.
The second half starts at the new flip-flop: 0.85 + 0.21 + 0.18 + 0.26 = 1.50 ns, with slack 4.21 ns.
The design is limited by the first half: 357.1 MHz, up from 308.6 MHz. This is pipelining. The cost is one extra clock cycle before each result appears.
Which path to fix?
A design has three paths with f_max values of 308.6 MHz, 359.7 MHz and 264.6 MHz. The target is 300 MHz. Which paths need work, and what is the chip's speed if you fix none of them?
Show the solution
Without fixes the chip runs at 264.6 MHz, the slowest path's limit.
Only the 264.6 MHz path fails the 300 MHz target. The 308.6 MHz path passes, but with little margin: at 300 MHz its slack is 0.09 ns. That is the next one to watch, because a small change can tip it over.
Find the error in a hand calculation
A colleague writes: "T = 5 ns, launch clock 0.85, capture clock 0.88, clock-to-Q 0.21, logic 2.89, setup 0.09, uncertainty 0.08. Slack = 5 - 0.85 - 0.21 - 2.89 - 0.09 - 0.08 = 0.88 ns." What went wrong?
Show the solution
They subtracted the launch clock latency but never added the capture clock latency. Both clock branches belong in the sum, on opposite sides, and most of them cancels.
Correctly: 5.00 + (0.88 - 0.85) - 0.21 - 2.89 - 0.09 - 0.08 = 1.76 ns. Their answer was out by the whole capture clock latency, 0.88 ns.
Interview corner
Walk me through a setup check
"Write down the setup slack equation and explain every term."
Show the solution
"Slack equals the period, plus the skew, minus clock-to-Q, minus the combinational delay, minus the setup time, minus the clock uncertainty.
The period and a positive skew - a capture clock arriving later than the launch clock - give the data time. Clock-to-Q is how long the launch flop takes to produce the data. The combinational delay is the logic and wires. The setup time is how early the capture flop needs the data. The uncertainty is a margin for jitter and unknown skew. Positive slack meets timing; negative slack is a violation."
How do you get f_max?
"Your worst setup slack at 250 MHz is -0.4 ns. What frequency does the design actually run at?"
Show the solution
"250 MHz is a 4 ns period. The worst path needs 0.4 ns more, so its shortest period is 4.4 ns, which is 1000 / 4.4, about 227 MHz. That path sets the chip's speed, so the design runs at about 227 MHz until that path is fixed. I would then look at the next-worst path, because fixing the first one only raises f_max as far as the second one allows."
Volume 05 does the same for hold: the same stopwatch, but with the fastest delays, the same clock edge at both ends - and no clock period anywhere in the sum.