---
title: Propagation delay and glitches
heading: Logic takes time, and the gaps can show
eyebrow: C7 · Lesson 19 · Propagation delay and glitches
xp: 50
---

::: hook
A gate's output doesn't change the instant its input does: it takes a few tens of picoseconds for the transistors to charge the next node. Those delays add up along every path through a circuit, and they set how fast a chip can be clocked. They also cause **glitches**: when two paths to an output have different delays, the output can flick briefly to the wrong value before settling, even though the truth table says it shouldn't change at all.

::: play
- A multiplexer built from gates, with both data inputs held at 1. The output should stay at 1 whatever S does.
- Watch Y on the timing diagram as S switches. What happens just after S falls from 1 to 0? (Each gate takes one tick.)
- Which path is slower when S falls: through the inverter or not?
:::
:::

```sim logic
input S, A, B
output Y
set A = 1
set B = 1
assign NS = ~S
assign P = S & A
assign Q = NS & B
assign Y = P | Q
stim S 1@0 0@8 1@20 0@32
wave: S, NS, P, Q, Y
time: 44
```

::: predict
## The mux above has A = B = 1, so its output should stay at 1. When S falls from 1 to 0, what does Y do?

- [ ] Stays at 1 throughout
- [x] Drops to 0 for one gate delay, then returns to 1
- [ ] Goes to 0 and stays
- [ ] Goes unknown

::: reveal
It dips to 0 for a moment. When S falls, the S·A term drops after one gate delay, but the $\bar S$·B term can't rise until the inverter has flipped, one delay later still. For that gap, both terms are 0. This is a **static hazard**. Adding the redundant term A·B, which the K-map would show bridges the two groups, keeps Y at 1 throughout.
:::
:::

::: nameit
## Timing

**Propagation delay** $t_{pd}$: from an input change to the output settling. The **critical path** is the slowest route from any input to any output; its total delay limits how fast the circuit can work.

**Ripple-carry adders** are slow because the carry may have to pass through every stage: an n-bit adder's worst case is about n carry delays. Faster adders (carry-lookahead, carry-select) compute carries in parallel at the cost of more gates.

**Clock speed.** In a clocked circuit, data leaves one flip-flop, passes through logic, and must arrive at the next flip-flop before its setup time:

$$T_\text{clk} \geq t_{cq} + t_\text{logic} + t_\text{setup} \qquad f_\text{max} = \frac{1}{t_{cq} + t_\text{logic} + t_\text{setup}}$$

where $t_{cq}$ is the flip-flop's clock-to-output delay.

**Glitches.** Unequal path delays can make an output pulse briefly before settling. In clocked designs they're harmless, because flip-flops sample only after everything has settled. They matter for signals that act immediately: an asynchronous reset, a clock enable, a chip select. A **static hazard** can be removed by adding the consensus term that covers the transition.
:::

```sim logic
input S, A, B
output Y
set A = 1
set B = 1
assign NS = ~S
assign P = S & A
assign Q = NS & B
assign R = A & B
assign Y = P | Q | R
stim S 1@0 0@8 1@20 0@32
wave: S, P, Q, R, Y
time: 44
```

The same mux with the consensus term A·B added. Y no longer dips.


::: example
## An 8-bit ripple-carry adder's carry takes 2 gate delays per bit, at 30 ps per gate. What is its worst-case delay?

::: solution
1. **Find the worst case.** It's when a carry starts at bit 0 and runs all the way to the top.
2. **Add up the delays.**
   $$\begin{aligned} t &= 8 \times 2 \times 30\ \text{ps} \\ &= 480\ \text{ps} \end{aligned}$$

**Answer:** 480 ps.
:::
:::

::: example
## In $f = AB + \bar AC$ with B = C = 1, A falls from 1 to 0. Why can f glitch, and what fixes it?

::: solution
1. **What f should do.** With B = C = 1, f should stay 1.
2. **Why it glitches.** AB turns off as soon as A falls, while $\bar AC$ turns on only after the inverter's delay: briefly both are 0.
3. **The fix.** Adding the consensus term BC, which is 1 throughout, holds f at 1.

**Answer:** AB turns off before $\bar AC$ turns on, so f briefly drops to 0; adding the consensus term BC fixes it.
:::
:::

::: example
## A register (clock-to-Q 50 ps) feeds the 8-bit ripple adder of the first example (480 ps), which feeds another register (setup 40 ps). What's the fastest clock?

::: solution
1. **Minimum period.**
   $$\begin{aligned} T_\text{clk} &\ge 50 + 480 + 40 \\ &= 570\ \text{ps} \end{aligned}$$
2. **Maximum frequency.**
   $$\begin{aligned} f_\text{max} &= \frac{1}{570\ \text{ps}} \\ &= 1.75\ \text{GHz} \end{aligned}$$
   The adder takes 84% of the cycle.
3. **With a faster adder.** A lookahead adder that finishes in 150 ps would allow 240 ps and 4.2 GHz.
4. **The register overhead.** Its 90 ps would then be more than a third of the cycle, which is why very fast designs also minimize their flip-flops' delays.

**Answer:** 1.75 GHz, from a 570 ps period.
:::
:::

