Worked examples — D latch and gated latches
Everything rests on one equation from the parent:
Here is the enable ("eyes open"), is the data bit we offer, is what the latch currently shows, and is what it shows after this instant. Every value is either or — nothing else exists in this world.
The scenario matrix
Every D-latch situation is one of these case classes. The examples that follow each hit one or more cells — the label tells you which.
| Cell | Case class | What makes it tricky | Example |
|---|---|---|---|
| A | Transparent, steady () | trivial copy | Ex 1 |
| B | Transparent, changing () | output chases live | Ex 1, Ex 2 |
| C | Opaque, changing () | is ignored — the classic trap | Ex 2 |
| D | Enable edge (open) | grabs whatever is right now | Ex 3 |
| E | Enable edge (close) | freezes the last value | Ex 3 |
| F | Degenerate: stuck at 1 | latch = a plain wire | Ex 4 |
| G | Degenerate: stuck at 0 | latch = frozen memory forever | Ex 4 |
| H | Glitch while transparent | bad value passes through | Ex 5 |
| I | Word problem (real device) | mapping hardware → | Ex 6 |
| J | Exam twist: derive from equation only | trust algebra, not intuition | Ex 7 |
| K | Exam twist: output & inverted enable | sign/complement bookkeeping | Ex 8 |
We now walk them all.
Example 1 — Cells A & B: transparent tracking
Steps.
- Apply the law at tick 1: , so . Why this step? With the term vanishes, so the old has no influence — only matters.
- Tick 2: . Tick 3: . Tick 4: . Tick 5: . Why this step? Same reasoning repeats — while transparent, is , live and with no memory.
So — an exact copy of .
Verify: the row equals the row cell-for-cell. That is the signature of a fully-transparent latch (Cell A when steady, Cell B when it changes). Look at the figure: the amber trace sits on top of the cyan trace while (white) is high.

Example 2 — Cells B & C: transparent then opaque (the classic trap)
Steps.
- Tick 1: . Why this step? Transparent (Cell B): copy .
- Tick 2: . Why this step? Still transparent — output chases the new .
- Tick 3: . Now . Why this step? Cell C. Enable is low, so kills the data term entirely — is ignored, and keeps the stored .
- Tick 4: . Again . Why this step? Still opaque. Even though rose to , the latch cannot see it. This is the trap: people expect to follow here — it does not.
- Tick 5: . Why this step? Re-opened (Cell B): grab current .
So .
Verify: matches the parent note exactly. Sanity check the tricky tick 3 by the boxed formula with : . ✓ In the figure, notice the flat amber across ticks 3–4 while the cyan wiggles beneath it — the visual proof that is being ignored.

Example 3 — Cells D & E: the two enable edges
Steps.
- Tick 1: . Why this step? Still opaque — is offered but ignored; stays .
- Tick 2 (opening edge , Cell D): . Why this step? The instant the eyes open, the latch copies whatever is right now (). This is the "grab."
- Tick 3 (closing edge , Cell E): . Why this step? The eyes shut and is frozen. Even if later dropped, this stored would survive.
So .
Verify: the value stored after closing equals the value present at the moment before closing (). That's the defining property of a transparent latch — it captures the last transparent value, not a fresh one. Units check: everything is , no illegal value appeared.
Example 4 — Cells F & G: the two degenerate extremes
Steps.
- Case F: substitute (so ) permanently: Why this step? With pinned high the memory term dies. The output is always — the latch is now just a piece of wire (or a buffer). No storage at all.
- Case G: substitute (so ) permanently: Why this step? With pinned low the data term dies. equals its own previous value forever — a frozen bit that can never change. Whatever it powered up as, it stays.
Verify: these are the two rows of the truth table taken to their limits. Plug numbers: F with gives , with gives (pure copy ✓). G with any returns (pure hold ✓). Both degenerate cases fall straight out of the same one equation — a good sign the equation is complete.
Example 5 — Cell H: a glitch sneaks through while transparent
Steps.
- Tick 1: . Why this step? Transparent, copy the clean .
- Tick 2: . Why this step? Cell H. Because , the latch has no way to distinguish a real value from a glitch — it dutifully copies the spike. momentarily goes wrong.
- Tick 3: . Why this step? Transparent again; follows back down.
So — the glitch passed straight through.
Verify: compare to Example 2 tick 3–4, where the same -change was ignored because . The only difference is enable. Conclusion: a latch is safe against glitches only while opaque. This is exactly why designers prefer edge-triggered flip-flops (which sample at a single clock instant) and why Clocking and Timing matters. See the figure: the amber spike copies the cyan spike because white is high throughout.

Example 6 — Cell I: real-world word problem
Steps.
- Map the hardware: = button, = coin sensor, = LOCKED light. Start (unlocked). Why this step? Word problems are just the same equation with real names glued on.
- Button pressed while coin present (): . Light turns on. Why this step? Transparent open (Cell D) copies the coin's .
- Coin removed before button released (): . Light goes off — bad! Why this step? Cell B — while transparent, removing the coin drops . The design is fragile if the coin leaves first.
- Correct operating order — release button first ( while ), then remove coin: after release ; removing coin () still gives . Why this step? Cell E freezes the , and Cell C ignores the subsequent coin removal. Light stays on.
Verify: the answer depends on ordering, which is precisely the transparency hazard. If the button releases first, latches and survives coin removal ( ✓). If the coin leaves first, follows to ( ✓). Both traced with the one equation — no contradiction.
Example 7 — Cell J: trust the algebra, ignore intuition
Steps.
- Substitute : Why this step? Boolean is OR, boolean is AND. and ; .
- Now test the opposite corner to be safe: : Why this step? Confirms that with the is rejected — the equation alone encodes the hold behaviour; no picture needed.
Verify: both results match Examples 1 and 3 respectively. The equation is a complete description — every one of the four input pairs, with either starting , is determined by it. That is why we can trust it in exams over shaky intuition.
Example 8 — Cell K: inverted enable and the output
Steps.
- Translate active-low to our standard : the real enable is . Here . Why this step? Our master equation uses "high = transparent." An active-low pin must be inverted first, or every sign flips.
- Now standard law: . Why this step? Transparent — copy .
- Complement output: . Why this step? is always the opposite of by construction — it's the second wire of the internal cross-coupled pair from SR Latch.
So .
Verify: and are complements ( and ) — never equal, which is exactly the property the D-trick guarantees (it removed the forbidden state where both could be ). If we had blindly used as we'd have gotten (hold) and answered — wrong. The sign bookkeeping mattered.
Coverage check — did we hit every cell?
Recall Every matrix cell, mapped to its example
- A, B → Ex 1
- B, C → Ex 2
- D, E → Ex 3
- F, G → Ex 4
- H → Ex 5
- I → Ex 6
- J → Ex 7
- K → Ex 8
Signs (active-low), degenerate inputs (stuck-at-0/1), limiting behaviour (glitch), a word problem, and an exam twist are all present. No cell is left unshown.
Connections
- D latch and gated latches — the parent rules these examples exercise.
- SR Latch — source of the complement pair (Ex 8).
- NOR and NAND Gates — the internal cross-coupled loop.
- D Flip-Flop — edge-triggered fix for the glitch of Ex 5.
- Clocking and Timing — why transparency (Ex 5, Ex 6) is dangerous.
- Multiplexers — the 2:1 MUX view behind Ex 7's equation.
- Registers — many such latches/flip-flops in parallel.