Skip to content

Lec 02-20-2025: Sequential Circuits, Latches & Flip-Flops

A combinational circuit has no memory, its output depends only on its current inputs. That’s fine for things like adders, but it means the circuit can’t remember anything between moments. Sequential circuits fix this by adding memory: the output depends not just on current inputs, but on past inputs too. This is what allows a circuit to have state — a stored value that persists and influences future behavior.

The memory in a sequential circuit is held in flip-flops, which store one bit each. A clock is a signal that oscillates between 0 and 1 at a regular rate — it acts as a heartbeat for the circuit, controlling when stored values are allowed to change and keeping everything synchronized.

A synchronous sequential circuit is built around a feedback loop:

  • External inputs feed into a combinational circuit
  • The combinational circuit computes the outputs and the next state
  • The next state gets stored in flip-flops on the next clock change
  • The flip-flop outputs (the current state) feed back into the combinational circuit as additional inputs
Sequential circuit block diagram and clock pulse timing diagram: inputs feed into a combinational circuit alongside clock pulses, outputs go to flip-flops, and flip-flop outputs feed back into the combinational circuit as well as producing the overall circuit outputs

The clock timing diagram (part b) shows the regular square wave that drives this — state only updates at specific points in the clock cycle, so the circuit steps forward in discrete, predictable ticks rather than continuously reacting to every input change.

The most basic memory element is the RS latch, built from two cross-coupled NAND gates. It has two inputs — Set (SS) and Reset (RR) — and two complementary outputs QQ and QQ'.

RS latch circuit: two cross-coupled NAND gates with inputs R and S, outputs Q and Q'

Once we understand what the latch does, we can abstract away the internal gates and represent it as a single block — inputs on the left, outputs on the right:

RS latch schematic symbol: box with inputs R (top) and S (bottom) on the left, outputs Q and Q' on the right

This box notation is the standard way to represent flip-flops and latches in circuit diagrams. QQ and QQ' are intended to be complementary outputs — when one is 11, the other is 00.

The cross-coupling is what gives the latch memory: each gate’s output feeds back into the other gate’s input, so the circuit holds its last state even after the inputs return to 0.

The main behavior of the RS latch is as follows:

  • Set (S=1S=1, R=0R=0): forces Q=1Q=1, Q=0Q'=0
  • Reset (S=0S=0, R=1R=1): forces Q=0Q=0, Q=1Q'=1
  • Hold (S=0S=0, R=0R=0): QQ and QQ' retain their previous values
  • Forbidden (S=1S=1, R=1R=1): both outputs driven to 11, which breaks the QQ/QQ' complementary relationship — this state must be avoided

The characteristic table summarizes all possible input combinations and the resulting next state:

SRQ(t+1)00Q(t)01010111?\begin{array}{cc|c} S & R & Q(t+1) \\ \hline 0 & 0 & Q(t) \\ 0 & 1 & 0 \\ 1 & 0 & 1 \\ 1 & 1 & ? \\ \end{array}

A plain RS latch responds to inputs immediately, so any glitch on SS or RR can change the output. A clock input (enable) fixes this by acting as a gatekeeper — the latch only responds when clock = 1 (when the clock is high).

Clocked RS latch: AND gates on inputs R and S controlled by clock Ik, feeding into cross-coupled NAND gates producing outputs Q and Q-bar

When clock = 0, both AND gates block the inputs and the flip-flop holds its state regardless of SS and RR. When clock = 1, the inputs pass through:

ClkSRQ(t+1)0XXQ(t)100Q(t)10101101111?\begin{array}{c|cc|c} \text{Clk} & S & R & Q(t+1) \\ \hline 0 & X & X & Q(t) \\ 1 & 0 & 0 & Q(t) \\ 1 & 0 & 1 & 0 \\ 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & ? \\ \end{array}

The clock gates the inputs but doesn’t remove the forbidden state.

S=1S=1, R=1R=1 with clock=1 is still undefined. That limitation is what motivates the D flip-flop next.

The RS flip-flop still has the forbidden state problem. The D flip-flop eliminates it by having just one input D, where S=DS = D and R=DR = D' are wired internally — since DD and DD' are always opposites, the forbidden state can never occur.

D latch circuit: D input taps into a NOT gate, both D and D' feed into AND gates gated by Clk, whose outputs feed into cross-coupled NAND gates producing outputs Q and Q' D flip-flop box diagram

The D flip-flop has the simplest characteristic table of any flip-flop — the output just follows the input:

DQ(t+1)0011\begin{array}{c|c} D & Q(t+1) \\ \hline 0 & 0 \\ 1 & 1 \\ \end{array}

Beyond RS and D, two other flip-flop types come up often in sequential circuit design.

The JK flip-flop is an extension of the RS flip-flop that eliminates the forbidden state. JJ acts like Set and KK acts like Reset, but when both J=1J=1 and K=1K=1 (which was forbidden in RS), the flip-flop simply togglesQQ flips to whatever it wasn’t. This makes the JK flip-flop the most versatile of the common types.

JK flip-flop box diagram

The J=1J=1, K=1K=1 case is what sets JK apart — instead of a forbidden state, it toggles QQ:

JKQ(t+1)00Q(t)01010111Q(t)\begin{array}{cc|c} J & K & Q(t+1) \\ \hline 0 & 0 & Q(t) \\ 0 & 1 & 0 \\ 1 & 0 & 1 \\ 1 & 1 & Q'(t) \\ \end{array}

The T (Toggle) flip-flop has a single input TT. When T=0T=0 the output holds; when T=1T=1 the output toggles. It’s essentially a JK flip-flop with JJ and KK tied together, and is particularly useful for building counters.

T flip-flop box diagram

The toggle behavior is the simplest possible: T=0T=0 holds, T=1T=1 flips:

TQ(t+1)0Q(t)1Q(t)\begin{array}{c|c} T & Q(t+1) \\ \hline 0 & Q(t) \\ 1 & Q'(t) \\ \end{array}