Initializing registers at the point of declaration may be tricky. If your (System)Verilog code is not going to be synthesized (e.g. testbench), it is completely acceptable. FPGA synthesis tools may also take initialization into account, so depending on your FPGA project, initializing registers when they are declared in the code may be a viable (or even preferred) option.
ASIC synthesis tools however will ignore initialization as in the first example, which may lead to a mismatch between synthesis and simulation. In such a case, initialization should be done using resets, as in the second example.
By default, Sigasi warns for register initialization at the point of the declaration. For FPGA projects it may be desirable to turn the warning off, whereas for ASIC projects one may want to raise the severity to error.
module fpga_only(input clk, input rst, input ii, output logic oo = 1'b0);
logic sig = 1'b0;
// ...
endmodulemodule asic_fpga(input clk, input rst, input ii, output logic oo);
logic sig;
always @(posedge clk) begin
if (rst == 1) begin
sig = 1'b0;
oo = 1'b0;
end
else begin
// ...
end
end
endmoduleRule configuration
This rule can be disabled for your project, or its severity and parameters can be modified in the project linting settings. Alternatively, it can be manually configured using one of the following templates, depending on the type of project you use.
For Modular Projects, add these entries to your project's
.sigasi/settings.jsonsettings file. To scope the settings to a specific folder or file instead of the whole project, place them inside an@overrideblock; to scope them to a specific target, place them inside a@targetsblock.JSONC{ "verilog.rules.35.severity": "{ERROR|WARNING|INFO|IGNORE}" }For Classic Projects, add the VHDL lines to
.settings/com.sigasi.hdt.vhdl.linting.prefsand the Verilog/SystemVerilog lines to.settings/com.sigasi.hdt.verilog.linting.prefs:PREFS35/severity/${path}={error|warning|info|ignore}