d-type flip flop

The D-type Flip Flop

One of the main disadvantages of the basic SR NAND Gate bistable circuit is that the indeterminate input condition of SET = “0” and RESET = “0” is forbidden.

This state will force both outputs to be at logic “1”, over-riding the feedback latching action and whichever input goes to logic level “1” first will lose control, while the other input still at logic “0” controls the resulting state of the latch.

But in order to prevent this from happening an inverter can be connected between the “SET” and the “RESET” inputs to produce another type of flip flop circuit known as a Data Latch, Delay flip flop, D-type Bistable, D-type Flip Flop or just simply a D Flip Flop as it is more generally called.

The D Flip Flop is by far the most important of the clocked flip-flops as it ensures that ensures that inputs S and R are never equal to one at the same time. The D-type flip flop are constructed from a gated SR flip-flop with an inverter added between the S and the R inputs to allow for a single D (data) input.

Then this single data input, labelled D, is used in place of the “set” signal, and the inverter is used to generate the complementary “reset” input thereby making a level-sensitive D-type flip-flop from a level-sensitive RS-latch as now S = D and R = not D as shown.

D-type Flip-Flop Circuit

d-type flip flop


We remember that a simple SR flip-flop requires two inputs, one to “SET” the output and one to “RESET” the output. By connecting an inverter (NOT gate) to the SR flip-flop we can “SET” and “RESET” the flip-flop using just one input as now the two input signals are complements of each other. This complement avoids the ambiguity inherent in the SR latch when both inputs are LOW, since that state is no longer possible.

Thus this single input is called the “DATA” input. If this data input is held HIGH the flip flop would be “SET” and when it is LOW the flip flop would change and become “RESET”. However, this would be rather pointless since the output of the flip flop would always change on every pulse applied to this data input.

To avoid this an additional input called the “CLOCK” or “ENABLE” input is used to isolate the data input from the flip flop’s latching circuitry after the desired data has been stored. The effect is that D input condition is only copied to the output Q when the clock input is active. This then forms the basis of another sequential device called a D Flip Flop.

The “D flip flop” will store and output whatever logic level is applied to its data terminal so long as the clock input is HIGH. Once the clock input goes LOW the “set” and “reset” inputs of the flip-flop are both held at logic level “1” so it will not change state and store whatever data was present on its output before the clock transition occurred. In other words the output is “latched” at either logic “0” or logic “1”.

Truth Table for the D-type Flip Flop

Clk D Q Q Description
↓ » 0 X Q Q Memory
no change
↑ » 1 0 0 1 Reset Q » 0
↑ » 1 1 1 0 Set Q » 1

Note that: and indicates direction of clock pulse as it is assumed D-type flip flops are edge triggered

The Master-Slave D Flip Flop

The basic D-type flip flop can be improved further by adding a second SR flip-flop to its output that is activated on the complementary clock signal to produce a “Master-Slave D-type flip flop”. On the leading edge of the clock signal (LOW-to-HIGH) the first stage, the “master” latches the input condition at D, while the output stage is deactivated.

On the trailing edge of the clock signal (HIGH-to-LOW) the second “slave” stage is now activated, latching on to the output from the first master circuit. Then the output stage appears to be triggered on the negative edge of the clock pulse. “Master-Slave D-type flip flops” can be constructed by the cascading together of two latches with opposite clock phases as shown.

The Master-Slave D Flip Flop Circuit

master slave d-type flip flop circuit


We can see from above that on the leading edge of the clock pulse the master flip-flop will be loading data from the data D input, therefore the master is “ON”. With the trailing edge of the clock pulse the slave flip-flop is loading data, i.e. the slave is “ON”. Then there will always be one flip-flop “ON” and the other “OFF” but never both the master and slave “ON” at the same time. Therefore, the output Q acquires the value of D, only when one complete pulse, ie, 0-1-0 is applied to the clock input.

There are many different D flip-flop IC’s available in both TTL and CMOS packages with the more common being the 74LS74 which is a Dual D flip-flop IC, which contains two individual D type bistable’s within a single chip enabling single or master-slave toggle flip-flops to be made. Other D flip-flop IC’s include the 74LS174 HEX D flip-flop with direct clear input, the 74LS175 Quad D flip-flop with complementary outputs and the 74LS273 Octal D-type flip flop containing eight D-type flip flops with a clear input in one single package.

74LS74 Dual D-type Flip Flop

74ls74 d flip flop

Other Popular D-type flip-flop ICs

Device Number Subfamily Device Description
74LS74 LS TTL Dual D-type Flip Flops with Preset and Clear
74LS175 LS TTL Quad D-type Flip Flops with Clear
74LS273 LS TTL Octal D-type Flip Flops with Clear
4013B Standard CMOS Dual type D Flip Flop
40174B Standard CMOS Hex D-type Flip Flop with Master Reset

Using The D-type Flip Flop For Frequency Division

One main use of a D-type flip flop is as a Frequency Divider. If the Q output on a D-type flip-flop is connected directly to the D input giving the device closed loop “feedback”, successive clock pulses will make the bistable “toggle” once every two clock cycles.

In the counters tutorials we saw how the Data Latch can be used as a “Binary Divider”, or a “Frequency Divider” to produce a “divide-by-2” counter circuit, that is, the output has half the frequency of the clock pulses. By placing a feedback loop around the D-type flip flop another type of flip-flop circuit can be constructed called a T-type flip-flop or more commonly a T-type bistable, that can be used as a divide-by-two circuit in binary counters as shown below.

Divide-by-2 Counter

divide by 2 counter


