MOULDLKnowledge BaseElectrical Knowledge Base3D Model DownloadsMembership
中文版Model Store »
Knowledge Base › Electrical Knowledge Base › What setup time and hold time mean for a flip-flop
HomeModels
Table of contents

On this page

Electrical & Electronic Basics (600 articles)

Quick Reference

  • PLC & Programming
  • Electrical & Electronic Basics (monthly)(每月更新中)
  • Electrical Control & Drawings (monthly)(每月更新中)
  • Drives & Actuators (monthly)(每月更新中)
  • Sensors & Detection (monthly)(每月更新中)
  • Industrial Communication & Networks (monthly)(每月更新中)
  • HMI & Host Systems (monthly)(每月更新中)
  • Industrial Robots & Motion Control (monthly)(每月更新中)
  • Mechatronic System Integration (monthly)(每月更新中)
  • Fault Diagnosis & Standards (monthly)(每月更新中)

What setup time and hold time mean for a flip-flop

Setup and hold times are the bottom line that keeps a flip-flop sampling correctly; violating them yields wrong data or metastability. This page defines both windows, gives typical numbers and shows how to stay clear of them.

1. How it works

Setup time t_su is the minimum time the data D must already be stable before the active clock edge. For a 74LS74 it is about 20ns, meaning D may not change during the last 20ns before the edge. If D is still moving inside that window the flip-flop can sample an intermediate level, the output becomes undefined and the device may enter metastability, hanging between high and low.

2. Numbers and practice

Hold time t_h is the minimum time D must stay stable after the clock edge, about 5ns on a 74LS74. It guarantees the internal structure has grabbed the data. If D is withdrawn too early after the edge the grab fails and the sample is wrong. t_su guards stability before, t_h after; together they bound the legal sampling window.

3. Pitfalls and fixes

How to stay safe: design the clock tree so the skew between flip-flops stays below t_h, otherwise a downstream stage changes before an upstream one has been captured. Combinational delays must satisfy longest path plus t_su less than the clock period. On fast boards run static timing analysis path by path instead of trusting gut feeling; window violations show up as rare wrong numbers or outright lockups.

4. Setup and hold time key points

ParameterDefinitionTypicalViolation result
t_suStable before edgeAbout 20nsMetastable or wrong sample
t_hStable after edgeAbout 5nsGrab fails
t_pdOutput delayAbout 25nsTiming shift
SkewClock arrival differenceBelow t_hHold violation
PeriodClock intervalAbove path plus t_suSetup violation
STAStatic analysisPath by pathFinds trouble early

5. Notes

After routing the board run timing analysis and confirm positive margin on setup and hold for every path. Keep clock skew under t_h, and be extra careful at high speed.

6. References

The quantities and component characteristics discussed here follow current national standards and the corresponding IEC documents: Digital circuit timing per GB/T 4728 and IEC 60748 series. Always check the device datasheet and the product design file for ratings and derating.

7. Cautions

⚠️ Three common pitfalls:
① D still toggling inside the t_su window:a half-level is sampled, Q metastable or wrong
② Clock skew larger than t_h:the next stage grabs before D has settled, a hold violation
③ Delays estimated by experience without analysis:rare wrong numbers at speed, days to trace

Locate the issue with the approach above, then confirm with measurements; safety-related circuits must follow the standards and manufacturer requirements.

Related reading

Related 3D models: Ready to build it? Download free 3D models & CAD drawings at MOULDL »
MOULDL · Electrical Knowledge Base · free self-study reference for electrical & automation engineers, 3D CAD models at MOULDL