---
title: Static timing analysis
heading: Setup and hold slack, clock skew, uncertainty and the critical path
eyebrow: S3 · Lesson 16 · Static timing analysis
xp: 50
---

::: hook
A chip with a billion gates can't be simulated with every input pattern to check its timing, so it isn't. Static timing analysis checks every path between registers with arithmetic instead: the latest a signal can arrive must be before the capturing edge minus setup time, and the earliest must be after the edge plus hold time. Two numbers come out per path, setup slack and hold slack, and a design meets timing when every one is positive. Clock skew helps one and hurts the other, which is why hold violations, unlike setup violations, can't be fixed by slowing the clock.
:::

::: play
- One register-to-register path: setup slack (solid) and hold slack (dashed) against the clock skew, the amount by which the capturing flip-flop's clock arrives later than the launching one's.
- Positive skew gives the slow path more time, raising setup slack, but lets the fast path race through before the capturing flip-flop's hold window closes, lowering hold slack.
- Change the clock period: only the setup line moves. Hold slack doesn't depend on the period at all.
:::
:::

```sim plot
view: graph
x: k = -150..150 ps
y: s = -300..400
slider: T = 600..1500 = 1000 ps
slider: L = 300..1200 = 800 ps
slider: m = 0..200 = 30 ps
plot: T + k - (50 + L + 30) | label: setup slack, ps
plot: 50 + m - 20 - k | dashed | color: ch2 | label: hold slack, ps
plot: 0 | dashed | color: ch3 | label: zero slack
```

::: predict
## A path fails its hold check by 30 ps. Will lowering the clock frequency fix it?

- [ ] Yes, lowering the frequency fixes any timing failure
- [x] No: hold depends only on the shortest path and the skew
- [ ] Only if the skew is positive
- [ ] Yes, but only by halving it

::: reveal
No. A hold violation means a new value races from one flip-flop to the next within the same clock edge, before the capturing flip-flop has finished latching the old one. Both flip-flops see the same edge, so the period never enters the hold check. A chip with hold violations fails at every frequency; the fix is adding delay (buffers) to the short path, or reducing the skew.
:::
:::

::: nameit
## The setup check

Data launched at one edge must arrive before the next capturing edge, less the setup time:

$$\text{slack}_\text{setup} = (T + t_\text{skew} - t_\text{unc}) - (t_{clk\text{-}q} + t_\text{logic,max} + t_\text{setup})$$

where $t_\text{skew}$ is how much later the capture clock arrives than the launch clock, and $t_\text{unc}$ covers jitter and margin. The **critical path** is the one with the least setup slack; it sets $f_\text{max}$.

## The hold check

Data launched at an edge must not reach the capturing flip-flop until after that same edge's hold window:

$$\text{slack}_\text{hold} = (t_{clk\text{-}q} + t_\text{logic,min}) - (t_\text{hold} + t_\text{skew})$$

The clock period doesn't appear. Hold failures are fixed by inserting delay into short paths, which tools do automatically after the clock tree is built.

## Skew

Skew trades setup for hold: positive skew (late capture) helps setup and hurts hold. Clock trees aim for near-zero skew; **useful skew** deliberately shifts clocks to borrow time across stages.

## Exceptions

- **Multicycle paths** that are allowed N cycles get N·T in the setup check (and the hold check is usually moved accordingly).
- **False paths** that can never be exercised (between unrelated clocks, through mutually exclusive multiplexer settings) are excluded.
- **On-chip variation**: real analysis uses the launch path's slowest corner against the capture path's fastest, with derating.
:::

::: example
## A path has $t_{clk\text{-}q}$ = 50 ps, setup 30 ps, hold 20 ps, logic between 30 and 800 ps, a 1000 ps clock and +50 ps of skew. Find both slacks, then add 40 ps of clock uncertainty.

::: solution
1. **Setup slack.** The skew gives the capture edge 50 ps more time:
   $$\begin{aligned} S &= (1000 + 50) \\ &\quad - (50 + 800 + 30) \\ &= +170\ \text{ps} \end{aligned}$$
2. **Hold slack.** The shortest path races the late capture edge:
   $$\begin{aligned} S &= (50 + 30) - (20 + 50) \\ &= +10\ \text{ps} \end{aligned}$$
   Barely passing, because the skew that helped setup hurt hold.
3. **Add 40 ps of uncertainty.** The setup slack drops to +130 ps. Conservative tools also apply uncertainty to hold, which would make it −30 ps, needing buffers.

