Setup Time (Tsetup) is the minimum amount of time that the input data must remain stable before the active edge of the clock (rising edge or falling edge) so that a flip-flop can correctly capture the data.
Setup Time is the minimum time before the clock edge during which the data input must not change.
If the data changes too close to the clock edge, the flip-flop may capture incorrect data or enter a metastable state.
Clock: ____/‾‾‾\\____/‾‾‾\\____
Data : ----1----------0-------
<---Tsetup--->
↑
Clock Edge
The data must be stable during the setup window before the clock edge.
Suppose a flip-flop has:
Setup Time = 2 ns
If the clock edge occurs at:
10 ns
Then the data must be stable before:
10 ns - 2 ns = 8 ns
Any data change after 8 ns may cause a setup violation.