Verilog Parameters

Sigasi Studio validates the use of parameters in (System)Verilog.

Parameters without a default value

Sigasi Studio warns if a parameter is declared without a default value (rule 19). Syntactically this is allowed since the instantiating modules should provide the value to the instance parameter. However, it is undesirable since it makes the definition dependent on a particular hierarchy and limits code reusability. In addition, it is creating elaboration errors when attempting to use such modules as a top-level.

module badcode;
	parameter P;

module goodcode;
	parameter P = 0;

Parameters width mismatch

Sigasi Studio flags an error if a parameter with a defined width is declared is assigned a value of differing width (rule 48).

parameter int         p = 'h764321098;   // Number of bits set a04a (35) wider than the expected bit width (32)

parameter signed [36] q = 'h764321098;

Empty parameter not allowed

The Verilog standard does not allow empty parameters (rule 53).

module dut # (parameter WIDTH = 42, ) (input clk); endmodule; // dangling comma is not allowed

module dut # (parameter WIDTH = 42 ) (input clk); endmodule;

Empty parameter overrides not allowed

The Verilog standard does not allow empty parameter overrides (rule 54).

module test;
    sub#(8, 16, ) inst(); // dangling comma is not allowed

module test;
    sub#(8, 16 ) inst();

Local parameter has to be initialized

The Verilog standard requires that local parameters are initialized (rule 69).

localparam p;             // initialization missing

localparam p = 1;

Local parameter cannot be overridden

The Verilog standard does not allow the overriding of local parameters (rule 70).

module name(
    input clk,
    input rst
    localparam int test = 42;

    defparam test = 0;    // override not allowed
endmodule : name

Rule configuration

These rules can be disabled for your project, or their severity and parameters can be modified in the project linting settings. Alternatively, they can be manually configured with the following template:

19/severity/${path}={error|warning|info|ignore} # parameter without default value
48/severity/${path}={error|warning|info|ignore} # parameter width mismatch
53/severity/${path}={error|warning|info|ignore} # empty parameter
54/severity/${path}={error|warning|info|ignore} # empty parameter override
69/severity/${path}={error|warning|info|ignore} # local parameter not initialized
70/severity/${path}={error|warning|info|ignore} # local parameter overridden