Timing is what decides whether a synchronous design works at its target clock speed. These are the key points every logic designer should have in mind, from clock skew and the critical path to setup and hold violations and why latches make timing harder.
The key points at a glance
- In a synchronous design, all memory elements, flip-flops and latches, are synchronized by a master clock.
- A timing diagram is used to graphically describe what happens at each flip-flop or latch output on every clock cycle.
- Clock distribution circuits are designed to minimize clock skew and jitter. Clock skew is point-to-point variation in the clock arrival time, while jitter is cycle-to-cycle variation.
- The critical path is the slowest logic path in the design.
- Flip-flops sample the input D and transfer it to the output Q at each rising or falling edge of the clock.
- The logic input D must not change during the setup time before, and the hold time after, the clock edge.
- A setup violation occurs when the input D arrives during or after the setup window for the critical path under worst-case timing conditions. The usual fix for a setup violation is to reduce the logic delay.
- A hold violation occurs when new data races through the fastest path and reaches the next flip-flop before the hold time is over, under best-case timing conditions. The usual fix is to insert logic delay.
- Latches are level-sensitive devices.
- Preventing setup violations can be easier with latches because latch D inputs can change while the clock is high. Exploiting this fact is called "cycle stealing".
- Preventing hold violations is much harder with latches because the clock high time is added to the hold requirement. Thus latch-based designs are not recommended.
- Cell libraries are carefully characterized for timing. To calculate the delay through a library cell, you need to know its load capacitance.
- Timing analysis is performed during and after synthesis, and again before fabrication.
Why timing matters
A synchronous circuit moves data from one register to the next once per clock cycle. Between two registers sits a cloud of combinational logic. If that logic is too slow, the next register captures the wrong value; if it is too fast, the next register can lose the value it was supposed to hold. Both failures produce a chip that works on the simulator and fails on the bench, so timing must be checked for every register-to-register path.
Setup and hold in plain words
Think of a flip-flop as a camera that takes a picture of its D input at the clock edge. Setup time is how long the scene must be still before the shutter fires; hold time is how long it must stay still afterward. Setup problems come from slow paths and limit the clock frequency. Hold problems come from fast paths and do not depend on the clock frequency at all, which is why a hold violation cannot be fixed by slowing the clock.
Skew and jitter
The clock does not arrive at every flip-flop at the same instant. The fixed difference in arrival time between two flip-flops is skew; the variation of one clock edge from cycle to cycle is jitter. Both eat into the timing budget, which is why clock trees are built and balanced with care.
Flip-flops or latches?
A flip-flop is edge-triggered: it captures data at one instant. A latch is transparent for the whole time the clock is high (or low). That transparency lets a slow path borrow time from the next stage, but it also opens a wide window for fast paths to race through. Most ASIC and FPGA teams use flip-flops by default and keep latches for specific cases such as clock gating cells.
Deep dive: the numbers and details
This part holds the equations and a worked example. Skip it if the overview is all you need.
Setup and hold equations
Take a launch flip-flop FF1 and a capture flip-flop FF2, with combinational logic between them. Define skew as the clock arrival time at FF2 minus the arrival time at FF1. Then:
Setup: Tclk + t_skew >= t_cq(max) + t_logic(max) + t_setup Hold: t_cq(min) + t_logic(min) >= t_hold + t_skew
A positive skew (capture clock late) helps setup and hurts hold. A negative skew does the opposite. Course notes such as the UP Microlab CoE 197U timing page describe skew and jitter the same way and note that, with jitter, the worst-case period shrinks to T minus 2 t_jitter. Sign conventions for skew differ between textbooks, so always check which one a course or tool uses.
Worked example
Assume these values:
| Parameter | Value |
|---|---|
| Clock-to-Q, max / min | 120 ps / 80 ps |
| Logic delay, max / min | 650 ps / 40 ps |
| Setup time | 60 ps |
| Hold time | 50 ps |
| Skew (capture minus launch) | +30 ps |
Setup: Tclk + 30 >= 120 + 650 + 60 = 830 ps, so Tclk >= 800 ps and the maximum frequency is 1 / 800 ps = 1.25 GHz.
Hold: 80 + 40 = 120 ps must be at least 50 + 30 = 80 ps. The margin is 40 ps, so hold is met. If the skew grew to +80 ps, the requirement would be 130 ps and the path would fail by 10 ps; a delay buffer of at least 10 ps on the short path would fix it.
Why the corners differ
Setup is checked at the slow corner (slow process, low voltage, and the temperature that makes the cells slowest), because that is where the long path is longest. Hold is checked at the fast corner, because that is where the short path is shortest. A path can pass one check and fail the other, so sign-off tools check both at every relevant corner.
Time borrowing with latches
With a positive latch, data can arrive after the rising edge as long as it settles before the latch closes on the falling edge. If a path needs 1.1 ns in a 1.0 ns cycle with a 50% duty cycle, it can borrow 0.1 ns from the next stage, provided the next stage has at least 0.1 ns of slack. The cost is on the hold side: for a latch that opens on the opposite phase, the hold check must allow for the full transparent phase, which is the "clock high time" penalty mentioned in the list above.
Cell delay and load
Library cells are characterized as tables of delay and output transition time against input transition time and output load capacitance. A gate driving a long wire and many inputs is slower than the same gate driving one input, so the delay of every arc depends on the netlist around it. That is why timing is first estimated with wire-load models during synthesis, then recomputed with extracted parasitics after placement and routing.
When timing analysis runs
| Step | What is checked | Wire model |
|---|---|---|
| During synthesis | Setup on all paths, as the tool sizes and restructures logic | Wire-load models or physical estimates |
| After synthesis | Setup and hold sign-off of the netlist against constraints | Estimates |
| After place and route | Setup, hold, transition and capacitance limits at all corners | Extracted parasitics |
| Before tape-out | Final static timing sign-off, including signal integrity effects | Extracted parasitics |
Interview angle
Expect questions such as: "Why can't you fix a hold violation by lowering the clock frequency?" (the hold equation has no Tclk term), "Does positive skew help or hurt?" (helps setup, hurts hold) and "Where would you add delay to fix hold?" (on the data path of the short path, close to the capture flip-flop, without making a setup path worse).


Thanks the blog is really good. I would really appreciate if you could throw some light on the set-up holdtime and how to prevent them if case they are violations.
ReplyDeleteAlso expaling more about cycle-stealing concept.
I think a b-latch (transparent when clock is low) would have setup/hold at rising clock edge and therefore would not have the hold-time problem of a normal latch.
ReplyDelete