D

Comprehensive study notes, diagrams, and exam preparation for D.

D Latch and D Flip-Flop

Definition

A D latch or D flip-flop is a sequential logic circuit that stores one bit of data.

  • A D latch is level-sensitive, meaning its output follows the input while the enable signal is active.
  • A D flip-flop is edge-triggered, meaning its output changes only at a specific clock edge, usually the rising edge or falling edge.

The main purpose of D devices is to capture the value on the D input and hold it at the output Q until the next allowed update.


Main Content

1. D Latch

  • The D latch is a basic memory element controlled by an enable signal.
  • When enable is active, Q follows D; when enable is inactive, the latch stores the previous value.

The D latch is called transparent during the active enable level because any change at D appears at Q immediately. When enable is disabled, the latch becomes opaque and preserves the stored bit.

A simple functional behavior is:

Enable = 1

  • → Q = D

Enable = 0

  • → Q holds its last value

This makes the D latch useful in circuits where temporary storage is needed, but it also introduces timing concerns because the output can change as long as the enable remains active.

Typical symbol behavior:

      D ─────► [ D LATCH ] ─────► Q
                 EN

Example:

  • If enable is high and D = 1, Q becomes 1.
  • If D later changes to 0 while enable is still high, Q also changes to 0.
  • Once enable goes low, Q remains fixed at whatever value it had at that moment.

Important characteristics:

  • Level-sensitive device
  • Can be built using NOR or NAND gates
  • Requires careful timing to avoid unintended changes

2. D Flip-Flop

  • The D flip-flop is a more widely used storage element in synchronous digital design.
  • It captures the D input only at a clock edge, making it more stable and easier to use in complex systems.

Unlike the latch, the flip-flop does not pass D changes continuously. Instead, it samples D at a specific instant:

Positive-edge triggered

  • : captures D on the rising edge of the clock

Negative-edge triggered

  • : captures D on the falling edge of the clock

Behavior:

  • Between clock edges, Q remains constant
  • At the active edge, Q takes the value of D

Typical timing idea:

Clock:  __/‾‾\__/‾‾\__/‾‾\__
D:      0___1____0_____1___
Q:      0___1____0_____1___
         ↑    ↑    ↑
      capture moments

Why it is important:

  • It synchronizes data storage with the system clock
  • It reduces race problems compared with level-sensitive storage
  • It is the standard memory element in registers, counters, and state machines

Common applications:

  • Registers
  • Shift registers
  • Finite state machines
  • Counters
  • Synchronizers in clocked systems

3. Timing, Setup, and Hold Requirements

  • D devices must obey timing rules to work correctly and reliably.
  • The input must be stable before and after the sampling moment.

Two essential timing constraints are:

Setup time

  • : the input D must remain stable for a minimum time before the clock edge

Hold time

  • : the input D must remain stable for a minimum time after the clock edge

If these conditions are violated, the flip-flop may enter an uncertain state called metastability, where the output is neither a valid 0 nor 1 for a short time.

Why timing matters:

  • The flip-flop needs enough time to recognize the input properly
  • Signals in real circuits do not change instantaneously
  • Delays in wires and gates affect data reliability

Example: If a flip-flop requires:

  • Setup time = 5 ns
  • Hold time = 2 ns

Then D must be stable from 5 ns before the clock edge until 2 ns after the edge.

Potential problems:

  • Wrong stored value
  • Unpredictable output
  • System failure in synchronous circuits

ASCII timing view:

D:     ----0------1------1------
Clock: -----------↑-------------
Stable window:   [setup][hold]

Working / Process

1. Input is applied to D

  • The data bit to be stored is placed at the D input.
  • This bit may be 0 or 1 depending on the required logic state.

2. Control signal allows sampling

  • In a D latch, the enable signal determines whether the input is passed through.
  • In a D flip-flop, the active clock edge determines the instant of sampling.

3. Output is updated and stored

  • The stored value appears at Q.
  • After the latch disables or the flip-flop edge passes, Q holds its previous value until the next sampling event.

For a D latch:

  • If enable is high, the output tracks the input.
  • If enable goes low, the last input value is remembered.

For a D flip-flop:

  • The circuit “looks at” D only at the clock edge.
  • The stored value is then preserved until the next edge.

Advantages / Applications

  • Simple and reliable 1-bit storage element for synchronous digital systems
  • Essential for building registers, counters, memory elements, and finite state machines
  • D flip-flops reduce timing uncertainty by updating only on clock edges

Additional applications and significance:

  • Used in CPU pipelines to store intermediate values
  • Used in shift registers for serial-to-parallel and parallel-to-serial conversion
  • Used in timing circuits and synchronizers to help manage data transfer between clock domains

Summary

  • D devices store one bit of data in sequential circuits.
  • A D latch is level-sensitive, while a D flip-flop is edge-triggered.
  • Timing rules such as setup time and hold time are crucial for correct operation.

Important terms to remember

  • : D latch, D flip-flop, enable, clock edge, setup time, hold time, Q, metastability