Verilog is a hardware description language (HDL) used to model electronic systems. It is most commonly used in the design, verification, and implementation of digital logic chips at the register-transfer level of abstraction.
Verilog Anti-Patterns Overview
Blocking Assignments in Sequential Logic
<=
) for sequential logic within an always @(posedge clk)
block. Using blocking assignments (=
) in sequential logic can lead to race conditions and simulation-synthesis mismatches.Non-Blocking Assignments in Combinational Logic
=
) for combinational logic within an always @(*)
block. Using non-blocking assignments (<=
) in combinational logic can lead to simulation-synthesis mismatches and incorrect behavior.Incomplete Sensitivity Lists
@(*)
for combinational logic. Incomplete sensitivity lists can lead to simulation-synthesis mismatches and incorrect behavior.Latches Due to Incomplete Assignments
always
blocks, and include a default case in case statements. Incomplete assignments can create unintended latches in your design.Multiple Drivers for the Same Signal
Mixing Blocking and Non-Blocking Assignments
always
block. Use non-blocking assignments consistently for sequential logic and blocking assignments consistently for combinational logic.Asynchronous Reset Release
Combinational Loops
Inferring Clock Gating
Using Initial Blocks for Hardware
initial
blocks for hardware initialization, as they are generally not synthesizable for hardware (except for some specific cases like memory initialization). Use reset signals to initialize your design.Ignoring Clock Domain Crossing
Improper Use of Delays
#
) in synthesizable code. Delays are for simulation only and are ignored during synthesis. Let the synthesis tool handle timing based on your timing constraints.Ignoring Tool Warnings
Not Using Parameters for Constants
Not Using Named Port Connections
Not Using Generate Blocks
generate
blocks for repetitive structures in your design. Generate blocks allow for parameterized, scalable designs and reduce code duplication.Not Using Assertions