Latches and Flip-Flops

Sequential circuits and memory, the SR latch, level- and edge-triggering, SR, D, JK and T flip-flops with characteristic and excitation tables, race-around, converting between flip-flops, and timing limits.

A sequential circuit has memory: its outputs depend on the inputs and on its current state, which is stored in flip-flops. In a synchronous circuit the state changes only at clock edges, so everything stays in step.

The SR latch

Two cross-coupled NOR gates store one bit. Inputs S (set) and R (reset):

SRNext Q
00Q (hold)
010 (reset)
101 (set)
11Invalid: both outputs forced to 0, and the final state is unpredictable when S and R return to 0 together

A NAND version has active-low inputs (S′ R′ = 00 is the invalid case).

Level- versus edge-triggering

  • A latch is level-sensitive: while its enable (clock) is high, the output follows the inputs. Inputs that change during that time pass straight through.
  • A flip-flop is edge-triggered: it samples its inputs only at the clock edge (rising or falling) and holds the result for the whole cycle. This makes synchronous design predictable.

The four flip-flops

Flip-flopCharacteristic equation (next state Q⁺)Behaviour
SRQ⁺ = S + R′Q (with SR = 0)Set, reset, hold; S = R = 1 not allowed
DQ⁺ = DStores D at each clock edge (delay)
JKQ⁺ = JQ′ + K′QLike SR, but J = K = 1 toggles
TQ⁺ = T ⊕ QT = 1 toggles, T = 0 holds

JK truth table:

JKQ⁺
00Q (hold)
010 (reset)
101 (set)
11Q′ (toggle)

The same behaviour as a state diagram, with the two states Q = 0 and Q = 1 (X = either value):

0X1XX0X1Q=0Q=1
State diagram of a JK flip-flop (labels are J, K)

Excitation tables

To design a circuit, we know the transition we want (Q → Q⁺) and need the inputs that cause it. X means "don't care".

Q → Q⁺SRJKDT
0 → 00X0X00
0 → 1101X11
1 → 001X101
1 → 1X0X010

The many don't cares make JK flip-flops convenient for design by K-map.

def jk(q, j, k):
    return (j & (1 - q)) | ((1 - k) & q)

def t_ff(q, t):
    return q ^ t

q, trace = 0, []
for j, k in [(1, 0), (0, 0), (1, 1), (1, 1), (0, 1), (1, 1)]:
    q = jk(q, j, k)
    trace.append(q)
print("JK, starting at Q = 0:", trace)

q, trace = 1, []
for t in [1, 1, 0, 1, 0, 0, 1]:
    q = t_ff(q, t)
    trace.append(q)
print("T, starting at Q = 1: ", trace)
Output
JK, starting at Q = 0: [1, 1, 0, 1, 0, 1]
T, starting at Q = 1:  [0, 1, 1, 0, 0, 0, 1]

Race-around

In a level-triggered JK latch with J = K = 1, the output toggles, feeds back, and toggles again, as long as the clock stays high: it oscillates, and the final value is unpredictable. This is the race-around condition. It occurs when the clock pulse is longer than the propagation delay. Fixes: a master–slave JK flip-flop (the master samples while the clock is high, the slave copies it when the clock goes low) or an edge-triggered flip-flop.

Converting one flip-flop into another

Use the excitation table of the available flip-flop to express its inputs in terms of the desired flip-flop's inputs and Q:

  • JK from D: D = JQ′ + K′Q (the JK characteristic equation).
  • T from JK: J = K = T.
  • D from JK: J = D, K = D′.
  • T from D: D = T ⊕ Q.
  • D from T: T = D ⊕ Q.

Timing

  • Setup time tsu: the input must be stable this long before the clock edge.
  • Hold time th: it must stay stable this long after the edge.
  • Propagation delay tpd (clock-to-Q): how long after the edge the output changes.

Between two flip-flops with combinational logic in between, the clock period must allow a signal to leave one flip-flop, pass through the logic and settle before the next edge:

Tclk ≥ tpd + tcomb + tsu, so fmax = 1 / (tpd + tcomb + tsu).

Practice questions

GATE-styleNAT · numerical answer

A flip-flop has a clock-to-Q delay of 5 ns and a setup time of 3 ns, and the combinational logic between flip-flops takes 10 ns. What is the maximum clock frequency in MHz? Give the answer to one decimal place.

Show answer and explanationAnswer: 55.6

The minimum period is 5 + 10 + 3 = 18 ns, so fmax = 1 / 18 ns ≈ 55.6 MHz.

GATE-styleNAT · numerical answer

A JK flip-flop starts with Q = 0 and receives, at successive clock edges, (J, K) = (1, 0), (0, 0), (1, 1), (1, 1), (0, 1), (1, 1). What is Q after the last edge?

Show answer and explanationAnswer: 1

Set → 1, hold → 1, toggle → 0, toggle → 1, reset → 0, toggle → 1.

GATE-styleMCQ · one correct answer

To make a T flip-flop from a D flip-flop, what must D be?

Show answer and explanationAnswer: C

A T flip-flop needs Q⁺ = T ⊕ Q, and a D flip-flop gives Q⁺ = D, so D = T ⊕ Q (an XOR gate in front of the D input).

GATE-styleMCQ · one correct answer

In the excitation table of a JK flip-flop, what inputs are needed for the transition Q = 1 → Q⁺ = 0?

Show answer and explanationAnswer: B

From Q = 1, K = 1 forces a 0: with J = 0 it resets, with J = 1 it toggles. Either way Q⁺ = 0, so J is a don't care.

GATE-styleMSQ · one or more correct answers

Which statements are true? (Select all that apply.)

Show answer and explanationAnswer: A, B, D

With J = K = 1 and the clock high, the latch toggles repeatedly. Edge triggering samples once per cycle. S = R = 1 is the invalid input of a NOR latch (S = R = 0 holds). The master–slave design lets the output change only after the inputs have been captured.