Draft preview. Lessons are being written and reviewed.

Digital Design / Module 4: Sequential logic

22. Setup and hold: the two promises

Learn the rule behind all digital timing.

Lecture coming soon

Lab: Setup and hold lab

The idea

A flop makes two demands of its data, and all of digital timing rests on them:

  • Setup time: the data must be stable for a short time before the clock edge.
  • Hold time: the data must stay stable for a short time after the edge.

Why these exist

The master needs a little time to take in the new value before it closes, which gives setup time. Closing takes a moment too, and a change arriving during that moment could get in, which gives hold time. The values come from the library data for each cell. Hold can even be negative, which means the data may change slightly before the edge.

What happens if you break them

The flop might capture the old value, or the new one, or enter a state, where the internal node sits between 0 and 1 for an unpredictable time. The crossing module looks at this in detail.

Two different problems

A setup violation means the logic is too slow for the clock. Slow down the clock, and it goes away. A hold violation means data arrives too quickly, racing through to the next flop and corrupting the capture. It compares launch and capture at the same edge, so the clock period doesn't appear in the check. The exception is a half-cycle path between a rising-edge flop and a falling-edge flop, where the period does matter.

SetupHold
ProblemData arrives too lateData changes too soon
Depends on clock periodYesNo
Typical fixFaster logic, slower clockAdd delay to the data path

Common mistake

Assuming hold can be repaired after manufacture by running the chip more slowly. It can't, which is what makes hold violations so dangerous: such a chip fails at every frequency. Use the lab above to move the data transition around the edge and see each violation.

Key ideas

  • Setup: data is stable before the edge.
  • Hold: data stays stable after the edge.
  • Breaking either can make the flop metastable.

Your exercise

Mark violations on a supplied timing diagram.

Interview questions

coreCan hold be fixed by slowing the clock?

basicDefine setup time and hold time for a flop.

basicWhat can a flop do if its data changes inside the setup-hold window?

coreA path has clock-to-Q of 0.2 ns, worst-case logic delay of 1.5 ns and a capture flop setup time of 0.1 ns, with no clock skew. What is the shortest clock period and the highest frequency?

coreOn a path between two flops, the shortest clock-to-Q is 0.10 ns and the shortest logic delay is 0.05 ns. The capture flop's hold time is 0.08 ns, and its clock arrives 0.10 ns later than the launch flop's. Is hold met, and what is the fix if not?

coreWhere do setup and hold time come from inside a master-slave flop?

coreA library flop lists a hold time of -0.02 ns. What does a negative hold time mean, and does it make hold violations impossible?

advancedData is launched by a rising-edge flop and captured by a falling-edge flop. The clock period is 4 ns with a 50% duty cycle, clock-to-Q is 0.2 ns and setup is 0.1 ns. What is the longest allowed logic delay, and how does this path's hold check differ from a normal full-cycle path?

advancedTo fix a setup violation, someone proposes delaying the clock to the capture flop by 0.3 ns. What does this do to that path's setup and hold, and what else should you check?

Practise these 9 questions with animations