Home / Learn Verilog / Common Style Mistakes

Common Style Mistakes

What reviewers flag.

Bottom lineWhat reviewers flag.

Breaking it down

Stylebadif (cnt == 9)u1 (a,b,c)goodif (cnt == MAX)u1 (.a(a),.b(b))
Style

The basic idea

Magic numbers, long always blocks, mixed blocking styles, undefined widths, unnamed instances, giant modules.

Why this comes up

Style mistakes become bugs.

The mechanics

Name constants, split blocks, use named connections.

Where it is used

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

Try it

Magic number vs nameVerilog: edit and run

A name explains the number.

Quick check

1. Magic numbers should be...