What are latches and flip-flops?

Just like logic gates, the latches and flip-flops are the important elements of an electronic circuit. The logic gates form the important part of combinatorial circuits, while the latches and flip-flops form the essential part of a sequential circuit. Sequential circuits form the important concept of automata theory in electronics and electrical engineering, these circuits are a kind of logic circuit whose output depends on both present input and past inputs, that is, the input history.

Latches are built from logic gates, while flip-flops are built from latches. As indicated earlier, the output signals of a circuit consisting of latches and flip-flops will depend both on the input and history of input signals. Moreover, a latch does not possess a clock signal, whereas it is present on flip-flops. In synchronous digital circuits, a clock signal is generated by a clock generator. Clock signals oscillate between a high state and a low state, and it acts as an indicator by producing sounds to specify the actions of a digital circuit. Clock signals are also known as logic beats.

Generation of clock signals is achieved by using complex circuit arrangements, but the square waves form the basic waveform characteristics of a clock signal with a 50% duty cycle and constant frequency. Clock signals are used almost in all the integrated circuits (ICs) to obtain synchronous operation of different components. Asynchronous circuits such as asynchronous CPUs are an exception, these circuits do not rely on the clock signal for coordinating actions of their circuit components.

In this article, a basic introduction about the concepts behind latches and flops have been provided, with a brief difference between the two outlined as a summary.

Latches and types of latches

A latch is a level-triggered logic, which means its output can change as soon as its input changes, hence it is also known as level-sensitive. The latches have two stable states, they are high and low, or active-low states. Hence, due to this characteristic, latches are also known as bistable-multivibrators. Latches generally act as storage devices, which hold data using the feedback lane. The different types of latches are discussed in this section below.

S-R latch

The S-R latch, also called set-reset latch is a kind of asynchronous device, which is specially used to control signals in a digital circuit. The S-R latch is characterized by two inputs, the set input, that is, the S input, and the reset input, that is, R input. Q and P are its two outputs. In the S-R latch design, the NOR gates are connected in a cross-coupled arrangement to achieve the logic circuit. The S-R latch depends on S inputs and R inputs. However, this circuit can also be achieved using the NAND gate. The below image shows the arrangement of an S-R latch with Q output and P output, along with its truth table next to it.

Arrangement of a S-R latch using NOR gates.
CC BY 2.0 | Image credits: https://en.wikipedia.org | Napalm Llama
SRQP
00latchlatch
0101
1010
1100
Table. 1: Truth table for S-R latch.

D-latch

The D-latch is similar to the D flip-flop. This logic circuit has two inputs, the data input, that is, D input and the enable input, E input. When the enable is set to 1, the output of the latch is exactly the same as the input to the data input. When the enable is set to 0, the output of the latch becomes independent of the value of D input.

JK latch

In the JK latch, there are two inputs J and K with two outputs A and B. It is similar to the S-R latch. The outputs in this type of latches are activated when both the J and K inputs are high. In the JK latch, there is output feedback that is not present in the S-R latch. The truth table for the JK latch is given below.

Flip-flops and types of flip-flops

Flip-flops are edge-triggered logic circuits, which means they only change their state when the signal moves from a high state to a low state and vice-versa. In digital electronics, flip-flops are used to store bits of data using the logic gates. These stored data can be changed by varying the inputs. There are various types of flip-flops, some of them are outlined below.

S-R flip-flop

The S-R flip-flop or set-reset flip-flop is the most common type of flip flop. There are two types of input in the S-R flip-flop, the set input, that is, S input, and the reset input, that is, R input. The circuit has two outputs, the Q output, and the B output. Setting the S in active mode, there is a high signal in the Q output and a low signal in the B output. Once these outputs are achieved, the circuit is maintained at this state till the S or the R input reaches the maximum level. The truth table for the S-R flip-flop is shown below.

SRQB
0001
0101
1010
11UndefinedUndefined
Table. 2: Truth table for S-R flip-flop.

JK Flip-flop

The S-R flip-flop fails in the sense that, when S=1 and R=1, the outputs are infinity or undefined. This drawback is solved by using a JK flip-flop. In the JK flip-flop, for S=R=1, the resultant output is not undefined. But, instead of S and R as the inputs, they are replaced by J input and K input. If the inputs in the J and K are high and low respectively, the outputs get inverted, that is, Q becomes low and B becomes high. If J and K both are low values, then there is no change observed in the circuit. The truth table for the JK flip-flop is represented below.

