The Building Block of Memory
A flip-flop is a one-bit memory element that changes state only on a clock edge — the instant the clock transitions (typically rising, 0 to 1). This edge-triggering is the key refinement over a plain latch (which is level-sensitive and can change whenever its inputs do): a flip-flop samples its input at the exact clock edge and holds that value steady until the next edge. Predictable, once-per-tick updates are what flip-flops provide.
The most common is the D flip-flop ("data" flip-flop): on each clock edge, its output takes the value of its input . In words, "remember whatever was at the tick." That simple behavior is the foundation of almost all storage in a processor. Other types exist (JK, T for toggling), but D flip-flops dominate modern design.
Wiring D flip-flops side by side, all driven by the same clock, makes an -bit register — a unit that stores an -bit value and updates it all at once on each edge. Registers are the fast working storage inside a CPU (Unit 1's registers are exactly these).
Feed a register's output back through combinational logic and you build stateful machines: a counter (a register whose next value is current + 1) increments each tick; a shift register moves its bits one position per tick. All follow the same pattern: flip-flops hold the state, combinational logic computes the next state, the clock advances it — the finite-state-machine shape made concrete.
Common pitfall: confusing an edge-triggered flip-flop with a level-sensitive latch. A latch is "transparent" while its enable is active — its output can follow the input continuously during that window. A flip-flop captures the input only at the clock edge and then holds it. Using a latch where an edge-triggered flip-flop is needed causes subtle timing bugs.