Topic 16 · Digital Electronics

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 TimeHold TimeSlack Critical PathClock SkewJitter STASDC Constraints

Setup Time & Hold Time

ParameterDefinitionConsequence if violated
Setup time (Tsu)Min time data must be stable BEFORE clock edgeFF output undefined this cycle — metastability
Hold time (Th)Min time data must be stable AFTER clock edgeNew data bleeds in — FF captures wrong value
Clock-to-Q (Tcq)Propagation delay from clock edge to Q outputIncreases path delay, reduces Fmax
Propagation delay (Tpd)Combinational logic delay between two FFsLonger paths → lower Fmax

Timing Path Anatomy

FF (launch)
──Tcq──►
Combo Logic
──Tpd──►
FF (capture)

Data must arrive at capture FF no later than (Tclk − Tsu) and no earlier than Th after the clock edge

Setup slack = Tclk − Tcq − Tpd − Tsu − Tskew
Hold slack = Tcq + Tpd,min − Th + Tskew

Interactive Timing Diagram & Slack Calculator

Adjust parameters — watch slack change live
10 ns
1 ns
5 ns
1 ns
0.5 ns
0 ns
Setup Slack
Hold Slack
Fmax
Status

Critical Path & Maximum Frequency

Fmax = 1 / (Tcq + Tpd,max + Tsu + Tskew)

The critical path is the timing path with the worst (smallest) setup slack. It limits Fmax for the entire design.

FixMethodReduces
PipeliningInsert FF to split long path in halfTpd
RetimingMove registers across combinational logicTpd
Logic restructuringCLA instead of RCA, Shannon decompositionTpd
Cell upsizingReplace with faster (higher drive) cellTpd
Route optimizationBuffer insertion, shorter wire on critical netTpd
Reduce skewBetter CTS, use clock gating cellsTskew

Clock Skew & Jitter

ParameterDefinitionEffect on timing
SkewArrival time difference between launch and capture FF clocksPositive skew: tightens setup, relaxes hold. Negative skew: opposite.
JitterCycle-to-cycle variation in clock periodReduces effective timing margin — must be budgeted in STA
Clock uncertaintySTA margin = skew + jitterSubtracted from setup slack budget
Hold violations are clock-frequency independent — they are caused by paths that are too FAST, not too slow. Adding pipeline stages makes hold violations worse. Fix hold with buffer insertion on the short path.

Static Timing Analysis (STA) Flow

  1. 1Elaborate netlist — synthesis produces a gate-level netlist from RTL
  2. 2Read constraints (SDC) — define clocks, I/O delays, false paths, multicycle paths
  3. 3Apply parasitics (SPEF) — wire delays from physical layout
  4. 4Run STA — tool propagates delays, computes slack for every path
  5. 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

ViolationRoot CauseFix
Setup violationPath too slow (Tpd too large)Pipeline, retime, upsize cells, restructure logic
Hold violationPath too fast (Tpd too small)Add buffers on short path — never add pipeline stage
Skew violationClock tree imbalancedRebalance CTS, use clock buffers, reduce fanout
Pulse-width violationClock duty cycle distortedFix PLL, use BUFGCE, check inverter chain
Common mistake: Trying to fix a hold violation by pipelining makes it worse — pipeline adds more Tcq delay at the launch end, making the short path even shorter relative to hold time. Fix hold with delay buffers only.
Golden rule: Setup violations → reduce delay. Hold violations → add delay. They require opposite fixes.

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.