Timing Analysis & Critical Paths
Digital Logic Design · Hardware Foundations track
7 min read
In this module
The Speed of Logic
A logic circuit doesn't produce its output instantly. Signals must propagate through transistors and wires, each adding delay. The longest delay path through a circuit dictates the maximum clock speed. Understanding timing analysis explains why processors are clocked at specific frequencies, why pipelining exists, and how architects squeeze out more speed.
Gate Delay and Propagation
Every logic gate carries a propagation delay: the time between an input change and the corresponding output change. For a modern 5 nm process:
- Inverter (NOT): ~5-10 picoseconds
- NAND/NOR (2-input): ~10-20 ps
- Complex gate (XOR): ~20-40 ps
- Multiplexer: ~15-30 ps
These delays are influenced by:
- Transistor size: Larger transistors switch faster but consume more power and area
- Fan-out: Driving more gates increases the capacitive load, slowing the output transition
- Wire length: Longer interconnects add resistance and capacitance (RC delay)
- Supply voltage: Lower voltage means slower switching
The Critical Path
The critical path is the longest delay path from any input to any output in a combinational circuit. It sets the minimum clock period (and thus the maximum clock frequency):
The critical path here runs through A/B -> AND (15ps) -> OR (12ps) -> AND (15ps) = 42ps. The path through C -> NOT (8ps) -> OR (12ps) -> AND (15ps) = 35ps is shorter and doesn't limit the clock. The path through D -> AND (15ps) = 15ps is shorter still.
The maximum clock frequency works out to roughly 1/42ps = 23.8 GHz for this toy circuit. Real processors have critical paths threading through thousands of gates, landing them at clock periods of 200-300ps (3-5 GHz).
Finding the critical path is the central problem in digital timing analysis. Static Timing Analysis (STA) tools trace every path through the circuit, computing the cumulative delay along each one. The longest path determines the clock period. Architects pour enormous effort into shortening critical paths, because shaving even a handful of picoseconds across the chip pays back as higher clock speed.
Setup and Hold Time
Flip-flops (the sequential elements that store state between clock cycles) have strict timing requirements:
- Setup time (t_su): The data input must be stable for at least t_su before the rising clock edge. Miss this and the flip-flop captures the wrong value or slides into a metastable state (neither 0 nor 1).
- Hold time (t_h): The data must stay stable for at least t_h after the clock edge. Violating hold time corrupts the captured value.
- Clock-to-Q (t_cq): After the clock edge, the flip-flop's output becomes valid after t_cq.
The Timing Equation
For a signal passing through combinational logic between two flip-flops:
T_clock >= t_cq + t_logic + t_suwhere:
- T_clock is the clock period
- t_cq is the source flip-flop's clock-to-Q delay
- t_logic is the propagation delay through the combinational logic (critical path)
- t_su is the destination flip-flop's setup time
Violate this equation and the destination flip-flop receives data too late, capturing the wrong value. That's a setup time violation, and it's the primary constraint on clock speed.
Clock Skew
In an ideal circuit, the clock signal lands at every flip-flop simultaneously. In reality, the clock has to travel through a distribution network (the clock tree) to reach thousands of flip-flops scattered across the chip. The difference in arrival times between two flip-flops is clock skew.
If the clock arrives 50ps late at FF2, the combinational logic gets 50ps of extra time. Helpful for setup, but a hazard for hold violations. Clock tree synthesis tools work hard to minimise skew across the chip, typically targeting less than 5% of the clock period.
Clock skew is the spatial variation in clock arrival time across the chip (deterministic, caused by different wire lengths). Clock jitter is the temporal variation in clock edges at a single point (random, caused by power supply noise and thermal fluctuations). Both reduce the available time for useful logic computation.
Why Pipelining Works (from a Timing Perspective)
Pipelining is fundamentally a timing optimisation. Consider a datapath that takes 2000ps from input to output through 5 logical stages:
| Without Pipelining | With Pipelining |
|---|---|
| Clock period: 2000ps + t_cq + t_su | Clock period: 400ps + t_cq + t_su |
| Throughput: 1 result per 2000+ps | Throughput: 1 result per 400+ps |
| Latency per instruction: same | Latency per instruction: slightly more (register overhead) |
Insert flip-flops between stages and each stage's critical path drops to ~400ps instead of 2000ps. The clock can run nearly 5x faster. Each instruction still takes 5 cycles (about the same total latency, slightly more once the flip-flop overhead is added), but a new instruction completes every cycle (5x throughput).
The cost is the flip-flop overhead (t_cq + t_su) tacked onto each stage boundary. If the stages aren't balanced (one stage takes 600ps while others take 300ps), the slowest stage sets the clock period. Pipeline balancing, making every stage take the same time, is a major design optimisation.
Static Timing Analysis in Practice
Modern chip design relies on Static Timing Analysis (STA) tools that:
- Build a timing graph of all paths through the circuit
- Annotate each node with gate delays (from characterised standard cell libraries)
- Compute wire delays using parasitic extraction (resistance and capacitance of metal wires)
- Check every path against setup and hold timing constraints
- Report violations (paths that are too slow or too fast)
From there the design team iterates: resize gates on critical paths, add buffers to long wires, restructure logic to reduce depth, or shuffle the pipeline partitioning. Timing closure can take weeks on a substantial processor design.
Security Connection
Timing analysis matters for security:
- Constant-time cryptography: Cryptographic algorithms must take the same time regardless of input data. If an AES implementation has data-dependent critical paths (different paths through an S-box lookup based on key bits, for instance), timing measurements can leak the key.
- Timing side channels: Variations in execution time due to cache misses, branch mispredictions, or memory access patterns leak information. Once you see that these variations trace back to physical propagation delays through different circuit paths, the link between software timing attacks and hardware reality clicks into place.
- Glitch attacks: Briefly under-clocking or over-volting a chip causes timing violations that corrupt specific computations. If an attacker can land the violation on a security check, they bypass it.