::: check
given: n = 3 | 5 | 8; d = 10 | 20 | 50
answer: n*d
unit: ps
tolerance: 0.5%

## A path passes through {n} gates, each with a {d} ps delay. What's its delay?

::: right
Right. Delays add: {answer}.
:::

::: misses
- [d] Each gate adds its own delay.
- [any] Not yet. Multiply.
:::
:::

::: check
given: n = 8 | 16 | 32 | 64; d = 20 | 50
answer: n*d/1000
unit: ns
tolerance: 0.5%

## A ripple-carry adder of {n} bits has a carry delay of {d} ps per stage. Roughly how long might its carry take to ripple through?

::: right
Right. About n carry delays: {answer}.
:::

::: misses
- [n*d] Give it in nanoseconds.
- [any] Not yet. n stages × the carry delay.
:::
:::

::: check
given: tcq = 50 | 100; tl = 400 | 800 | 1500; ts = 30 | 60
answer: 1/((tcq + tl + ts)*1e-12)/1e6
unit: MHz
tolerance: 0.5%

## A path has $t_{cq}$ = {tcq} ps, {tl} ps of logic and a setup time of {ts} ps. What's the highest clock frequency it allows?

::: right
Right. $1/(t_{cq} + t_\text{logic} + t_\text{setup})$ = {answer}.
:::

::: misses
- [1/(tl*1e-12)/1e6] Include the flip-flop's clock-to-output and setup times.
- [any] Not yet. Add the three delays, then take the reciprocal.
:::
:::

::: check
kind: boolean
vars: S, A, B
answer: A & B
ops: and, or, not

## The mux $Y = \bar SA + SB$ has a static hazard when S switches with A = B = 1. What single product term, added to Y, removes it?

::: right
Right. A·B stays 1 throughout the switch, bridging the moment when neither $\bar SA$ nor SB holds Y up. Adding it doesn't change Y's truth table: it's redundant logically, but not in time.
:::

::: misses
- [~S & A] That's already in Y; it's one of the two terms handing over.
- [S & B] That's already in Y too.
- [any] Not yet. Which term is 1 whenever both data inputs are 1, whatever S is?
:::
:::

::: check
kind: choice

## Why are glitches usually harmless in a synchronous (clocked) design?

- [ ] Gates are too slow to glitch
- [x] Flip-flops sample their inputs only at the clock edge, after the logic has settled
- [ ] The clock filters them out
- [ ] Glitches can't happen with flip-flops

::: right
Right. As long as the clock period exceeds the critical path, every glitch is over before the next edge.
:::

::: misses
- [1] Any gate can glitch.
- [3] The clock doesn't filter; the timing does.
- [4] They still happen in the logic between flip-flops.
:::
:::

::: check
kind: parts
given: Tq = 30 | 60; L = 200 | 500 | 900; Ts = 20 | 50

## A register ($t_{cq}$ = {Tq} ps) feeds logic of {L} ps into a register with {Ts} ps of setup.

::: part
answer: Tq + L + Ts
unit: ps
tolerance: 0.5%

### What's the minimum clock period?

::: misses
- [any] $t_{cq} + t_\text{logic} + t_\text{setup}$.
:::
:::

::: part
answer: 1000/(Tq + L + Ts)
unit: GHz
tolerance: 0.5%

### What's the maximum clock frequency?

::: misses
- [any] $\frac{1}{T_\text{min}}$.
:::
:::
:::

::: check
kind: derivation
vars: n = 2..64, t = 0.000000000001..0.0000000001, c = 0.00000000001..0.0000000001, s = 0.00000000001..0.0000000001

## An n-bit ripple adder (2 gate delays of t per bit) sits between registers with clock-to-Q c and setup s.

::: step
answer: 2*n*t

### What's the adder's worst delay?
:::

::: step
answer: 1/(c + 2*n*t + s)

### What's the maximum clock frequency?
:::

::: right
Right. The adder's share of the cycle grows with its width.
:::
:::

::: explain
## How can a circuit whose truth table says the output shouldn't change still produce a brief pulse?

::: model
The truth table describes the output once everything has settled, but signals reach the output through different paths with different delays. When an input changes, the term that was holding the output at 1 may switch off a little before the term that takes over switches on. For that short gap neither term holds the output, so it briefly takes the wrong value. Once both paths have caught up, the output settles to what the truth table says.
:::
:::

::: practice

::: check
given: f = 100 | 500 | 1000
answer: 1e6/f
unit: ps
tolerance: 0.5%

## Clock period at {f} MHz, in ps?

::: misses
- [any] $1/f$.
:::
:::

::: check
given: T = 1 | 2 | 5; t1 = 0.1 | 0.2
answer: T - t1
unit: ns
tolerance: 0.5%

## A {T} ns clock period, with {t1} ns of flip-flop overhead. How much time is left for logic?

::: misses
- [any] Subtract.
:::
:::

::: check
given: n = 4 | 8 | 12 | 16 | 24 | 32 | 64; d = 1
answer: n
tolerance: 0

## If each stage passes the carry on in one tick, how many ticks can the carry take to ripple through {n} bits?

::: misses
- [any] One per stage.
:::
:::
:::
