Latches
What Are Latches?
Latches are fundamental sequential logic circuits that store one bit of state and can hold that value as long as power is applied. Unlike combinational logic, whose outputs depend only on present inputs, a latch retains its output through internal feedback, making it a bistable memory element. Latches are the building blocks of flip-flops, registers, and the entire hierarchy of digital state storage in processors, microcontrollers, and programmable logic devices.
The behavior that distinguishes a latch from a flip-flop is its sensitivity to signal levels rather than signal transitions. A latch is transparent when its enable or clock input is asserted: changes on the data input pass directly to the output. When the enable is de-asserted, the output is held, or latched, at its last value regardless of subsequent input changes. Flip-flops, by contrast, capture state only at a clock edge. This distinction determines where each element appears in a synchronous digital design.
SR and D Latches
The set-reset (SR) latch is the simplest form, built from two cross-coupled NAND or NOR gates. When S is asserted and R is not, the output Q is forced high. When R is asserted and S is not, Q is forced low. With both inputs inactive, the circuit holds its prior state. The forbidden condition, in which both S and R are simultaneously asserted, produces an indeterminate output and is avoided in practical designs through encoding conventions.
The D latch adds a single data input and an enable line. While the enable is high, Q tracks D directly, making the circuit transparent. When the enable goes low, Q holds the value that D held at the moment of de-assertion. The D latch is the basis of the positive-edge-triggered D flip-flop, which is constructed from two D latches in a primary-secondary arrangement so that state capture occurs only at the rising clock edge. The IEEE Standard for Logic Element Interfaces and related hardware description language (HDL) standards define the behavioral modeling conventions for latches that synthesis tools interpret when generating gate-level netlists.
Timing, Metastability, and Latch-Up Risk
Correct latch operation depends on meeting setup and hold time requirements. The setup time is the interval before the enable de-asserts during which D must be stable; the hold time is the interval afterward. Violating either produces a metastable condition in which the output resolves to an indeterminate voltage between logic zero and logic one, recovering only after a probabilistic settling period. Metastability is a known risk at clock-domain crossings, and research on synchronizer design and metastability has produced circuits with exponentially long mean-time-to-failure between metastable events.
In CMOS implementations, latches also interact with the on-chip latch-up failure mode, in which a parasitic thyristor structure formed by the substrate and well layers can be triggered by electrostatic discharge or electrical overstress on I/O pins. On-chip protection circuits, including ESD clamping diodes and guard rings, reduce this risk and are particularly important when latch-type storage cells sit near package pins or I/O buffers. The JEDEC standard JESD78 for IC latch-up testing establishes the test methodology used to qualify CMOS devices containing latch structures for production.
Applications
Latches appear across digital design, including:
- Pipeline register stages in processors and digital signal processors
- Clock-gating cells used to reduce dynamic power in synchronous circuits
- Input and output registers in programmable logic devices and FPGAs
- Static random-access memory (SRAM) bit cells, which use a six-transistor cross-coupled latch structure
- Boundary-scan test registers in IEEE 1149.1 JTAG implementations