Home / Learn Verilog / Common Errors List

Common Errors List

Twelve typical mistakes and fixes.

In shortTwelve typical mistakes and fixes.

What's actually going on

Debug loopsymptomcausefixretest
Debug loop

What it is

A table of common mistakes, the cause and the fix.

Why it matters

Most bugs repeat; recognising them saves hours.

Mechanically speaking

Keep this next to you while debugging.

Shows up in

  • Practice
  • Interviews
SymptomCauseFix
Latch inferredMissing else/default in always @(*)Assign defaults first
Output is xRegister never reset or initialisedAdd reset
Output is zPort not connected or undrivenCheck instance connections
Race between blocksUsing = for flip-flopsUse <= in clocked blocks
Simulation never endsNo $finish and a free-running clockAdd $finish
Wrong width resultOperand widths differDeclare widths explicitly
Multiple driversTwo assigns on the same wireUse one driver or tristate
Mismatch simulation vs hardwareDelays or initial values usedRemove # delays from RTL
Timing failsLong combinational pathPipeline it
Counter skipsCompare with wrong widthCheck the constant width
Case does not matchx/z in the caseUse casez or fix inputs
Signed compare wrongMixed signed and unsignedDeclare both signed