Home / Learn Verilog / Inferred Latches

Inferred Latches

The accidental memory.

The short versionThe accidental memory.

Theory in plain words

Latchmissing elsey keeps old valuelatchdefault firsty always assignedpure logic
Latch

Definition

If a combinational block does not assign an output in every path, hardware must remember the old value: a latch.

Why you need this

Latches cause timing and glitch problems.

How it works

Give outputs a default value at the top of the block.

Where you'll see this

  • Everyday RTL design
  • FPGA and ASIC projects
  • Testbenches and debugging

Try it

Latch appearsVerilog: edit and run

When en falls, the latch keeps 1.

Test what you just read

1. Cure for inferred latches?