Defining setup and hold slack with fixes
Setup slack measures extra time before capture edge (max delay margin), defined as clock period minus setup and skew minus max data path delay; hold slack measures extra time after launch edge (min delay margin), defined as min data path delay plus clock-to-Q and skew minus hold time. Setup violations can be fixed by slowing clock or pipelining to reduce max delays; hold violations can’t be fixed by changing clock period since hold depends on minimum delays and same clock edge timing, so fixing hold requires adding delay or adjusting clock skew.
In a synchronous design each register has a window around a clock edge during which its D input must be valid. Two timing checks are derived from that:
-
A set‑up check says that the data launched by one edge must not arrive later than (T_{\text{clk}}!-)setup at the next edge. If you write it out for a single‑cycle path with skew, one common form is
[
T_{\mathrm{clk_q(max)}} + T_{\mathrm{comb(max)}} \leq T_{\mathrm{clk}} - T_{\mathrm{setup}} - T_{\mathrm{skew}}.
]
The set‑up slack is the difference between the right–hand side “required arrival time” and the left–hand side “actual arrival time”. Positive slack means you have margin, negative slack means you violate the set‑up requirement.
-
A hold check says that the data launched by an edge must not change again for at least (T_{\text{hold}}) after that same edge at the receiving flop. For a single‑cycle, same‑edge transfer you get a constraint on the minimum path delay:
[
T_{\mathrm{clk_q(min)}} + T_{\mathrm{comb(min)}} \geq T_{\mathrm{hold}} - T_{\mathrm{skew}}.
]
Hold slack is defined analogously: the actual earliest arrival minus the required minimum. If it is negative, the data is arriving too soon after the capture edge and will be sampled incorrectly.
These two checks depend on different parts of the timing budget. The set‑up inequality involves the clock period (T_{\text{clk}}) and the maximum delays. If you increase (T_{\text{clk}}) (slow the clock) or break a long combinational path into two shorter ones with an extra register, you increase the right–hand side or reduce the left–hand side and can eliminate negative set‑up slack.
The hold inequality, by contrast, is between the same launching edge and the capturing edge plus a small hold time. It does not contain the clock period at all; slowing the clock does not move the hold window. In fact, adding registers tends to reduce both the maximum and minimum path delays and can make hold problems worse. The usual way to fix a negative hold slack is to increase the minimum delay on the offending path or adjust skew, e.g. by inserting delay buffers, routing the net longer, or balancing the clock tree so that the receiving clock is not early. There is no global clock frequency adjustment that will prevent a too‑fast path from racing through during the hold window.