Skip to content
GATEiit

GATE EC · Digital Circuits

Latches and flip-flops

SR and D latches, edge-triggered and master-slave flip-flops, the SR, JK, D and T characteristic and excitation tables, the race-around condition, and converting one flip-flop into another.

Before you start

  • Boolean algebra →

    Characteristic equations and conversion logic are Boolean expressions to simplify.

  • Logic gates →

    A latch is two cross-coupled NOR or NAND gates; you must know their truth tables cold.

  • Karnaugh maps →

    Flip-flop conversion and excitation logic are minimised with K-maps using the don't-cares.

This topic comes before: Counters, Finite state machines, Propagation delay, ROM, SRAM, DRAM, Setup and hold time, Shift-registers

Concept notes

1. The SR latch: memory from feedback

A latch stores one bit by feeding each gate's output back to the other gate's input. It has two stable states, Q=1 (set) and Q=0 (reset), with Q‾ the complement.

NOR SR latch (active-high inputs): Q=R+Q‾‾, Q‾=S+Q‾.

S R NOR latch S‾ R‾ NAND latch
0 0 hold 1 1 hold
1 0 Q=1 0 1 Q=1
0 1 Q=0 1 0 Q=0
1 1 not allowed: Q=Q‾=0 0 0 not allowed: Q=Q‾=1

The NAND latch has active-low inputs, so its hold and forbidden rows are swapped compared with the NOR latch.

The forbidden input is a problem for two reasons: the outputs are no longer complements, and if both inputs then return to the inactive level at the same time, the final state depends on which gate is faster (a race), so it is unpredictable.

Adding an enable (clock) input in front of S and R gives a gated SR latch: the latch responds only while enable is active, and holds otherwise.

RSQQ'NORNOR
NOR SR latch: each gate's output feeds the other gate's input. R resets Q to 0, S sets Q to 1, S = R = 0 holds.

2. D latch, edge triggering and master-slave

The gated D latch removes the forbidden input by driving S=D and R=D‾. While enable is high the latch is transparent: Q follows D, and every change of D reaches Q. When enable goes low, Q holds the last value. A latch is level-sensitive.

A flip-flop is edge-triggered: it samples its input only at a clock edge (rising or falling) and ignores the input at all other times. So a positive-edge D flip-flop changes at most once per clock cycle, just after the rising edge.

A master-slave flip-flop is two latches in series with opposite enables. While the clock is high the master is transparent and the slave holds; when the clock falls the master closes and the slave copies it. The output therefore changes only once per cycle, at the clock edge where the master closes.

Asynchronous inputs. Preset (PR) and clear (CLR) force Q=1 or Q=0 at once, without waiting for the clock. They are often active low and override the synchronous inputs.

In timing diagrams the difference is clear: the latch output copies every wiggle of D during the enable pulse, while the flip-flop output only takes the value D had at the edge.

CLKDQ latchQ flip-flop↑↑↑
Same CLK and D into a D latch (transparent while CLK is high) and a positive-edge D flip-flop (samples D only at the rising edges, marked ↑). Both start at 0.

3. Characteristic and excitation tables

The characteristic equation gives the next state Q+ (after the active edge) from the inputs and the present state Q.

Flip-flop Behaviour Characteristic equation
SR 00 hold, 10 set, 01 reset, 11 not allowed Q+=S+R‾Q, with SR=0
JK 00 hold, 10 set, 01 reset, 11 toggle Q+=JQ‾+K‾Q
D Q+ copies D Q+=D
T 0 hold, 1 toggle Q+=T⊕Q=TQ‾+T‾Q

The excitation table works the other way: for a wanted transition, which inputs are needed? X is a don't-care.

Q→Q+ S R J K D T
0 → 0 0 X 0 X 0 0
0 → 1 1 0 1 X 1 1
1 → 0 0 1 X 1 0 1
1 → 1 X 0 X 0 1 0

Two quick facts used everywhere: for D, the input simply equals the next state; for T, the input is 1 exactly when the state must change. The JK row has the most don't-cares, which is why JK designs often need the least logic.

A D flip-flop with D=Q‾, or a T or JK flip-flop held at T=1 or J=K=1, toggles every clock, so its output has half the clock frequency.

4. Race-around in the JK flip-flop