It can be seen from the frequency waveforms above, that by “feeding back” the output from Q to the input terminal D, the output pulses at Q have a frequency that are exactly one half ( ƒ/2 ) that of the input clock frequency, ( ƒIN ). In other words the circuit produces frequency division as it now divides the input frequency by a factor of two (an octave) as Q = 1 once every two clock cycles.

D Flip Flops as Data Latches

As well as frequency division, another useful application of the D flip flop is as a Data Latch. A data latch can be used as a device to hold or remember the data present on its data input, thereby acting a bit like a single bit memory device and IC’s such as the TTL 74LS74 or the CMOS 4042 are available in Quad format exactly for this purpose. By connecting together four, 1-bit data latches so that all their clock inputs are connected together and are “clocked” at the same time, a simple “4-bit” Data latch can be made as shown below.

4-bit Data Latch

4-bit data latch

Transparent Data Latch

The Data Latch is a very useful device in electronic and computer circuits. They can be designed to have very high output impedance at both outputs Q and its inverse or complement output Q to reduce the impedance effect on the connecting circuit when used as a buffer, I/O port, bi-directional bus driver or even a display driver.

But a single “1-bit” data latch is not very practical to use on its own and instead commercially available IC’s incorporate 4, 8, 10, 16 or even 32 individual data latches into one single IC package, and one such IC device is the 74LS373 Octal D-type transparent latch.

The eight individual data latches or bistables of the 74LS373 are “transparent” D-type flip-flops, meaning that when the clock (CLK) input is HIGH at logic level “1”, (but can also be active low) the outputs at Q follows the data D inputs.

In this configuration the latch is said to be “open” and the path from D input to Q output appears to be “transparent” as the data flows through it unimpeded, hence the name transparent latch.

When the clock signal is LOW at logic level “0”, the latch “closes” and the output at Q is latched at the last value of the data that was present before the clock signal changed and no longer changes in response to D.

8-bit Data Latch

8 bit data latch

Functional diagram of the 74LS373 Octal Transparent Latch

The D-type Flip Flop Summary

The data or D-type Flip Flop can be built using a pair of back-to-back SR latches and connecting an inverter (NOT Gate) between the S and the R inputs to allow for a single D (data) input. The basic D flip flop circuit can be improved further by adding a second SR flip-flop to its output that is activated on the complementary clock signal to produce a “Master-Slave D flip-flop” device.

The difference between a D-type latch and a D-type flip-flop is that a latch does not have a clock signal to change state whereas a flip-flop always does. The D flip-flop is an edge triggered device which transfers input data to Q on clock rising or falling edge. Data Latches are level sensitive devices such as the data latch and the transparent latch.

In the next tutorial about Sequential Logic Circuits, we will look at connecting together data latches to produce another type of sequential logic circuit called a Shift Register that are used to convert parallel data into serial data and vice versa.


Join the conversation!

Error! Please fill all fields.

What's the Answer *

  • s
    shikha upadhyay

    what is d filp flop i dont aunderstans please help me somtime ans this qustion


    what are the toggle states does a single clock cycle has ?

  • A

    What if Q is connected back to the input ? and output is being taken at Q only. will it be a constant value ?
    This question was being asked to me in some interview . Difference between these two scenarios, 1. when Qbar is connected to input D 2. When Q is connected to input D.

    • Wayne Storr

      When the D input is connected to not-Q, the flip-flop is configured as a binary divide-by-2 counter or frequency divider. That is, the output at Q is half the frequency value of the input clock signal as D and Q are connected in anti-phase. If terminals D and Q are shorted together the outputs at Q and not-Q remain unchanged on the application of a clock signal as the flip-flop is unable to toggle.

  • A

    d-flipflop is used as a delay ckt.. but how ?

  • P

    Sir, you have mentioned that latches do not use clocking frequency to change state. However in 4 bit data latch we have clock frequency set synchronously across all latches. Could you please clarify?

    • Wayne Storr

      A latch and a flip-flop are two different logic circuits. A latch is a circuit which can detect and hold indefinitely a logic 0 or a logic 1 condition that is applied to the input and as such can be used as memory cells in microcomputer systems. A basic latch has a D input, a Q output, and an enable (EN) control signal which continuously transfers D to Q while EN is active (hence the name transparent latch). A latch will retain its current state when EN is inactive.

      A flip-flop is a bistable device that has two states, Set and Reset, and which transfers its input data to the Q output on the positive- or negative-going transition of the clock signal (hence the name clocked flip-flop). Depending upon the type of flip-flop, this logic state can be held until the next clock transition. Two flip-flops connected in series are called a master-slave flip-flop. Latches are level sensitive, whereas flip-flops are edge sensitive.

  • S

    Hello sir;
    Sir can you tell me the working principle of transistor using d flip flop with a clear sketch

  • D
    Dhananjay vishwakarma

    What is the main purpose of the D flip flop??

  • b

    How fast a Divide-by-2 Counter can run expressed with variables: Clk frequency, setup time, hold time and propagation delay ?

  • X
    Xiuqi (Jade) Li

    What do the outputs Q stand for?

    • Wayne Storr

      Hello Jade, “Q” is used to denote an output as opposed to A, B, C, D, etc which are used to denote inputs. In the case of the Data Latch, the input is labelled “D” for data. Logic gates, flip-flops, timers etc, can also have two outputs labelled Q and not-Q, which have opposite states: when Q is high, not-Q is low, and vice versa. “Q” has no specific meaning other than it is a conveniently free letter to use.

      • X
        Xiuqi (Jade) Li

        Sorry sir (I think in the first place I should have said ) why “Q” is used to denote an output? Thank you.

  • j
    job the digital

    thank u but i also have another version if u agree email me to tell u. calling from uganda africa

Looking for the latest from TI?