A Complete Guide to JK Flip-flops

Last Modified:

What is a Flip-flop?

A flipโ€‘flop is an edgeโ€‘triggered bistable memory circuit that stores one bit of data. Unlike a latch, which is levelโ€‘sensitive and transparent while the enable signal is active, a flipโ€‘flop changes state only at a specific clock transition (rising or falling edge, also called, positive-edge or negative-edge, or simply posedge or negedge).

This synchronization with the clock makes flipโ€‘flops the fundamental building blocks of sequential logic, ensuring predictable timing and eliminating transparency issues.

this image shows the rising and falling edges of a clock signal

What is a JK flip-flop?

A JK flip-flop is a clocked bistable memory element designed to store one bit of data. It has a two inputs, J and K, and two complementary outputs (\(\mathsf{Q}\) and \(\mathsf{\overline{Q}}\)). ). At the chosen clock edge (positive or negative), the next state is determined by the combination of \(\mathsf{J}\) and \(\mathsf{K}\):

  • If \(\mathsf{J=0}\) and \(\mathsf{K=0}\), the output remains unchanged, holding the previous state.
  • If \(\mathsf{J=0}\) and \(\mathsf{K=1}\), the output resets, driving \(\mathsf{Q=0}\).
  • If \(\mathsf{J=1}\) and \(\mathsf{K=0}\), the output sets, driving \(\mathsf{Q=1}\).
  • If \(\mathsf{J=1}\) and \(\mathsf{K=1}\),, the output toggles, switching to the opposite of its current state.

Between clock transitions, the outputs remain stable, holding the stored state until the next clock event. This concise representation highlights the versatility of the JK flip-flop: it combines the functionalities of both D and T flip-flops, offering set and reset, as well as hold and toggle behavior in a single device.

Symbolic Representation of a JK Flip-flop

The symbol for a JK flip-flop shows a dual data input \(\mathsf{J}\) and \(\mathsf{K}\), a clock input clk, and two complementary outputs (\(\mathsf{Q}\) and \(\mathsf{\overline{Q}}\)).

  • The clock input is attached at a small notch on the symbol, indicating that the device is clockโ€‘controlled.
  • For a positiveโ€‘edge triggered JK flipโ€‘flop, the clock port is marked with a straight line entering the notch, showing that the output updates on the rising edge of the clock.
  • For a negativeโ€‘edge triggered JK flipโ€‘flop, the clock port carries a bubble at the notch, denoting that the output updates on the falling edge of the clock.
  • The outputs remain stable between clock transitions, holding the stored bit until the next active edge.
this image shows the Symbol of a Positive-edge Triggered JK Flip-flop
Symbol of a Positive-edge Triggered JK Flip-flop
this image shows the Symbol of a Negative-edge Triggered JK Flip-flop
Symbol of a Negative-edge Triggered JK Flip-flop

State Table of a JK Flip-flop

this image shows the state transition table of a JK flip-flop

This concise representation highlights the versatility of the JK flipโ€‘flop: at the active clock edge, the next state depends on the joint values of \(\mathsf{J}\) and \(\mathsf{K}\). When both inputs are equal, the device behaves like a T flipโ€‘flop โ€” holding its state when \(\mathsf{J=K=0}\) and toggling when \(\mathsf{J=K=1}\). When the inputs differ, the \(\mathsf{J}\) input acts like the data input of a D flipโ€‘flop โ€” driving the output high when \(\mathsf{J=1,K=0}\) and low when \(\mathsf{J=0,K=1}\). In this way, the JK flipโ€‘flop unifies the deterministic data behavior of the D flipโ€‘flop with the controlled toggle action of the T flipโ€‘flop, eliminating ambiguity and forbidden states while remaining strictly governed by the clock edge.

Timing Diagram of a JK Flip-flop

this image shows the timing diagram of a positive-edge triggered JK flip-flop

The timing diagram illustrates the behavior of a JK flipโ€‘flop with respect to its clock input. The signals shown are the clock (clk), the data input (\(\mathsf{D}\)), and the complementary outputs (\(\mathsf{Q}\) and \(\mathsf{\overline{Q}}\)).

  • At each rising edge (posedge) of the clock, the flipโ€‘flop samples the value present at \(\mathsf{J}\) and \(\mathsf{K}\) and responds accordingly.
  • The posedge at \(\mathsf{t_1}\) sees \(\mathsf{J=1,K=1}\) and hence toggles the output for the full cycle. The previous value at \(\mathsf{Q}\) as 0 which then changed to 1 for this cycle.
  • At \(\mathsf{t_3}\), \(\mathsf{J=K=0}\) and hence the output holds it previous value which was 1.
  • \(\mathsf{t_5}\) sees \(\mathsf{J}\) at 0 while \(\mathsf{K}\) at 1, hence the output acts like that of a D flip-flop and goes down to 0.
  • The rising edge at time step \(\mathsf{t_7}\) is presented with \(\mathsf{J=1, K=0}\), hence, the output goes high to 1.
  • The complementary output \(\mathsf{\overline{Q}}\) simultaneously takes the opposite value.
  • Between clock edges, the outputs remain stable, holding the last captured state regardless of changes at the data input.

This diagram emphasizes the edgeโ€‘triggered nature of the JK flipโ€‘flop: only at the positive clock transition do the inputs affect the outputs. Any changes in \(\mathsf{J}\) or \(\mathsf{K}\) while the clock is low or high (but not transitioning) have no immediate effect, ensuring predictable and synchronized operation in sequential circuits.

Hardware Implementation of a JK Flip-flop

A JK flipโ€‘flop can be implemented using a D flipโ€‘flop by appropriately driving the D input with a logic function of the \(\mathsf{J}\), \(\mathsf{K}\), and current output \(\mathsf{Q}\). The required input expression is:

\[\mathsf{D=JQ’+K’Q}\]

At the clock edge, this ensures the correct JK behavior: when \(\mathsf{J=0,K=0}\), the input to the D flipโ€‘flop equals \(\mathsf{Q}\), so the state holds; when \(\mathsf{J=0,K=1}\), the input forces \(\mathsf{Q}\) to reset to 0; when \(\mathsf{J=1,K=0}\), the input drives \(\mathsf{Q}\) to set at 1; and when \(\mathsf{J=1,K=2}\), the input becomes the complement of \(\mathsf{Q}\), producing a toggle. In this way, the D flipโ€‘flop, with its input modified by the \(\mathsf{J}\) and \(\mathsf{K}\) signals, replicates the full state transition behavior of a JK flipโ€‘flop, updating only at the active clock edge and remaining stable between transitions.

this image shows the implementation of a JK flip-flop using D flip-flop