The D Flip-Flop
The D latch is transparent while its enable signal is high. During this interval, signals can race through combinational feedback paths multiple times.
Synchronous digital systems require memory elements that capture data at a specific moment rather than across a time interval. That moment is the clock transition.
The edge-triggered D flip-flop provides this capability. The D flip-flop is the primary storage element for registers, pipeline stages, and finite state machines.
Master-Slave Architecture
A basic edge-triggered D flip-flop connects two D latches in series with complementary clock enable signals (Figure 1).
The first stage is the master latch. The second stage is the slave latch.
- When the clock signal is low, the master latch is transparent and samples input $D$. The slave latch is opaque and holds the current output $Q$.
- When the clock signal transitions high, the master latch becomes opaque, capturing the value of $D$. At the same instant, the slave latch becomes transparent and drives the captured value to output $Q$.
Because the master latch is now opaque, transitions on input $D$ cannot reach the slave latch. Feedback signals cannot pass through both latches during the same clock phase. This architecture prevents transparency race conditions.
Output $Q$ updates only at the rising edge of the clock signal (Figure 2). Signal changes on $D$ between rising edges do not alter output $Q$.
The time required for output $Q$ to become stable after the clock edge is the clock-to-Q propagation delay ($t_{\text{cq}}$).
Importance of Edge Triggering
Edge triggering simplifies synchronous circuit design:
- Output signals transition at the clock edge and remain stable for the full clock period. Combinational logic has an entire clock period to settle.
- Inputs must remain stable only within a narrow timing window around the active clock edge.
- All flip-flops connected to the same clock signal update their states simultaneously.
This architecture divides circuit operation into two parts. Combinational logic computes the next state. Flip-flops update the current state on each active clock edge.
Silicon Implementation
In standard CMOS libraries, two transmission-gate latches form the flip-flop. The circuit uses 12 transistors for the two storage stages plus inverters for internal clock buffering.
A falling-edge triggered flip-flop uses the same schematic with inverted internal clock enable signals. By convention, this course uses rising-edge triggered flip-flops unless stated otherwise.
Synchronous Reset
Most digital designs require reset capability to initialize flip-flops to logic 0.
A synchronous reset uses combinational logic on the data input:
$$D_{\text{actual}} = D \cdot \overline{\text{RESET}}$$
Asserting the reset signal does not change output $Q$ immediately. Output $Q$ transitions to 0 only at the next active clock edge (Figure 3).
Synchronous reset circuits reject high-frequency glitches between clock edges. However, a reset pulse must persist until an active clock edge occurs.
Asynchronous Reset
An asynchronous reset connects directly into the internal latch storage loops. Output $Q$ transitions to logic 0 immediately when the circuit asserts RESET (Figure 4).
Asynchronous reset is necessary during power-up before stable clock oscillations begin. It is also necessary in safety circuits that require immediate shutdowns.
However, releasing an asynchronous reset requires precise timing control. If the reset release occurs inside the setup-and-hold window of a clock edge, the flip-flop can become metastable.
Therefore, robust digital designs use asynchronous assertion and synchronous deassertion. Reset synchronizers align the release of the reset signal with the clock edge.
Clock Enable Control
A clock enable input allows a flip-flop to preserve its state across clock cycles:
$$D_{\text{actual}} = EN \cdot D + \overline{EN} \cdot Q$$
When $EN$ is high, the multiplexer routes new data $D$ to the flip-flop. When $EN$ is low, the multiplexer feeds the current output $Q$ back to the input, retaining the stored value.
Do not implement register enable controls by gating the clock signal with simple logic gates. Simple clock gating introduces clock skew and creates glitch hazards.
Practice Exercises
Problem 1
A flip-flop specifies $t_{\text{su}} = 2\text{ ns}$, $t_h = 0.5\text{ ns}$, and $t_{\text{cq}} = 3\text{ ns}$. The clock rising edge occurs at $t = 0\text{ ns}$. Input $D$ completes its last transition at $t = -3\text{ ns}$ and remains stable.
- Does the input satisfy the setup time requirement?
- When does output $Q$ present the valid data?
Solution
- Input $D$ must be stable by:
$$t_{\text{edge}} - t_{\text{su}} = 0\text{ ns} - 2\text{ ns} = -2\text{ ns}$$
Because $D$ became stable at $-3\text{ ns}$, the signal satisfies setup time with a $1\text{ ns}$ margin. Input $D$ does not change after the edge, satisfying the hold time requirement.
- Output $Q$ becomes valid at:
$$t_{\text{edge}} + t_{\text{cq}} = 0\text{ ns} + 3\text{ ns} = 3\text{ ns}$$
Problem 2
Why should designers avoid gating the clock net with simple AND gates to create register enable controls?
Solution
If the enable control signal transitions while the clock signal is high, the AND gate generates a truncated clock pulse. This runt pulse can cause setup-time violations or clock the flip-flop at the wrong instant.
Furthermore, the additional gate delay introduces clock skew relative to non-gated registers. Designers must implement register enable controls with data-path multiplexers or dedicated integrated clock-gating cells.
Problem 3
An active-low asynchronous reset signal deasserts $0.8\text{ ns}$ before a rising clock edge. The flip-flop requires a recovery time (reset setup time) of $1.0\text{ ns}$. Identify the potential failure.
Solution
The reset release violates the required $1.0\text{ ns}$ recovery timing window ($0.8\text{ ns} < 1.0\text{ ns}$).
The internal latch nodes may not settle before the master latch samples the input, which can cause metastability. In multi-bit registers, some flip-flops may exit reset on the current clock cycle while others exit on the subsequent cycle, causing state corruption.
The next article examines the JK and T flip-flops, which provide dedicated toggle functions for digital counters.