Introduction to Flip Flops

What are Flip Flops?

Outside of the basic logic gates, perhaps the most fundamental building block of digital logic systems is the flip flop. While the name may bring to mind sandals and beaches, this type of flip flop is as far removed as it can be. In the context of digital logic, a flip flop is a circuit with two stable states, essentially on and off. These states can be used to store data, and this data can be changed by adjusting the inputs to the flip flop circuit. This builds the core functionality of the most basic digital storage element.

Types of Flip Flops

SR Flip Flop

SR Flip Flop Circuit Diagram (TutorialsPoint)

Four of these flip flops exist, each one providing slightly different functionality. The simplest of these four is the SR flip flop. This design has two inputs; S, the set input line, and R, the reset line. There are also two outputs in this design, Q and Qn. Q is a direct match to S while Qn is the inverse of the set input line. The truth table for an SR flip flop can be seen in the following table.

SRQQn
0001
0101
1010
11ZZ
SR Truth Table

As seen in the truth table of the SR flip flop, there’s one major downside to the SR flip flop. It’s possible to assert both the set line and the reset line at the same time. When this happens it causes contention on the output lines, resulting in a high impedance conflict state. While this can be useful in specific situations, it’s generally not ideal for a binary state data storage system.

JK Flip Flop and T Flip Flop

JK Flip Flop Circuit Diagram (TutorialsPoint)

Due to the downside of the SR flip flop, mentioned in the previous section, additional flip flop designs are necessary. The JK flip flop solves this issue by modifying the internal gate structure. Rather than using the two input AND gates, JK flip flops use three input and gates, allowing for feedback from the outputs, essentially making the next state dependent not just on J and K but also the current state of the flip flop. This results in the following truth table.

JKQ_curQ_nxtQn_curQn_nxt
000011
001100
010011
011001
100110
101100
110110
111001
JK Truth Table

An evolution of the JK flip flop is the T flip flop. By connecting the J and K inputs together from the JK flip flop, a circuit is created that will only transition on a clock edge. The T flip flop truth table and schematic are as follows.

T Flip Flop Circuit Diagram (TutorialsPoint)
TQ_curQ_nxtQn_curQn_nxt
00011
01100
10110
11001
T Truth Table

D Flip Flop

D Flip Flop Circuit Diagram (TutorialsPoint)

The fourth and final flip flop is perhaps the most widely used. Similar to the T flip flop, it has a single input and only transitions on a clock edge. The main difference is that by adding an inverter between the two input AND gates, a circuit is created whose next state output is always equal to the current input. This design does not examine the current state as part of the condition for the next state. Rather relying purely on the clock to transition to the next state and always passing the current input as the output in the next state. Resulting in the following truth table.

DQ_nxtQn_nxt
001
110
D Truth Table

Common Flip Flop Uses

Perhaps the most common use of flip flops is for counters, however they are also commonly used in the design of shift registers, storage registers and frequency/clock dividers. Their ability to ripple data through a sequence of flip flops is instrumental to these applications. These use cases will be further examined and explained in future posts and pages.