Let us understand the concept with an example:
I hope the above waveforms are self explanatory.
Setup Slack in the above case (as inferred from the waveforms as well) is:
Setup Slack = Tclk - T(clk-2-q) - Tdata - T(su,FF2)
If this setup slack is positive, we say that setup time constraint is met. Note that setup slack depends upon the clock period and hence in turn frequency at which your design is clocked.
Let us consider hold timing:
Hold Slack = Tdata + T(clk-2-q) - T(ho,FF2)
As evident from the above equation, hold slack is independent of the frequency of the design.
Note:
- Setup is the next cycle check, we would take the setup time T(su,FF2) of FF2 into account while finding setup slack at input pin of FF2.
- Hold time is the same cycle check, we would take the hold time T(ho,FF2) of FF2 into account while computing the hold slack at input pin of FF2.