Module 3: Sequential Circuit Design · 3.1 Latches & Flip-Flops

JK and T Flip-Flops

A digital designer can implement any sequential logic function using D flip-flops and combinational input logic. Modern electronic design automation (EDA) tools synthesize all sequential elements into D flip-flops.

However, understanding JK and T flip-flops remains important. Many legacy systems, datasheets, and reference architectures use these devices. Furthermore, their excitation tables clarify the mathematical principles of state-machine synthesis.

For example, consider a toggle operation where a bit inverts on each clock cycle. A D flip-flop requires an external inverter to connect $\bar{Q}$ to $D$. A T flip-flop includes this toggle function internally.

The JK Flip-Flop

The JK flip-flop includes two control inputs: $J$ (set) and $K$ (reset).

Unlike the basic SR latch, the JK flip-flop defines the input condition $J = K = 1$. This condition commands the flip-flop to invert its current state (toggle mode).

The truth table summarizes the four input modes:

J K $Q_{\text{next}}$ Operating Mode
0 0 $Q$ Hold
0 1 0 Reset
1 0 1 Set
1 1 $\bar{Q}$ Toggle

You can derive the characteristic equation using a Karnaugh map with variables $J$, $K$, and present state $Q$:

$$Q_{\text{next}} = J\bar{Q} + \bar{K}Q$$

To build a JK flip-flop using a standard D flip-flop, apply this equation to input $D$ using two AND gates and one OR gate:

$$D = J\bar{Q} + \bar{K}Q$$

Figure 1 shows this logic implementation.

JK from a D flip-flop
Figure 1: A JK flip-flop constructed from a D flip-flop and combinational gating logic

Figure 2 shows the timing response of the JK flip-flop. The circuit samples inputs $J$ and $K$ only at rising clock edges.

JK timing
Figure 2: The JK flip-flop samples inputs J and K at each rising clock edge

The T Flip-Flop

The Toggle (T) flip-flop has a single control input, $T$.

  • When $T = 0$, the device holds its current state.
  • When $T = 1$, the device inverts its state on each active clock edge.

The characteristic equation uses the XOR operator:

$$Q_{\text{next}} = T \oplus Q$$

To build a T flip-flop from a D flip-flop, connect an XOR gate to input $D$ (Figure 3):

$$D = T \oplus Q$$

T from a D flip-flop
Figure 3: A T flip-flop constructed from a D flip-flop and an input XOR gate

A classic application of the T flip-flop is the asynchronous ripple counter (Figure 4). Connect the $T$ inputs of three flip-flops to logic 1. Clock the second and third flip-flops with the output of the preceding stage.

The first stage divides the clock frequency by 2. The second stage divides the frequency by 4. The third stage divides the frequency by 8. Together, the three stages count from 0 to 7 in binary.

Ripple counter
Figure 4: Three T flip-flops configured as an asynchronous ripple counter

Modern standard cell libraries and FPGA architectures contain only D flip-flops. Synthesis compilers map JK and T behavioral descriptions onto D flip-flop primitives automatically.

Excitation Tables

An excitation table specifies the required control inputs that force a desired state transition from $Q$ to $Q_{\text{next}}$.

For a D flip-flop, the excitation requirement is direct:

$$D = Q_{\text{next}}$$

$Q$ $Q_{\text{next}}$ Required D
0 0 0
0 1 1
1 0 0
1 1 1

For a JK flip-flop, two input combinations can cause each transition, creating don’t-care conditions ($X$):

$Q$ $Q_{\text{next}}$ Required J Required K
0 0 0 X
0 1 1 X
1 0 X 1
1 1 X 0

To transition from 0 to 0, input $J$ must be 0 while $K$ can be 0 (hold) or 1 (reset). To transition from 0 to 1, input $J$ must be 1 while $K$ can be 0 (set) or 1 (toggle).

For a T flip-flop, the input must be 1 when the state changes:

$$T = Q \oplus Q_{\text{next}}$$

This summary table compares the excitation requirements for all three types:

State Transition ($Q \to Q_{\text{next}}$) Required D Required J Required K Required T
$0 \to 0$ 0 0 X 0
$0 \to 1$ 1 1 X 1
$1 \to 0$ 0 X 1 1
$1 \to 1$ 1 X 0 0

These excitation tables allow manual synthesis of sequential circuits. Designers write the desired state transition sequence, look up required inputs, and simplify the logic using Karnaugh maps.

Practice Exercises

Problem 1

A JK flip-flop has current state $Q = 1$. The inputs are $J = 1$ and $K = 0$. Determine the next state $Q_{\text{next}}$.

Solution

Apply the characteristic equation:

$$Q_{\text{next}} = J\bar{Q} + \bar{K}Q = (1 \cdot 0) + (1 \cdot 1) = 0 + 1 = 1$$

Because $J = 1$ and $K = 0$, the flip-flop operates in set mode. The next state is 1.

Problem 2

Construct a T flip-flop from a JK flip-flop without using external logic gates.

Solution

Connect input $T$ to both control inputs $J$ and $K$ ($J = K = T$).

Substitute into the characteristic equation:

$$Q_{\text{next}} = T\bar{Q} + \bar{T}Q = T \oplus Q$$

When $T = 0$, $J = K = 0$ (hold mode). When $T = 1$, $J = K = 1$ (toggle mode). The circuit functions as a T flip-flop.

Problem 3

Use the JK excitation table to determine the minimal logic equations for a 2-bit binary synchronous counter ($00 \to 01 \to 10 \to 11 \to 00$).

Solution

Construct the state transition and excitation table:

$Q_1$ $Q_0$ $Q_1^+$ $Q_0^+$ $J_1$ $K_1$ $J_0$ $K_0$
0 0 0 1 0 X 1 X
0 1 1 0 1 X X 1
1 0 1 1 X 0 1 X
1 1 0 0 X 1 X 1

Minimize the logic functions using the don’t-care states:

  • For bit 0: $J_0 = 1$ and $K_0 = 1$. Bit 0 toggles on every clock cycle.
  • For bit 1: $J_1 = Q_0$ and $K_1 = Q_0$. Bit 1 toggles when bit 0 equals 1.

The next article examines the fundamental timing metrics of sequential circuits: setup time, hold time, and clock-to-Q delay.

← The D Flip-Flop Setup, Hold and Clock-to-Q →