VERILOG2102: Constant functions should not contain static variables with initializer

Summary

Count: 1

ReliabilitySecurityMaintainabilityCode attributeEffort to fixTags
HIGH--Intentionality | Logical5minsynthesis, vscode, linter, simulation

Description

A constant function contains a static variable with an initializer. That initializer will be skipped during constant evaluation, which could lead to unintuitive results.

Noncompliant code example

localparam int foo = func();
function int func;
  static int i = 1;
  return i;
endfunction

Parameters

No parameters.