IAE Academy

FOR CORE AND IT JOBS · CHAPTER 4 OF 7

Latches, flip-flops and timing

This chapter builds a stored bit from two inverters, then a latch and an edge-triggered flip-flop, and checks a register-to-register path for setup and hold. It ends with metastability and the two-flip-flop synchroniser. You need it to decide how fast a clocked circuit can run and why it can fail.

Updated 30 Oct 2026

What you will be able to do

You will see why two inverters in a loop hold a bit, and how two latches make a flip-flop. You will check setup and hold for a path between two flip-flops, with numbers, including skew and jitter. You will explain metastability and work out how much a two-flip-flop synchroniser raises the mean time between failures.

Before you start

  1. Chapter 3, Delay, power and scaling

  2. The CMOS inverter: transfer characteristic, switching threshold, small-signal gain, outputs at the rails V_DD and 0 V

  3. Solving a linear inequality for one unknown

  4. Exponential growth, e^x and the natural logarithm

  5. Basic probability: the chance that an evenly spread value falls in a range, and an event rate times a probability as an expected rate

From two inverters to a flip-flop

A gate has no memory: its output follows its inputs. To remember, feed the output back. Connect inverter 1's output, node X, to the input of inverter 2, and inverter 2's output, node Q, back to the input of inverter 1. The loop has two stable states, and a small push away from the middle is amplified until one of them is reached.

BISTABLE LOOP CONDITION

Holds for ideal logic levels. Each solution reproduces itself round the loop, so it holds while power is on.

LOOP GAIN AT THE MIDDLE

Holds for two identical inverters at the balance point, where both nodes sit at the switching threshold (input equals output, about for a symmetric inverter). , : magnitudes of the small-signal voltage gains there (dimensionless). Above 1, an offset grows each trip round the loop until the nodes reach the rails, and 0 V.

The loop has no input. A latch adds one: a switch that breaks the loop and lets the data input D drive it during one phase of the clock CLK, a signal alternating between 0 and 1 (the latch is then transparent), and closes the loop to hold the bit in the other phase. A flip-flop uses two latches in series, the master and the slave, transparent in opposite phases. The table is for a rising-edge flip-flop, one that acts at the rising edge: the instant CLK goes from 0 to 1.

Element

CLK = 0

CLK = 1

Master latch (transparent when CLK = 0)

Follows D

Holds the value D had at the rising edge

Slave latch (transparent when CLK = 1)

Holds its old value

Follows the master, which is holding

Output Q of the pair

Unchanged

Takes the value held by the master

EDGE-TRIGGERED BEHAVIOUR

Holds for an ideal rising-edge master-slave flip-flop (its timing limits come in the next section). is Q just after the rising edge; the right side is D just before it. D is copied once per cycle, so a change on D during either clock phase reaches Q only at the next rising edge.

WATCH OUT FOR

Latch versus flip-flop. Test: hold CLK at one level and change D, then repeat at the other level. If Q follows D at either level, it is a latch. If Q moves only at a clock edge, it is a flip-flop.

Setup, hold and the timing of a path

The master latch needs D to be steady for a short time before the edge closes it (setup time, ) and for a short time after (hold time, ). After the edge, Q does not move at once: it settles after the clock-to-Q delay . Take two flip-flops with logic between them, whose slowest path takes and fastest path . Flip-flop 1 launches data at an edge and flip-flop 2 captures it at the next. Checking the two inequalities below on every such path, from the delays alone, is static timing analysis.

The clock reaches the two flip-flops through different wires and buffers, so the same edge arrives at slightly different times. Skew is the capture clock's arrival time minus the launch clock's arrival time, so positive skew means the capture clock is late.

SETUP CONSTRAINT

Holds for a path launched at one edge and captured at the next. Data leaves after , crosses the slowest logic in , and must arrive before the capture edge, which comes at . All in ps or ns.

HOLD CONSTRAINT

Holds for the same two flip-flops. New data, launched at an edge through the fastest path, must not reach flip-flop 2 until after the capture clock's copy of that same edge, which arrives late. If the flip-flop quotes a separate minimum clock-to-Q, use it here. does not appear.

SETUP WITH JITTER

Holds when is the worst-case amount by which one clock period can come out shorter than (ps). Skew is fixed by the clock wiring; jitter, from noise in the clock source, varies cycle to cycle. Hold compares one edge at both flip-flops, not two edges a period apart, so the hold check takes no jitter term.

WORKED EXAMPLE

Flip-flop 1 feeds flip-flop 2 through logic. t_clk-q = 50 ps, t_setup = 30 ps, t_hold = 20 ps, t_logic,max = 120 ps, t_logic,min = 40 ps. Skew and jitter are zero. Find the smallest clock period, the highest clock frequency and the hold slack (the left side of the hold constraint minus its right side).

Solution
  1. Setup limits the period. Add the delays the data must complete in one cycle: 50 + 120 + 30 = 200 ps, so ps.

  2. Frequency is the inverse of the period: GHz.

  3. Hold uses the fastest path: 50 + 40 = 90 ps against + skew = 20 + 0 = 20 ps.

  4. Slack: 90 - 20 = 70 ps. It is positive, so hold is met. is not in the hold inequality, so this is true at any clock frequency.

Answer: T_clk,min = 200 ps (5 GHz); hold slack = 70 ps.

WORKED EXAMPLE

Same flip-flops and the same 120 ps longest path, but the capture clock arrives 60 ps late (skew = +60 ps) and jitter is 10 ps. The shortest logic path is only 20 ps. Find the smallest clock period and check hold.

