VERILOG2051: “static” variables declared locally to a procedural block that contain an initializer should be explicitly defined with the “static” keyword

Summary

Count: 1

ReliabilitySecurityMaintainabilityCode attributeEffort to fixTags
MEDIUM--Consistency | Conventional10minsynthesis, portability, vscode, linter, simulation

Description

Noncompliant code example

module fly;
  initial begin
    int i = 1;
  end
endmodule

Compliant solution

module fly;
  initial begin
    static int i = 1;
  end
endmodule

static variables declared locally to a procedural block that contain an initializer require that the static keyword be explicitly provided (and not just inferred from context) to clarify that the initialization happens only once.

Most tools do not enforce this rule but doing so keep your code portable.

Parameters

No parameters.