1. Latches and Flip-Flops
A latch is a level-sensitive storage element: as long as the clock or enable signal is active, the output directly follows the input (transparent state); once the clock signal switches to the inactive level, the last applied value is frozen. A simple D-latch can be built from two cross-coupled inverters whose feedback path is opened and closed through a transmission gate; in modern standard-cell libraries, such a latch typically requires 6 to 8 transistors.
A flip-flop, by contrast, is edge-triggered: the stored value changes only at the moment of the rising or falling clock edge. The most common CMOS flip-flop is the master-slave flip-flop, in which two latches clocked in opposite phase are connected in series – the master latch tracks the input while the clock is low, and the slave latch captures the value of the master latch on the rising edge and holds it for the remainder of the clock period. Because of this cascading, at most one of the two latches is ever transparent at a given time, which prevents the input from passing directly to the output within a single clock period. Such a master-slave flip-flop typically consists of around 20 to 24 transistors; modern processor dies contain several hundred million to over a billion such flip-flops.