diff --git a/Changes b/Changes index 05c37f9b0..9c6352cd3 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,8 @@ indicates the contributor was also the author of the fix; Thanks! *** Add assertions on 'unique if', bug725. [Jeff Bush] +*** Add PINCONNECTEMPTY warning. [Holger Waechtler] + **** Documentation fixes, bug723. [Glen Gibb] **** Fix tracing of package variables and real arrays. diff --git a/bin/verilator b/bin/verilator index 8dcb71a83..0b8d0801c 100755 --- a/bin/verilator +++ b/bin/verilator @@ -1095,8 +1095,9 @@ Disable the specified warning message. Disable all lint related warning messages, and all style warnings. This is equivalent to "-Wno-ALWCOMBORDER -Wno-CASEINCOMPLETE -Wno-CASEOVERLAP -Wno-CASEX -Wno-CASEWITHX -Wno-CMPCONST -Wno-ENDLABEL -Wno-IMPLICIT --Wno-LITENDIAN -Wno-PINMISSING -Wno-SYNCASYNCNET -Wno-UNDRIVEN --Wno-UNSIGNED -Wno-UNUSED -Wno-WIDTH" plus the list shown for Wno-style. +-Wno-LITENDIAN -Wno-PINCONNECTEMPTY -Wno-PINMISSING -Wno-SYNCASYNCNET +-Wno-UNDRIVEN -Wno-UNSIGNED -Wno-UNUSED -Wno-WIDTH" plus the list shown for +Wno-style. It is strongly recommended you cleanup your code rather than using this option, it is only intended to be use when running test-cases of code @@ -1106,8 +1107,8 @@ received from third parties. Disable all code style related warning messages (note by default they are already disabled). This is equivalent to "-Wno-DECLFILENAME -Wno-DEFPARAM --Wno-INCABSPATH -Wno-PINNOCONNECT -Wno-SYNCASYNCNET -Wno-UNDRIVEN --Wno-UNUSED -Wno-VARHIDDEN". +-Wno-INCABSPATH -Wno-PINCONNECTEMPTY -Wno-PINNOCONNECT -Wno-SYNCASYNCNET +-Wno-UNDRIVEN -Wno-UNUSED -Wno-VARHIDDEN". =item -Wno-fatal @@ -3009,11 +3010,21 @@ not really needed. The best solution is to insure that each module is in a unique file by the same name. Otherwise, make sure all library files are read in as libraries with -v, instead of automatically with -y. +=item PINCONNECTEMPTY + +Warns that a cell instantiation has a pin which is connected to +.pin_name(), e.g. not another signal, but with an explicit mention of the +pin. It may be desirable to disable PINCONNECTEMPTY, as this indicates +intention to have a no-connect. + +Disabled by default as this is a code style warning; it will simulate +correctly. + =item PINMISSING Warns that a module has a pin which is not mentioned in a cell instantiation. If a pin is not missing it should still be specified on the -cell declaration with a empty connection,using "(.pin_name())". +cell declaration with a empty connection, using "(.pin_name())". Ignoring this warning will only suppress the lint check, it will simulate correctly. diff --git a/src/V3Error.h b/src/V3Error.h index 7ed23a3d0..8980c7282 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -84,6 +84,7 @@ public: MULTIDRIVEN, // Driven from multiple blocks PINMISSING, // Cell pin not specified PINNOCONNECT, // Cell pin not connected + PINCONNECTEMPTY,// Cell pin connected by name with empty reference: ".name()" (can be used to mark unused pins) REALCVT, // Real conversion REDEFMACRO, // Redefining existing define macro SELRANGE, // Selection index out of range @@ -127,7 +128,7 @@ public: "INCABSPATH", "INITIALDLY", "LITENDIAN", "MODDUP", "MULTIDRIVEN", - "PINMISSING", "PINNOCONNECT", + "PINMISSING", "PINNOCONNECT", "PINCONNECTEMPTY", "REALCVT", "REDEFMACRO", "SELRANGE", "STMTDLY", "SYMRSVDWORD", "SYNCASYNCNET", "UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNPACKED", "UNSIGNED", "UNUSED", @@ -165,6 +166,7 @@ public: || m_e==DEFPARAM || m_e==DECLFILENAME || m_e==INCABSPATH + || m_e==PINCONNECTEMPTY || m_e==PINNOCONNECT || m_e==SYNCASYNCNET || m_e==UNDRIVEN diff --git a/src/V3LinkCells.cpp b/src/V3LinkCells.cpp index 8d507dae1..e58cdf334 100644 --- a/src/V3LinkCells.cpp +++ b/src/V3LinkCells.cpp @@ -308,7 +308,13 @@ private: set ports; // Symbol table of all connected port names for (AstPin* pinp = nodep->pinsp(); pinp; pinp=pinp->nextp()->castPin()) { if (pinp->name()=="") pinp->v3error("Connect by position is illegal in .* connected cells"); - if (!pinp->exprp()) pinp->v3warn(PINNOCONNECT,"Cell pin is not connected: "<prettyName()); + if (!pinp->exprp()) { + if (pinp->name().substr(0, 11) == "__pinNumber") { + pinp->v3warn(PINNOCONNECT,"Cell pin is not connected: "<prettyName()); + } else { + pinp->v3warn(PINCONNECTEMPTY,"Cell pin connected by name with empty reference: "<prettyName()); + } + } if (ports.find(pinp->name()) == ports.end()) { ports.insert(pinp->name()); } diff --git a/test_regress/t/t_inst_missing.v b/test_regress/t/t_inst_missing.v index e5291a805..e2ea9c143 100644 --- a/test_regress/t/t_inst_missing.v +++ b/test_regress/t/t_inst_missing.v @@ -6,10 +6,12 @@ module t (/*AUTOARG*/); wire ok = 1'b0; // verilator lint_off PINNOCONNECT - sub sub (.ok(ok), .nc()); + // verilator lint_off PINCONNECTEMPTY + sub sub (.ok(ok), , .nc()); + // verilator lint_on PINCONNECTEMPTY // verilator lint_on PINNOCONNECT endmodule -module sub (input ok, input nc); - initial if (ok&&nc) begin end // No unused warning +module sub (input ok, input none, input nc); + initial if (ok && none && nc) begin end // No unused warning endmodule diff --git a/test_regress/t/t_inst_missing_bad.pl b/test_regress/t/t_inst_missing_bad.pl index b78ef868b..6db6466b5 100755 --- a/test_regress/t/t_inst_missing_bad.pl +++ b/test_regress/t/t_inst_missing_bad.pl @@ -11,9 +11,10 @@ compile ( v_flags2 => ["--lint-only --Wall -Wno-DECLFILENAME"], fails=>1, expect=> -q{%Warning-PINNOCONNECT: t/t_inst_missing_bad.v:\d+: Cell pin is not connected: nc +q{%Warning-PINNOCONNECT: t/t_inst_missing_bad.v:8: Cell pin is not connected: __pinNumber2 %Warning-PINNOCONNECT: Use .* -%Warning-PINMISSING: t/t_inst_missing_bad.v:\d+: Cell has missing pin: missing +%Warning-PINCONNECTEMPTY: t/t_inst_missing_bad.v:8: Cell pin connected by name with empty reference: nc +%Warning-PINMISSING: t/t_inst_missing_bad.v:8: Cell has missing pin: missing %Error: Exiting due to.*}, ); diff --git a/test_regress/t/t_inst_missing_bad.v b/test_regress/t/t_inst_missing_bad.v index 61a92b363..74089d365 100644 --- a/test_regress/t/t_inst_missing_bad.v +++ b/test_regress/t/t_inst_missing_bad.v @@ -5,9 +5,9 @@ module t (/*AUTOARG*/); wire ok = 1'b0; - sub sub (.ok(ok), .nc()); + sub sub (.ok(ok), , .nc()); endmodule -module sub (input ok, input nc, input missing); - initial if (ok&&nc&&missing) begin end // No unused warning +module sub (input ok, input none, input nc, input missing); + initial if (ok && none && nc && missing) begin end // No unused warning endmodule