Timing Analysis
Setup · Hold · Slack · STA
The core of every digital sign-off — understand timing paths, calculate slack, fix violations, and write SDC constraints.
Setup Time & Hold Time
| Parameter | Definition | Consequence if violated |
|---|---|---|
| Setup time (Tsu) | Min time data must be stable BEFORE clock edge | FF output undefined this cycle — metastability |
| Hold time (Th) | Min time data must be stable AFTER clock edge | New data bleeds in — FF captures wrong value |
| Clock-to-Q (Tcq) | Propagation delay from clock edge to Q output | Increases path delay, reduces Fmax |
| Propagation delay (Tpd) | Combinational logic delay between two FFs | Longer paths → lower Fmax |
Timing Path Anatomy
Data must arrive at capture FF no later than (Tclk − Tsu) and no earlier than Th after the clock edge
Interactive Timing Diagram & Slack Calculator
Critical Path & Maximum Frequency
The critical path is the timing path with the worst (smallest) setup slack. It limits Fmax for the entire design.
| Fix | Method | Reduces |
|---|---|---|
| Pipelining | Insert FF to split long path in half | Tpd |
| Retiming | Move registers across combinational logic | Tpd |
| Logic restructuring | CLA instead of RCA, Shannon decomposition | Tpd |
| Cell upsizing | Replace with faster (higher drive) cell | Tpd |
| Route optimization | Buffer insertion, shorter wire on critical net | Tpd |
| Reduce skew | Better CTS, use clock gating cells | Tskew |
Clock Skew & Jitter
| Parameter | Definition | Effect on timing |
|---|---|---|
| Skew | Arrival time difference between launch and capture FF clocks | Positive skew: tightens setup, relaxes hold. Negative skew: opposite. |
| Jitter | Cycle-to-cycle variation in clock period | Reduces effective timing margin — must be budgeted in STA |
| Clock uncertainty | STA margin = skew + jitter | Subtracted from setup slack budget |
Static Timing Analysis (STA) Flow
- 1Elaborate netlist — synthesis produces a gate-level netlist from RTL
- 2Read constraints (SDC) — define clocks, I/O delays, false paths, multicycle paths
- 3Apply parasitics (SPEF) — wire delays from physical layout
- 4Run STA — tool propagates delays, computes slack for every path
- 5Fix violations — pipeline/retime/upsize until all slack ≥ 0
SDC Timing Constraints
# Define 500 MHz clock on port clk
create_clock -period 2.0 -name clk [get_ports clk]
# Input arrives 0.5 ns after clock edge
set_input_delay -clock clk -max 0.5 [get_ports {data_in reset_n}]
set_input_delay -clock clk -min 0.1 [get_ports {data_in reset_n}]
# Output must arrive 0.3 ns before next clock edge
set_output_delay -clock clk -max 0.3 [get_ports data_out]
# Ignore async reset path (no timing required)
set_false_path -from [get_ports rst_async]
# Allow 2 clock cycles for the divide path
set_multicycle_path -setup 2 -from [get_cells u_div/*] -to [get_cells u_acc/*]
set_multicycle_path -hold 1 -from [get_cells u_div/*] -to [get_cells u_acc/*]
# Clock uncertainty (jitter + skew budget)
set_clock_uncertainty -setup 0.1 [get_clocks clk]
set_clock_uncertainty -hold 0.05 [get_clocks clk]
Verilog Timing Checks (Simulation)
// $setup and $hold system tasks in specify block
specify
$setup(data, posedge clk, 1.0); // 1 ns setup
$hold (posedge clk, data, 0.5); // 0.5 ns hold
$setuphold(posedge clk, data, 1.0, 0.5); // combined
endspecify
// Timing check in testbench (self-checking)
always @(posedge clk) begin
if ($time - last_data_change < T_SETUP)
$error("Setup violation at %0t", $time);
end
Fixing Timing Violations
| Violation | Root Cause | Fix |
|---|---|---|
| Setup violation | Path too slow (Tpd too large) | Pipeline, retime, upsize cells, restructure logic |
| Hold violation | Path too fast (Tpd too small) | Add buffers on short path — never add pipeline stage |
| Skew violation | Clock tree imbalanced | Rebalance CTS, use clock buffers, reduce fanout |
| Pulse-width violation | Clock duty cycle distorted | Fix PLL, use BUFGCE, check inverter chain |
Frequently Asked Questions
What is setup time and hold time?
Setup time: data must be stable this long BEFORE the clock edge. Hold time: data must remain stable this long AFTER the clock edge. Violating either causes metastability or data corruption.
What is slack? Can slack be negative?
Slack = timing margin. Positive slack = timing met with margin. Negative slack = timing violation — the design will fail at that clock frequency and cannot be fabricated/programmed as-is.
What is the difference between STA and simulation?
STA is exhaustive (all paths, no test vectors) and fast. Simulation depends on test coverage and is slower but finds logic bugs. Industry uses STA for sign-off timing and simulation for functional verification.
How do you fix a hold violation?
Insert delay buffers on the short (fast) path. Never add pipeline stages — that makes hold worse. Hold violations are frequency-independent: they exist at any clock speed.