Setup and Hold Time
Timing constraints, calculating T_clk.
Setup time and hold time are the two most critical timing parameters in any synchronous digital design. They define a strict window around the clock edge during which the input data of a flip-flop must remain absolutely stable. Violating either of these constraints leads to metastability, unpredictable output, and potential system failure. These parameters are central to GATE timing analysis questions and to real VLSI timing closure.
Core Concept Explanation
Inside a master-slave D flip-flop, the clock edge triggers a precise sequence of switching events in transmission gates and inverters. For this sequence to produce the correct logical value at Q, the data D must have already settled to a stable, valid logic level some time before the clock edge. This minimum required stable duration before the edge is called the setup time (t_su).
After the clock edge, the internal transmission gates are switching states. The nodes that captured D are still undergoing transitions. If D changes during this transition period, the partially captured value can be corrupted. The minimum duration D must remain stable after the clock edge is called the hold time (t_h). In modern CMOS processes, hold time is often very small or even zero for some cell designs, but it is never negative in practice.
The window from t_su before the clock edge to t_h after it is called the forbidden region or aperture. D must not transition inside this window. Any transition that does fall within this window causes the flip-flop to enter a metastable state where its internal node voltages are indeterminate.
Mathematical Expression and Timing Constraints
The most important timing equation in synchronous design is the maximum frequency constraint:
T_clk >= t_cq + t_logic_max + t_su
Here, T_clk is the clock period, t_cq is the clock-to-Q delay of the launching flip-flop, t_logic_max is the maximum combinational path delay, and t_su is the setup time of the capturing flip-flop. This equation gives the minimum allowed clock period, and its reciprocal gives the maximum operating frequency.
The hold time constraint is separate and applies to the minimum path:
t_cq + t_logic_min >= t_h
If the combinational path is too short (including zero delay for direct connections), the new data launched by one flip-flop may arrive at the next flip-flop's input before the hold time has expired after the same clock edge. This is a hold violation, also called a hold hazard.
Practical Understanding
Setup violations are fixed by slowing down the clock (increasing T_clk) or by pipelining the long combinational path into shorter stages. Hold violations are fixed by adding buffer delay in the short path to increase t_logic_min. In physical design, dedicated buffers called hold buffers are inserted in timing closure to fix hold violations without affecting setup.
Clock skew adds another layer of complexity. If the clock arrives at the launching flip-flop earlier than at the capturing flip-flop (positive skew), it effectively relaxes the setup constraint but tightens hold. Negative skew does the opposite. This is why all timing analysis tools analyze both setup and hold simultaneously across all clock phases.
In VLSI tools like Synopsys PrimeTime or Cadence Tempus, setup and hold checks are run at every register-to-register path and at every process-voltage-temperature (PVT) corner. A typical design may have millions of such timing paths to verify.
Given:
t_cq = 300 ps
t_su = 100 ps
t_h = 50 ps
t_logic_max = 1.8 ns (critical path)
t_logic_min = 0.1 ns (shortest path)
Clock skew = 0 (ideal)
Why this formula applies:
T_clk must satisfy both setup and hold constraints
Formula:
T_clk(min) = t_cq + t_logic_max + t_su
Hold check: t_cq + t_logic_min >= t_h
Substitution:
T_clk(min) = 0.3 + 1.8 + 0.1 = 2.2 ns
Hold check: 0.3 + 0.1 = 0.4 ns >= 0.05 ns
Calculation:
Max frequency = 1 / 2.2 ns = 454.5 MHz
Hold margin = 0.4 - 0.05 = 0.35 ns (safe)
Final Answer: Maximum operating frequency = 454.5 MHz. Hold constraint is satisfied with 350 ps margin.Exam Tip: GATE often gives t_cq, t_su, and combinational delay and asks for maximum clock frequency. Always use f_max = 1 / (t_cq + t_logic + t_su). Never add hold time to the frequency equation — hold time is for minimum path analysis only, not for frequency calculation. Mixing these two is the most common GATE trap.
Setup and Hold Constraints Visualized
- Setup time (t_su): D must be stable before the clock edge for at least this duration. Violation causes metastability.
- Hold time (t_h): D must remain stable after the clock edge for at least this duration. Violation corrupts captured data.
- Clock-to-Q delay (t_cq): Time from clock edge to when Q settles. Adds to the critical path delay.
- Setup fix: increase T_clk (reduce frequency) or reduce combinational logic depth.
- Hold fix: insert buffer delay in short paths to prevent fast propagation before hold window expires.
Quick Revision
- Setup time: minimum D stable time before clock edge. Violation: metastability.
- Hold time: minimum D stable time after clock edge. Violation: data corruption.
- Clock-to-Q (t_cq): delay from active clock edge to valid Q output.
- Frequency formula: f_max = 1 / (t_cq + t_logic_max + t_su). Hold time NOT in this formula.
- Hold check: t_cq + t_logic_min >= t_h. Independent of clock period.
- Positive clock skew relaxes setup but tightens hold; negative skew does the opposite.
- Trap: Never include t_h in the maximum frequency calculation. Setup and hold are separate independent constraints.
Setup Hold Time Quiz
Test your mastery of setup time, hold time, timing violations, and metastability.
Q1.A D flip-flop has a setup time of 2 ns and a hold time of 1 ns. The clock-to-Q delay of the launching flip-flop is 3 ns and the combinational logic delay is 7 ns. What is the maximum clock frequency if the clock skew is 0?
Related Articles
Setup and Hold Time
Timing constraints, timing violations, metastability.
7 min read
SR Latch
NOR and NAND based latches.
7 min read
D Latch
Level sensitive latch, transmission gate implementation.
6 min read
Bistability Principle
Inverter loop, metastability.
4 min read
Synchronizers
Handling asynchronous inputs.
10 min read