⚡ Digital Design Blog

Part 4 of 10

Timing Analysis

Setup time, hold time, and why your chip might fail

By Praveen Kumar Vagala

1,156 views

Why Timing Matters

A logic design that's functionally correct can still fail if timing is wrong.

Timing violations cause:

Flip-Flop Timing Parameters

Tsetup Thold |←──────→||←───→| || DATA ━━━━━━━━━━━━━━━━━━━━━━╲╲━━━━━━━━━━━━ ╲╲ CLK ────────────────────┬──────────────── │ Clock Edge |←──── Tclk_to_q ────→| | OUTPUT ───────────────────────┬──────────── │ New Value

Key Timing Parameters

ParameterSymbolDescription
Setup TimeTsuData must be stable BEFORE clock edge
Hold TimeThData must be stable AFTER clock edge
Clock-to-QTcqTime for output to change after clock
Clock PeriodTclkTime between clock edges

Setup Time Violation

Data arrives TOO LATE - after the setup window.

│ Tsetup │ │←──────→│ │ │ DATA ────────┴────────┘ ← Data changes too close to edge! CLK ─────────────────┬───────── │ Clock Edge PROBLEM: FF might capture old value or go metastable!

Setup Time Equation

For data to arrive on time:

  Tcq + Tcomb < Tclk - Tsetup

Where:
  Tcq   = Clock-to-Q of source FF
  Tcomb = Combinational logic delay
  Tclk  = Clock period
  Tsetup = Setup time of destination FF

Example:
  Tcq = 0.2ns, Tcomb = 3ns, Tsetup = 0.1ns
  Tclk must be > 0.2 + 3 + 0.1 = 3.3ns
  Max frequency = 1/3.3ns = 303 MHz

Hold Time Violation

Data changes TOO FAST - before hold window ends.

│ Thold │ │←─────→│ │ │ DATA ─────────────┴───────┘ ← Data changes too soon after edge! CLK ─────────────┬───────────── │ Clock Edge PROBLEM: FF captures garbage!

Hold Time Equation

For hold to be met:

  Tcq + Tcomb > Thold

Where:
  Tcq   = Clock-to-Q of source FF (min)
  Tcomb = Combinational logic delay (min)
  Thold = Hold time of destination FF

If data arrives too fast, add delay buffers!

Critical Path

The longest path determines maximum clock frequency.

┌────┐ ┌─────────────────────┐ ┌────┐ D ──│ FF │───────►│ Long Logic Path │──────►│ FF │── Q │ A │ │ (critical!) │ │ B │ └─┬──┘ └─────────────────────┘ └─┬──┘ │ │ └───────────────── CLK ─────────────────────┘ Critical path delay = Tcq_A + Tlogic + Tsetup_B This limits your max frequency!

Finding Critical Path

Static Timing Analysis (STA) tools find critical paths:

Path 1: FF_A → AND → OR → MUX → FF_B = 2.5ns
Path 2: FF_A → BUF → FF_B = 0.5ns           ← Fast (not critical)
Path 3: FF_C → ADDER → FF_D = 4.2ns         ← CRITICAL PATH!

Max frequency = 1 / (4.2ns + Tsetup) = ~230 MHz

Clock Skew

Clock arrives at different times to different flip-flops.

Ideal (no skew): CLK_A ─────────────┬─────────── │ CLK_B ─────────────┬─────────── (same time) With skew: CLK_A ─────────────┬─────────── │ CLK_B ───────────────────┬───── (delayed!) |←───→| Tskew

Positive Skew

Destination clock is delayed. Helps setup, hurts hold.

Setup equation with skew:
  Tcq + Tcomb < Tclk - Tsetup + Tskew  ← Easier to meet!

Hold equation with skew:
  Tcq + Tcomb > Thold + Tskew          ← Harder to meet!

Negative Skew

Destination clock arrives early. Hurts setup, helps hold.

Clock Jitter

Variation in clock edge timing from cycle to cycle.

Ideal clock: Perfect spacing ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ────┘ └───┘ └───┘ └───┘ └───┘ └── With jitter: Variable spacing ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ────┘ └──┘ └────┘ └──┘ └───┘ └── |←→| |←→| Jitter

Jitter reduces timing margin. Must be accounted for in timing analysis.

Timing Paths

Register-to-Register (Reg2Reg)

FF → Combinational Logic → FF

Most common path. Constrained by clock period.

Input-to-Register (In2Reg)

Input Pin → Logic → FF

Constrained by input delay constraint.

Register-to-Output (Reg2Out)

FF → Logic → Output Pin

Constrained by output delay constraint.

Fixing Timing Violations

Setup Violations (Need More Time)

SolutionHow
Reduce clock frequencyIncrease clock period
PipelineAdd FF stages to break long paths
Use faster cellsLow-Vt cells (more power)
Optimize logicReduce gate count
Better placementReduce wire delay

Hold Violations (Path Too Fast)

SolutionHow
Add delay buffersInsert buffers in path
Use slower cellsHigh-Vt cells
Increase wire lengthRoute longer path

Timing Report Example

Startpoint: reg_a (rising edge-triggered flip-flop)
Endpoint:   reg_b (rising edge-triggered flip-flop)
Path Group: clk
Path Type:  max (setup check)

Point                        Incr   Path
---------------------------------------------
clock clk (rise edge)        0.00   0.00
reg_a/CK (rising edge)       0.05   0.05
reg_a/Q (Tcq)                0.15   0.20
U1/Y (AND2)                  0.10   0.30
U2/Y (OR2)                   0.12   0.42
U3/Y (MUX2)                  0.18   0.60
reg_b/D (setup)              0.08   0.68
data arrival time                   0.68

clock clk (rise edge)        1.00   1.00
reg_b/CK (clock path)        0.05   1.05
library setup time          -0.08   0.97
data required time                  0.97

slack (MET)                         0.29   ← Positive = GOOD!
Slack = Data Required Time - Data Arrival Time
Positive slack = Timing met
Negative slack = Timing violation!

Summary

ConceptKey Point
Setup TimeData stable BEFORE clock
Hold TimeData stable AFTER clock
TcqDelay from clock to output
Critical PathLongest path = max frequency limit
Clock SkewClock arrives at different times
SlackPositive = good, Negative = violation