**Answer:** +170 ps of setup slack and +10 ps of hold slack; with 40 ps of uncertainty, +130 ps for setup (and −30 ps for hold if the tool applies it there too).
:::
:::

::: example
## What's this path's maximum frequency with and without the skew? And if a slow divider is declared a 2-cycle multicycle path with 1700 ps of logic, does it pass at 1 GHz?

::: solution
1. **Without skew.**
   $$\begin{aligned} f &= \frac{1}{(50 + 800 + 30)\ \text{ps}} \\ &= 1.14\ \text{GHz} \end{aligned}$$
2. **With +50 ps of useful skew.**
   $$\begin{aligned} f &= \frac{1}{830\ \text{ps}} \\ &= 1.20\ \text{GHz} \end{aligned}$$
3. **The multicycle path.** It gets $2 \times 1000$ ps:
   $$\begin{aligned} S &= 2000 - (50 + 1700 + 30) \\ &= +220\ \text{ps} \end{aligned}$$
   so it passes, as long as the design really does wait two cycles for its result.

**Answer:** 1.14 GHz without skew and 1.20 GHz with it; the multicycle path passes with +220 ps of slack.
:::
:::

::: example
## Stage 1 has 1100 ps of logic and stage 2 has 700 ps, both on a 1000 ps clock with 50 ps clock-to-Q and 30 ps setup. How much useful skew on the middle register makes both stages pass?

::: solution
1. **Stage 1 slack.** Delaying the middle register's clock by s gives stage 1
   $$\begin{aligned} S_1 &= 1000 + s - 1180 \\ &= s - 180 \end{aligned}$$
2. **Stage 2 slack.**
   $$\begin{aligned} S_2 &= 1000 - s - 780 \\ &= 220 - s \end{aligned}$$
3. **Choose s.** Any s from 180 to 220 ps works; s = 200 ps leaves 20 ps on each.
4. **Check hold.** The shift hurts stage 1's hold check by 200 ps, so its shortest path must exceed
   $$20 + 200 - 50 = 170\ \text{ps}$$

**Answer:** 180 to 220 ps of skew works; 200 ps leaves 20 ps of slack in each stage, provided stage 1's shortest path exceeds 170 ps.
:::
:::

::: check
given: T = 800 | 1000 | 2000; c = 40 | 70; L = 500 | 700; s = 20 | 50; k = -30 | 25 | 40
answer: T + k - (c + L + s)
unit: ps
tolerance: 0.5%

## A path has period {T} ps, clock-to-Q {c} ps, maximum logic {L} ps, setup {s} ps and skew {k} ps. What's its setup slack?

::: right
Right. $(T + t_\text{skew}) - (t_{cq} + t_\text{logic} + t_\text{setup})$ = {answer} ps.
:::

::: misses
- [T - k - (c + L + s)] Positive skew (late capture) adds to the time available.
- [T - (c + L + s)] Include the skew.
- [any] Not yet. Required time minus arrival time.
:::
:::

::: check
given: c = 40 | 60; m = 10 | 40 | 80; h = 15 | 30; k = -20 | 30 | 60
answer: c + m - h - k
unit: ps
tolerance: 0.5%

## A path has clock-to-Q {c} ps, minimum logic {m} ps, hold {h} ps and skew {k} ps. What's its hold slack?

::: right
Right. $(t_{cq} + t_\text{logic,min}) - (t_\text{hold} + t_\text{skew})$ = {answer} ps.
:::

::: misses
- [c + m - h + k] Late capture makes hold harder: subtract the skew.
- [any] Not yet. The earliest arrival against the hold window.
:::
:::

::: check
given: c = 40 | 60; L = 400 | 900; s = 20 | 40; k = 20 | 50
answer: 1/((c + L + s - k)*1e-12)/1e9
unit: GHz
tolerance: 1%

## With clock-to-Q {c} ps, logic {L} ps, setup {s} ps and {k} ps of useful skew, what's the maximum frequency?

::: right
Right. $\frac{1}{t_{cq} + t_\text{logic} + t_\text{setup} - t_\text{skew}}$ = {answer} GHz.
:::

::: misses
- [1/((c + L + s + k)*1e-12)/1e9] Useful skew gives the path more time: subtract it.
- [any] Not yet. Setup slack zero, solved for T.
:::
:::

::: check
given: H = -10 | -25 | -60; b = 15 | 20
answer: ceil(-H/b - 0.0001)
tolerance: 0

## A path's hold slack is {H} ps. How many {b} ps delay buffers fix it?

