Both store one bit, but they are triggered differently. A latch is level-sensitive: while its enable signal is active it is transparent and passes the input straight to the output, and when the enable goes inactive it holds the value. A flip-flop is edge-triggered: it captures the input only at the clock edge and ignores changes in between. A flip-flop is built from two latches working in opposite phases.
Aspect
Latch
Flip-flop
Trigger
Level-sensitive: acts while the enable is active
Edge-triggered: acts only at the rising or falling clock edge
Output behavior
Follows the input while transparent, then holds
Changes only at the clock edge, stable otherwise
Construction
A single storage stage
Two latches in series, working in opposite phases (master-slave)
Size and power
Smaller, with lower power
Larger, roughly twice the transistors
Timing analysis
More complex: time borrowing across the transparent phase
Simple: setup and hold times around the clock edge
Sensitivity to glitches
Glitches and races pass through while transparent
Immune to input changes between clock edges
Typical uses
Custom high-speed designs with time borrowing, clock-gating cells
Registers, counters and state machines in synchronous design
Figures are typical orders of magnitude and vary by process generation and product.
When to use which
Latch
When area, power or speed justify the harder timing analysis, typically in custom or high-performance circuits.
Flip-flop
The default building block in synchronous design, because timing is simple and robust.
HDL tip
In Verilog or VHDL, an incomplete if or case statement in combinational logic creates an unintended latch. Assign a value in every branch to avoid it.
FAQ
What is the difference between a latch and a flip-flop in one sentence?
A latch is level-sensitive and transparent while its enable is active, while a flip-flop is edge-triggered and captures its input only at the clock edge.
Is a flip-flop made of latches?
Yes. A master-slave flip-flop is two latches in series, working in opposite phases.
Why do designers prefer flip-flops?
Timing analysis is simple, with setup and hold times around one clock edge, and glitches between edges do not matter.
How does an unintended latch appear in HDL code?
When a combinational always block or process does not assign an output in every branch (an incomplete if or case), synthesis keeps the old value and infers a latch.
AIt captures the input only at the instant of the rising clock edge
BIt always outputs the inverted input
CWhile the enable signal is active, the input passes straight to the output; when it becomes inactive, the value is held
Show answer and explanation
Answer: C. While the enable signal is active, the input passes straight to the output; when it becomes inactive, the value is held
A D latch is level-sensitive: while enabled it is transparent, passing input straight to output, and when disabled it holds the value at that moment. It uses fewer transistors than a flip-flop and is sometimes used for speed via latch-based timing (time borrowing), but signals racing through during transparency make timing analysis harder. An edge-triggered D flip-flop is typically built as a master-slave pair of two latches clocked in opposite phases.
AIt always passes input changes directly to the output
BIt outputs the exclusive OR of two inputs
CIt captures the value of the D input at a clock edge and holds it until the next edge
Show answer and explanation
Answer: C. It captures the value of the D input at a clock edge and holds it until the next edge
A D flip-flop captures its D input on the rising (or falling) clock edge and holds it until the next edge; changes between edges do not affect the output. It is the building block of sequential circuits—CPU registers, pipeline stage boundaries and counters—and is typically built from two latches in a master-slave arrangement. Correct capture requires meeting setup and hold times.
AThe minimum time data must be held after the clock edge
BThe minimum time the data input must be stable before the clock edge
CThe time from power-on until it starts operating
Show answer and explanation
Answer: B. The minimum time the data input must be stable before the clock edge
For a flip-flop to capture correctly, data must be stable for a certain time before the clock edge—the setup time. A violation occurs if the clock-to-output delay plus the data-path delay exceeds the clock period minus the setup time, and it can be fixed by slowing the clock. The time data must remain stable after the edge is the hold time. Violating either can capture wrong values or cause metastability.
A latch created by synthesis when a description intended as combinational logic fails to assign an output under some condition, so the value must be held.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.