Home / Learn Chip Programming / Timing Diagrams, Setup and Hold

Timing Diagrams, Setup and Hold

Timing diagrams show signals over time. Every bus and chip datasheet uses them.

In shortTiming diagrams show signals over time. Every bus and chip datasheet uses them.

Theory in plain words

Around the clock edgeData stable (setup)CLOCK EDGEData stable (hold)Output changes after tco
Around the clock edge

What it is

A timing diagram plots each signal as a horizontal waveform. Setup time is how long data must be stable before the clock edge; hold time is how long after.

Why we use it

If you violate setup or hold, the receiving flip-flop can capture the wrong value or go metastable. Reading timing diagrams is required for I2C, SPI, memory and display interfaces.

How it works

Find the active clock edge. Check that data is stable for tsu before it and th after it. Check the minimum pulse width and the maximum clock frequency in the datasheet.

Where it is used

  • SPI modes (CPOL, CPHA)
  • Memory and LCD parallel interfaces
  • FPGA timing closure

Setup and hold checker

Is the data captured correctly?Try it Yourself

Move the data change into the red window and see the violation. Slow the clock or fix the path delay to repair setup problems; hold violations need extra delay on the data.

TermMeaning
tsu (setup)data stable before the clock edge
th (hold)data stable after the clock edge
tco (clock to output)delay from the edge to the output change
tpd (propagation delay)delay through combinational logic
Fmaxhighest clock: 1 / (tco + tpd + tsu)
Duty cyclepercent of the period the clock is high

Quick quiz

1. What is hold time?

2. How do you fix a setup violation?

Common questions

What is hold time?

Data must remain stable after the clock edge. The data must not change for th after the edge.

How do you fix a setup violation?

Slow the clock or shorten the path. Give the signal more time or shorten the logic.