::: right
Right. {answer} buffers bring the slack to zero or above.
:::

::: misses
- [any] Not yet. Enough delay to cover the deficit, rounded up.
:::
:::

::: check
given: N = 2 | 3 | 4; T = 500 | 1000; L = 900 | 1400; c = 50; s = 30
answer: N*T - (c + L + s)
unit: ps
tolerance: 0.5%

## A path declared {N}-cycle multicycle has {L} ps of logic, clock-to-Q {c} ps, setup {s} ps, at a {T} ps period. What's its setup slack?

::: right
Right. $NT - (t_{cq} + t_\text{logic} + t_\text{setup})$ = {answer} ps.
:::

::: misses
- [T - (c + L + s)] A multicycle path gets N periods.
- [any] Not yet. N clocks are allowed.
:::
:::

::: check
given: S = 50 | 150; u = 20 | 60
answer: S - u
unit: ps
tolerance: 0.5%

## A path has {S} ps of setup slack before clock uncertainty. With {u} ps of uncertainty, what remains?

::: right
Right. {answer} ps.
:::

::: misses
- [any] Not yet. Uncertainty comes straight out of the slack.
:::
:::

::: check
kind: parts
given: T = 800 | 1000; L = 600 | 700; m = 20 | 60; k = -50 | 50; u = 0 | 40

## A path has 50 ps clock-to-Q, 30 ps setup and 20 ps hold; its logic takes {m} ps at least and {L} ps at most. The clock period is {T} ps, the capture clock arrives {k} ps after the launch clock, and {u} ps of uncertainty is reserved.

::: part
answer: T + k - u - (50 + L + 30)
unit: ps
tolerance: 0.5%

### What is the setup slack?

::: misses
- [T - (50 + L + 30)] Include skew and uncertainty.
- [any] $(T + t_\text{skew} - t_\text{unc}) - (t_{clk\text{-}q} + t_\text{logic} + t_\text{setup})$.
:::
:::

::: part
answer: 50 + m - (20 + k)
unit: ps
tolerance: 0.5%

### What is the hold slack?

::: misses
- [50 + m - 20] Late capture clocks hurt hold.
- [any] $(t_{clk\text{-}q} + t_\text{min}) - (t_\text{hold} + t_\text{skew})$.
:::
:::
:::

::: check
kind: derivation
vars: q = 20..100, L = 100..2000, s = 10..60, k = -100..100, u = 0..80

## A path has clock-to-Q q, maximum logic L, setup s, capture-clock skew k and uncertainty u.

::: step
answer: q + L + s - k + u

### What is the shortest clock period it passes at?
:::

::: step
answer: 1/(q + L + s - k + u)

### What is its maximum frequency (per unit of time)?
:::

::: right
Right. Positive skew lends the path time; uncertainty takes it away.
:::
:::

::: explain
## Why does clock skew help setup timing but hurt hold timing?

::: model
Skew here means the capturing flip-flop's clock edge arrives later than the launching flip-flop's. For the setup check, the data launched at one edge must arrive before the next capturing edge, and a later capturing edge gives the slow path more time, so slack improves. For the hold check, the data launched at an edge must not arrive at the capturing flip-flop until that flip-flop has finished latching the previous value at the same edge. If the capturing edge is late, the window during which the old value must stay stable extends further, so a fast path is more likely to overwrite it too soon. The same skew moves the two checks in opposite directions.
:::
:::

::: practice

::: check
given: T = 900 | 1500; c = 45 | 65; L = 600 | 1100; s = 25 | 35; k = -20 | 30
answer: T + k - (c + L + s)
unit: ps
tolerance: 0.5%

## Setup slack: T = {T}, $t_{cq}$ = {c}, logic {L}, setup {s}, skew {k} ps?

::: misses
- [any] $(T + k) - (t_{cq} + L + s)$.
:::
:::

::: check
given: c = 35 | 55; m = 20 | 60; h = 20 | 35; k = 10 | 50
answer: c + m - h - k
unit: ps
tolerance: 0.5%

## Hold slack: $t_{cq}$ = {c}, min logic {m}, hold {h}, skew {k} ps?

::: misses
- [any] $(t_{cq} + m) - (h + k)$.
:::
:::

::: check
given: H = -15 | -45; b = 12 | 25
answer: ceil(-H/b - 0.0001)
tolerance: 0

## Buffers of {b} ps to fix {H} ps hold slack?

::: misses
- [any] Round up the deficit over the buffer delay.
:::
:::
:::