Solution
  1. Setup with jitter: 50 + 120 + 30 + 10 - 60 = 150 ps. Positive skew gives the data extra time, lowering the minimum period from 210 ps (with jitter, no skew) to 150 ps.

  2. Hold: the left side is 50 + 20 = 70 ps. The right side is 20 + 60 = 80 ps.

  3. 70 is less than 80, so hold fails by 10 ps. The skew that helped setup hurt hold.

  4. Slowing the clock does not help, because is not in the hold inequality. Add at least 10 ps of delay (a buffer) on the short path, at a point the 120 ps path does not pass through, so the longest path and the setup result are unchanged.

Answer: Setup is met for T_clk of 150 ps or more; hold fails by 10 ps until at least 10 ps of delay is added to the short path.

WATCH OUT FOR

Assuming a hold failure can be fixed by running slower. Test: look for T_clk in the hold inequality. It is absent, so only t_clk-q, the fastest path, the skew or the hold time can change the result.

Metastability and the synchroniser

If D changes inside the setup and hold window, the flip-flop may capture neither 0 nor 1: its loop is left near the middle. There each inverter amplifies the offset and charges its node capacitance, so the offset grows at a rate proportional to itself. That is exponential growth, with a regeneration time constant : less node capacitance, or more drive current per volt of offset, makes smaller. A signal from another clock domain (a group of flip-flops driven by an unrelated clock) can change at any instant, so this happens occasionally.

RESOLUTION TIME

Holds while the loop acts as a linear amplifier, taken to last until the offset reaches , with . : offset from the middle when the loop closes (V). : regeneration time constant (ps). : offset read as a logic level (V). Set and take ln of both sides.

A two-flip-flop synchroniser puts a second flip-flop right after the first, both on the clock of the receiving domain, with no logic between. The first one is allowed to go metastable. The second samples it one full period later, so the first has almost a whole period to resolve.

TIME AVAILABLE TO RESOLVE

Holds for a flip-flop that may go metastable feeding the next flip-flop, with no skew. Its output must cross logic of delay and reach a valid level before the next edge; in a synchroniser . : the receiving clock's period. All in ps or ns.

A failure needs two things. First, a data change must land within a short window of a clock edge, close enough to leave the offset below . Second, the loop must need longer than . Approximately, a metastable flip-flop's Q settles later than its usual after the edge, so it fails if , that is , or . Take as proportional to how far from the balance instant (the change time that leaves the loop exactly at the middle) the change fell, with change times spread evenly, so is equally likely to be anywhere from 0 to . The chance of the second condition is then .

FAILURE RATE AND MEAN TIME BETWEEN FAILURES

Holds under the two assumptions above (changes unrelated to the clock; spread evenly from 0 to ). changes per second each land in a window with chance ( in s, edges per second), and a fraction of those outlast . : failures per second; MTBF in s.

WATCH OUT FOR

Believing a synchroniser removes metastability. Test: the MTBF formula is finite for any finite . Extra time only raises it exponentially.

Check yourself

CHECK YOURSELF 1

A rising-edge master-slave flip-flop has its master transparent when CLK = 0. D was 0 at the last rising edge, so Q is 0. Later in the same CLK = 1 phase, well clear of the hold time, D changes from 0 to 1. What does Q do from then until the next rising edge?

  1. (A)

    Follows D and becomes 1 at once

  2. (B)

    Stays 0

  3. (C)

    Becomes 1 when CLK falls

  4. (D)

    Goes to the middle level

Answer and solution

Answer: (B)

  1. With CLK = 1 the master is closed, holding the 0 that D had at the rising edge.

  2. The slave follows the master, so Q stays 0.

  3. When CLK falls, the master follows D (now 1) but the slave holds, so Q still stays 0 until the next rising edge.

CHECK YOURSELF 2

A path has t_clk-q = 60 ps, t_logic,max = 240 ps, t_setup = 40 ps. Skew and jitter are zero. Find the smallest clock period in ps.

Answer and solution

Answer:

  1. Setup: T_clk is at least t_clk-q + t_logic,max + t_setup.

  2. 60 + 240 + 40 = 340 ps.

CHECK YOURSELF 3One or more options are correct

A path fails the hold constraint. Which changes can remove the failure?

  1. (A)

    Lower the clock frequency

  2. (B)

    Insert delay buffers in the shortest logic path

  3. (C)

    Reduce the skew (make the capture clock arrive earlier relative to the launch clock)

  4. (D)

    Make the longest logic path faster

Answer and solution

Answer: (B), (C)

  1. Hold requires t_clk-q + t_logic,min >= t_hold + skew, and T_clk is absent, so A does nothing.

  2. Buffers raise t_logic,min, which helps (B).

  3. A smaller skew lowers the right side, which helps (C).

  4. The longest path does not appear in the hold inequality (D).

CHECK YOURSELF 4

A signal from an unrelated clock enters flip-flop 1, clocked with T_clk = 1000 ps. t_clk-q = 60 ps, t_setup = 40 ps, = 100 ps and skew is zero. In design P, flip-flop 1 drives 700 ps of logic into flip-flop 2. In design S, flip-flop 2 follows with no logic between (a two-flip-flop synchroniser). T_0, f_clk and f_data are the same in both. By what factor is the MTBF of S larger than that of P? Give the nearest whole number.

Answer and solution

Answer: (accepted range )

  1. P: t_r = 1000 - 60 - 700 - 40 = 200 ps.

  2. S: t_r = 1000 - 60 - 0 - 40 = 900 ps.

  3. T_0, f_clk and f_data cancel in the ratio, so MTBF_S / MTBF_P = .

  4. , so about 1097.

Used in these GATE topics