JKQB
0000
0100
1001
1101
0011
0110
1011
1110
Table. 3: Truth table for JK flip-flop.

D flip-flop

The D flip-flop or D-type flip-flop is a popular type of flip-flop used extensively in digital electronics. There are many uses of D flip-flops such as input synchronization, counters and shift-registers, and so on. It generally has two inputs, the D input and the other is a clock input. The outputs (Q and B) are affected by the clock input, but during this time, if the D input changes, the output is not affected. The table summarizes the truth table for the D flip-flop.

ClockDQB
0001
1001
0101
1110
Table. 4: Truth table of D flip-flop.

T flip flop

The T flip-flops are the modified version of the JK flip-flops. The T flip-flops have two inputs namely T input and a clock input. While the outputs are Q and B. The specialty of T flip-flops is that they have the ability to complement their states.

Difference between latches and flip-flops

In this section, a brief difference in the form of summary has been provided about the latches and flip-flops.

LatchesFlip-flops
Latches are transparent and level-triggered, the inputs are directly connected to the output. And also they are sensitive to the pulse duration.Flip-flops are edge-triggered and consist of a pair of latches. They are sensitive to pulse transitions. The signal fluctuates between high and low states.
The latches require less area on the circuit board due to less number of gates used. Flip-flops uses more circuit area because it uses more gates.
Consumes less powerConsumes more power
They are fast in responseThey are slow in response
More manual calculations are required to make sure they meet the required timing.They can be easily calculated using static timing analysis tools.
Table. 5: Difference latches and flip-flops.

Context and Applications

This topic is widely used in many undergraduate and postgraduate degree courses of:

  • Bachelors in Technology (Electronics Engineering)
  • Bachelors in Technology (Electrical Engineering)
  • Masters in Technology (Electrical and Electronics Engineering)

Practice Problems

1. Which of the following is true for the S-R latch?

  1. Its output depends on S inputs and R inputs.
  2. Its output depends on R inputs only.
  3. Its output depends on S inputs only.
  4. Its output depends on the positive edge.

Answer: Option a

Explanation: The S-R latch has two inputs- the S input and the R input. The output of the S-R latch is only affected when the state of the inputs changes. Hence, it can be said that the S-R latch depends on the S inputs and R inputs.

2. What does R represent in the S-R flip-flop?

  1. R represents the reset input.
  2. R represents the clock input.
  3. Both a and b
  4. None of these

Answer: Option a

Explanation: The S-R flip-flop consists of two inputs. They are S input and R input. The R here represents the reset input, whereas S represents the set input.

3. Which of the following is known as edge-triggered?

  1. NAND gates
  2. NOR gates
  3. S-R latches
  4. Flip-flops

Answer: Option d

Explanation: The flip-flops are known as edge-triggered logic circuits or preferably, they are known as edge-triggered flip-flops. These circuits only change their state when the signal moves from a higher value to a lower value and vice-versa.

4. Which of the following is known as level-triggered?

  1. D flip-flops
  2. latches
  3. T flip-flops
  4. XOR gates

Answer: Option b

Explanation: The latches are known as level-triggered or level-sensitive because their outputs immediately change as soon as their inputs change.

5. Which of the following circuit components uses a clock signal?

  1. ICs
  2. Microprocessors
  3. Resistors
  4. Both a and b

Answer: Option d

Explanation: Clock signals are used by both ICs and microprocessors. The clock signals are created by a signal generator and are used to coordinate the operation of various circuit components. In a CPU, clock signals are associated with a microprocessor and are generated by a crystal oscillator.

Want more help with your electrical engineering homework?

We've got you covered with step-by-step solutions to millions of textbook problems, subject matter experts on standby 24/7 when you're stumped, and more.
Check out a sample electrical engineering Q&A solution here!

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.

Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.

Tagged in
EngineeringElectrical Engineering

Digital Electronics

Sequential Logic Circuit

Latches and Flip-Flops

Latches and Flip Flop Homework Questions from Fellow Students

Browse our recently answered Latches and Flip Flop homework questions.

Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.

Tagged in
EngineeringElectrical Engineering

Digital Electronics

Sequential Logic Circuit

Latches and Flip-Flops