← ProblemsCircuits / Sequential Logic / Latches and Flip-Flops

D latch

36%flip-flopsproceduresconditionals

Implement a D latch. Unlike a flip-flop, a latch is level-sensitive, not edge-sensitive:

  • While ena is 1, the latch is transparent: q continuously follows d.
  • While ena is 0, the latch is opaque: q holds whatever value it had when ena last went low, ignoring d.

Note: a latch is intentionally created here by an incomplete assignment, so a "latch inferred" warning from the synthesizer is expected and correct for this problem.