The setup inequality is the one equation behind most timing reports. Write it once with every term and you can explain any setup violation: which term is too large, which is too small, and what a fix actually changes.
Let the launch flop's clock arrive at time L (its clock latency), the capture flop's at C, the period be T, and the path have clock-to-Q delay D_cq, combinational delay D_path (the maximum), setup time S and clock uncertainty U. The data arrives at the capture flop at L + D_cq + D_path. The capture edge arrives at T + C, and the data must be stable S before it, with the uncertainty taken as margin. Setup holds when:
arrival = L + D_cq + D_path
required = T + C - S - U
slack = required - arrival
setup met <=> slack >= 0Term | Value | Role |
|---|---|---|
T | 2.00 | Clock period |
L | 0.30 | Launch clock latency |
C | 0.35 | Capture clock latency |
D_cq | 0.40 | Clock-to-Q of the launch flop |
D_path | 1.00 | Maximum combinational delay |
S | 0.10 | Setup time of the capture flop |
U | 0.10 | Clock uncertainty (setup) |
T, L, C, Dcq, Dpath, S, U = 2.00, 0.30, 0.35, 0.40, 1.00, 0.10, 0.10
arrival = L + Dcq + Dpath # 1.70
required = T + C - S - U # 2.15
slack = required - arrival # 0.45
assert abs(arrival - 1.70) < 1e-9 and abs(required - 2.15) < 1e-9 and abs(slack - 0.45) < 1e-9
# What does a 0.5 ns slower path do? The slack goes negative:
assert required - (L + Dcq + Dpath + 0.5) < 0
print("PASS: setup slack =", round(slack, 2), "ns")Slack is +0.45 ns, so setup is met with margin. A path 0.5 ns slower fails by 0.05 ns. Notice that later capture latency C helps setup (it gives the data more time) and later launch latency L hurts it. That is the whole idea behind useful skew.
Change | Effect on setup slack |
|---|---|
Shorter combinational path (resizing, restructuring) | Improves by the delay removed |
Faster launch flop (smaller clock-to-Q) | Improves by the reduction |
Later capture clock (useful skew) | Improves, but hurts the capture flop's own outgoing paths |
Longer period | Improves by the extra period |
Smaller uncertainty | Improves, but only if the margin was genuinely too large |
Slack is 0.45 ns and L enters the arrival with a plus sign, so L can increase by 0.45 ns (from 0.30 to 0.75 ns) before the slack reaches zero, assuming nothing else changes.