Setup time and hold time are the two constraints every flip-flop imposes on the data arriving at its D pin. Getting these wrong — even by a few picoseconds — causes metastability: the flip-flop output goes to an undefined voltage level and can corrupt an entire chip. This lesson explains what they mean physically, derives the slack equations from first principles, and shows how to fix violations.
A flip-flop is built from two cross-coupled latches (master and slave). When the clock is low, the master latch is transparent and tracks the D input. When the clock goes high, the master latch closes (locks the value) and the slave latch opens (propagates Q).
For the master latch to close reliably, D must have settled to a stable logic level before the clock rises. Setup time (Tsu) is how long before the clock edge D must be stable. After the clock rises, D must hold stable long enough for the feedback inside the master latch to fully resolve. Hold time (Th) is how long after the clock edge D must remain unchanged.
STA computes two slack values at each flip-flop: setup slack and hold slack. Both must be non-negative for the design to meet timing.
| Term | What it means |
|---|---|
| Tclk | Clock period (e.g. 2 ns for a 500 MHz clock) |
| Tlaunch_clk | Clock latency to the launch flip-flop (source clock + clock tree delay to FF1) |
| Tcapture_clk | Clock latency to the capture flip-flop (source clock + clock tree delay to FF2) |
| Tclk2q | Clock-to-Q propagation delay of the launch FF (Q stable after clock edge) |
| Tcomb | Combinational logic delay between FF1 output and FF2 data input |
| Tsu | Setup time requirement of the capture FF (from Liberty library) |
| Th | Hold time requirement of the capture FF (from Liberty library) |
Clock skew = Tcapture_clk − Tlaunch_clk. Positive skew (capture clock arrives later) helps setup slack but hurts hold slack. Negative skew (capture clock arrives earlier) hurts setup but helps hold. This is why setup and hold violations cannot both be fixed by changing clock arrival times — fixing one can break the other.
A register-to-register path with the following parameters:
| Parameter | Value |
|---|---|
| Clock period (Tclk) | 4 ns |
| Launch clock latency (Tlaunch_clk) | 0.5 ns |
| Capture clock latency (Tcapture_clk) | 0.6 ns |
| Clock-to-Q delay (Tclk2q) | 0.2 ns |
| Combinational delay (Tcomb) | 2.8 ns |
| Setup time (Tsu) | 0.15 ns |
| Hold time (Th) | 0.05 ns |
Arrival Time = T_launch_clk + T_clk2q + T_comb
= 0.5 + 0.2 + 2.8 = 3.5 ns
Required Time = T_clk + T_capture_clk - T_su
= 4.0 + 0.6 - 0.15 = 4.45 ns
Setup Slack = Required Time - Arrival Time
= 4.45 - 3.5 = +0.95 ns ✓ PASS
Arrival Time = T_launch_clk + T_clk2q + T_comb
= 0.5 + 0.2 + 2.8 = 3.5 ns
Hold Required = T_capture_clk + T_h
= 0.6 + 0.05 = 0.65 ns
Hold Slack = Arrival Time - Hold Required
= 3.5 - 0.65 = +2.85 ns ✓ PASS
Data arrives too late at the capture FF. The combinational path is too slow — too many logic levels, large fanout, long wires, slow cells, or a high PVT (slow process corner, low voltage, high temperature) operating condition.
Classic sign: negative setup slack on the longest combinational paths. Worsens as frequency increases.
Data arrives too fast at the capture FF — before the capture clock edge has settled the previous value. Common after CTS when real clock tree delays replace ideal zero-latency clocks. Short paths between consecutive FFs are most at risk.
Classic sign: negative hold slack on very short data paths. Hold violations are frequency-independent — they exist at any clock speed.
A setup violation means the chip may fail at high frequency — you can reduce the clock. A hold violation causes corruption at any frequency and cannot be fixed by slowing down. Every hold violation must be fixed before tapeout, no exceptions.
## Setup check (max delay analysis) -- worst 5 violating paths
report_timing -delay_type max \
-max_paths 5 \
-slack_lesser_than 0 \
-path_type full_clock_expanded
## Hold check (min delay analysis) -- worst 5 violating paths
report_timing -delay_type min \
-max_paths 5 \
-slack_lesser_than 0 \
-path_type full_clock_expanded
## Quick summary: WNS and TNS for both checks
report_timing_summary
## Check a specific path from FF1/CK to FF2/D
report_timing -from FF1/CK -to FF2/D -delay_type max
The timing report lists: startpoint (launch FF clock pin), endpoint (capture FF data pin), path type (max=setup / min=hold), arrival time, required time, and slack. Negative slack = violation. The path with the worst (most negative) slack is the critical path. Day 11 covers reading full PrimeTime reports line-by-line.
-delay_type max-delay_type minSetup time (Tsu) is the minimum time the D input must be stable before the active clock edge. If data arrives inside this window, the flip-flop may enter metastability — its output goes to an undefined voltage and may take nanoseconds to resolve. Setup time is specified per cell in the Liberty library.
Hold time (Th) is the minimum time D must remain stable after the active clock edge. Violating hold causes the same metastability problem as setup. Hold time is independent of clock period — it must be met at any frequency, which is why hold violations cannot be fixed by reducing clock speed.
Positive skew means the capture FF's clock arrives later than the launch FF's clock. This gives the data path more time to propagate (improving setup margin). But it also means the capture FF's clock edge is delayed relative to the data path — making it easier for a new data value (from the next cycle) to arrive before the current one is safely captured (degrading hold margin).
Propagation delay is the time for a signal to travel through a logic gate or wire — it adds to the data arrival time. Setup time is a requirement on the flip-flop's data pin — it reduces the time budget available for the data path. Both appear in the setup slack equation: a longer propagation delay or a larger setup time requirement both reduce setup slack.
Hold violations are frequently introduced during Clock Tree Synthesis (CTS). Before CTS, STA uses ideal (zero-latency) clocks, which makes all paths appear symmetric. After CTS, real clock tree delays mean some paths have large clock skew. Short data paths between FFs with high positive skew are the most common hold violation source post-CTS.