A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Flip-Flops and Latches

College Depth 77 in the knowledge graph ☐ I know this ☆ Set as goal
618topics build on this
327prerequisites beneath it
See this on the map →
Logic Gates and Combinational CircuitsCombinational Circuit Design+1 more→→Binary Counters: Design and AnalysisClock Domain Crossing and Synchronization+5 more
flip-flop latch sequential-logic memory clock

Core Idea

Latches and flip-flops are bistable memory elements that store a single bit. A latch is level-sensitive: its output can change whenever the enable signal is active. A flip-flop is edge-triggered: its output changes only on the rising or falling edge of a clock signal. The D flip-flop (data or delay) is the most common type: it captures its D input at the clock edge and holds it until the next edge. Flip-flops are the fundamental building blocks of registers, counters, and all sequential digital circuits.

How It's Best Learned

Build an SR latch from NOR gates and observe its feedback behavior. Compare a D latch and D flip-flop, focusing on when output changes relative to clock and data. Use timing diagrams to visualize setup time, hold time, and propagation delay.

Common Misconceptions

Explainer

From your work with logic gates, you know that combinational circuits produce outputs determined entirely by their current inputs — change the inputs, the outputs change. But a computer needs memory: circuits that hold a value even after the input that produced it is gone. Flip-flops and latches are the simplest circuits that achieve this, and they do it through a single powerful idea — feedback.

The most basic memory element is the SR latch, built from two cross-coupled NOR gates (or NAND gates). Each gate's output feeds into the other gate's input, creating a stable loop. This feedback means the circuit has two stable states: one where Q = 1 and Q̄ = 0, and one where Q = 0 and Q̄ = 1. Once the circuit settles into one state, it stays there — the feedback reinforces itself. The Set input forces Q to 1; the Reset input forces Q to 0. When neither is active, the latch remembers its last commanded state. This is how one bit of information persists in hardware.

The problem with a raw SR latch is that its output changes the moment an input changes — there is no coordination with the rest of the circuit. In a digital system with many interconnected components, you need all state changes to happen at predictable, synchronized moments. A gated latch adds an enable signal: the latch only responds to its inputs when enable is active (high). A D latch simplifies this further by having a single data input D, which is captured whenever enable is high. But a level-sensitive latch is transparent — while enable is high, the output tracks the input continuously, which can cause timing problems when one latch's output feeds another latch's input in the same clock phase.

The D flip-flop solves this with edge triggering. Instead of being transparent while the clock is high, a D flip-flop captures its input only at the precise moment of a clock edge (typically the rising edge). One common implementation is the master-slave design: two D latches in series, where the first (master) is transparent when the clock is low and the second (slave) is transparent when the clock is high. At the rising clock edge, the master closes (freezing its captured value) and the slave opens (passing that value to the output). The result is that the output changes exactly once per clock cycle, at the clock edge, regardless of how the D input varies between edges.

Edge-triggered flip-flops are the foundation of synchronous digital design. Every register in a processor, every bit of a counter, every state element in a finite state machine is built from flip-flops. Two critical timing parameters govern their use: setup time (how long the D input must be stable before the clock edge) and hold time (how long it must remain stable after the clock edge). Violating these constraints causes metastability — the flip-flop enters an undefined state between 0 and 1, which can propagate errors through the entire system. Understanding setup and hold times is essential when you move on to designing registers, state machines, and pipelined processors, where every clock edge must find valid, stable data at every flip-flop input.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches

Longest path: 78 steps · 327 total prerequisite topics

Prerequisites (3)

Leads To (7)