Latches (SR, D) are level-sensitive bistable devices that change their output based on input signals as long as the enable signal is active. In contrast, edge-triggered flip-flops respond only at specific clock edges (rising or falling), making them less susceptible to input glitches. Latches are simpler and faster but can be prone to unwanted changes, while flip-flops provide precise timing control, crucial for synchronous digital systems and reliable data storage.
Latches (SR, D) are level-sensitive bistable devices that change their output based on input signals as long as the enable signal is active. In contrast, edge-triggered flip-flops respond only at specific clock edges (rising or falling), making them less susceptible to input glitches. Latches are simpler and faster but can be prone to unwanted changes, while flip-flops provide precise timing control, crucial for synchronous digital systems and reliable data storage.
What is a latch, and how does it differ from a flip-flop?
A latch is a level-sensitive memory element that updates while its enable is active, making it transparent when enabled. A flip-flop is edge-triggered and changes state only on a clock edge, providing more predictable timing in synchronous systems.
What is an SR latch and how do the S and R inputs control it?
An SR latch uses cross-coupled gates (usually NOR). S sets Q to 1, R resets Q to 0; when S=R=0, the state is held. For NOR-based latches, S=R=1 is invalid. (There are NAND versions with active-low inputs.)
What is a D latch and how does it avoid the invalid state of SR?
A D latch is a gated version of an SR latch that derives S and R from the data input (S = D, R = not D). This eliminates the illegal S=R=1 condition. The latch is transparent when enable is high and holds when enable is low.
What is an edge-triggered flip-flop and how is it built from latches?
An edge-triggered flip-flop changes its output only at clock edges. It is often built as a master-slave pair of level-sensitive latches driven by opposite clock phases, so data is captured on one edge and released on the opposite phase.
When should I use a latch versus an edge-triggered flip-flop?
Use latches for simple, faster, level-sensitive storage or gating in controlled timing regions. Use edge-triggered flip-flops for reliable synchronous timing, avoiding glitches, and well-defined state updates on clock edges.