In a level-triggered JK latch with J=K=1, the output toggles. But the toggled output is fed back to the input gates while the clock is still high, so it toggles again, and again, for as long as the clock stays high. This is the race-around condition. At the end of the pulse the state is unpredictable.

It happens when the clock pulse width tp is longer than the propagation delay tpd of the latch.

Ways to avoid it:

  • Keep tp<tpd<Tclk. This works in principle but is hard to guarantee in practice.
  • Use a master-slave JK: the master responds while the clock is high, but its output does not reach the slave (and so the feedback) until the clock falls. Only one toggle can happen per cycle.
  • Use an edge-triggered JK flip-flop, which responds only at the edge.

A master-slave JK still has a weakness called ones catching: if J or K has a brief glitch to 1 while the clock is high, the master can catch it and the slave copies it at the falling edge. Edge-triggered flip-flops do not have this problem.

Race-around is a JK (and T) issue only. With J=K=1 removed (an SR latch) or with D, the input does not depend on the present output, so repeated toggling cannot occur.

5. Converting one flip-flop into another

To build flip-flop B from an available flip-flop A, add combinational logic in front of A. The steps:

  1. Write the characteristic table of the wanted flip-flop B: its inputs and Q give Q+.
  2. For each row, read from A's excitation table the inputs A needs to make that Q→Q+ transition.
  3. Minimise each input of A as a function of B's inputs and Q, using the don't-cares.

Standard results to remember:

Wanted From Logic
T JK J=K=T
D JK J=D, K=D‾
T D D=T⊕Q
JK D D=JQ‾+K‾Q
D SR S=D, R=D‾
T SR S=TQ‾, R=TQ

When the available flip-flop is a D, the answer is always just the wanted characteristic equation, because D=Q+.

For circuit questions where several flip-flops share a clock, every flip-flop uses the old values of the other outputs at an edge. Tabulate present state, inputs and next state edge by edge rather than updating one flip-flop and then using its new value for the next.

Formulas to remember

SR flip-flop
Q+=S+R‾ Q,SR=0
JK flip-flop
Q+=J Q‾+K‾ Q
D flip-flop
Q+=D
T flip-flop
Q+=T⊕Q
Toggle frequencyAny flip-flop wired to toggle on every active edge
fout=fclk2
Race-around conditionLevel-triggered JK with J=K=1; avoided by master-slave or edge triggering
tp>tpd

Common mistakes

  • Using the NOR latch truth table for a NAND latch; NAND inputs are active low, so 00 is forbidden and 11 is hold.
  • Treating a latch like a flip-flop in a timing diagram; a latch output follows every change of D while enabled.
  • Using a flip-flop's new output as another flip-flop's input at the same edge; all flip-flops on a common clock see the old values.
  • Mixing up characteristic and excitation tables; the first gives the next state, the second gives the inputs needed for a transition.
  • Saying a master-slave JK suffers race-around; it removes race-around, though it can still catch glitches on J and K.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Tracing a JK flip-flop

numerical

A positive-edge JK flip-flop starts with Q=0. The inputs (J,K) at five successive rising edges are (1,0), (1,1), (0,0), (1,1), (0,1). Find Q after each edge.

  1. Step 1: Apply the first two edges.

    Try it on paper first.

Example 2: Building a T flip-flop from an SR flip-flop

numerical

Find the logic for S and R so that an SR flip-flop behaves as a T flip-flop.

  1. Step 1: List the T behaviour for each T and Q.

    Try it on paper first.

Example 3: Two flip-flops on one clock

numerical

Flip-flop A is a JK with J=K=1. Flip-flop B is a D flip-flop with D=QA. Both share a rising-edge clock and start at QAQB=00. List the states for four clock edges.

  1. Step 1: What does each flip-flop do at an edge?

    Try it on paper first.

Example 4: Why a level-triggered JK can misbehave

conceptual

A level-triggered JK latch with J=K=1 has propagation delay 20 ns and is clocked with a 100 ns wide high pulse. What happens, and how can it be fixed?

  1. Step 1: Compare the pulse width with the delay.

    Try it on paper first.

Previous year questions

4 official GATE EC questions on this topic, newest first.

Topic test

10 questions: up to 4 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE EC syllabus; being checked by a reviewer. Updated 2026-11-28. Spotted a mistake? Use Report an issue on any question, or contact us.