Add `MODMISSING` error, in place of unnamed error (#6054).

This commit is contained in:
Wilson Snyder 2025-05-29 21:02:00 -04:00
parent 40881d7e79
commit 8031ca2616
9 changed files with 78 additions and 35 deletions

View File

@ -24,6 +24,7 @@ Verilator 5.037 devel
* Add aggregate type error checks (#5570) (#5950). [Shou-Li Hsu]
* Add `--filter-type` to verilator_coverage (#6030). [Ryszard Rozak, Antmicro Ltd.]
* Add `--hierarchical-threads` (#6037). [Bartłomiej Chmiel]
* Add `MODMISSING` error, in place of unnamed error (#6054). [Paul Swirhun]
* Improve hierarchical scheduling visualization in V3ExecGraph (#6009). [Bartłomiej Chmiel, Antmicro Ltd.]
* Fix --x-initial and --x-assign random stability (#2662) (#5958) (#6018) (#6025). [Todd Strader]
* Fix filename backslash escapes in C code (#5947).

View File

@ -1180,6 +1180,19 @@ List Of Warnings
discarded.
.. option:: MODMISSING
.. TODO better example
Error that a module, typically referenced by a cell, was not found.
This is typically fatal, but may be suppressed in some linting
situations with missing libraries.
Ignoring this error will cause the cell definition to be discarded.
Simulation results will likely be wrong, so typically used only with
lint-only.
.. option:: MULTIDRIVEN
Warns that the specified signal comes from multiple :code:`always`

View File

@ -120,6 +120,7 @@ public:
MINTYPMAXDLY, // Unsupported: min/typ/max delay expressions
MISINDENT, // Misleading indentation
MODDUP, // Duplicate module
MODMISSING, // Error: missing module
MULTIDRIVEN, // Driven from multiple blocks
MULTITOP, // Multiple top level modules
NEWERSTD, // Newer language standard required
@ -208,7 +209,7 @@ public:
"IFDEPTH", "IGNOREDRETURN",
"IMPERFECTSCH", "IMPLICIT", "IMPLICITSTATIC", "IMPORTSTAR", "IMPURE",
"INCABSPATH", "INFINITELOOP", "INITIALDLY", "INSECURE",
"LATCH", "LITENDIAN", "MINTYPMAXDLY", "MISINDENT", "MODDUP",
"LATCH", "LITENDIAN", "MINTYPMAXDLY", "MISINDENT", "MODDUP", "MODMISSING",
"MULTIDRIVEN", "MULTITOP", "NEWERSTD", "NOLATCH", "NONSTD", "NULLPORT", "PINCONNECTEMPTY",
"PINMISSING", "PINNOCONNECT", "PINNOTFOUND", "PKGNODECL", "PREPROCZERO", "PROCASSINIT", "PROCASSWIRE",
"PROFOUTOFDATE", "PROTECTED", "RANDC", "REALCVT", "REDEFMACRO", "RISEFALLDLY",
@ -248,8 +249,9 @@ public:
bool pretendError() const VL_MT_SAFE {
return (m_e == ASSIGNIN || m_e == BADSTDPRAGMA || m_e == BADVLTPRAGMA || m_e == BLKANDNBLK
|| m_e == BLKLOOPINIT || m_e == CONTASSREG || m_e == ENCAPSULATED
|| m_e == ENDLABEL || m_e == ENUMVALUE || m_e == IMPURE || m_e == PINNOTFOUND
|| m_e == PKGNODECL || m_e == PROCASSWIRE || m_e == ZEROREPL // Says IEEE
|| m_e == ENDLABEL || m_e == ENUMVALUE || m_e == IMPURE || m_e == MODMISSING
|| m_e == PINNOTFOUND || m_e == PKGNODECL || m_e == PROCASSWIRE
|| m_e == ZEROREPL // Says IEEE
);
}
// Warnings to mention manual

View File

@ -5898,12 +5898,13 @@ class WidthVisitor final : public VNVisitor {
// We've resolved parameters and hit a module that we couldn't resolve. It's
// finally time to report it.
// Note only here in V3Width as this is first visitor after V3Dead.
nodep->modNameFileline()->v3error(
"Cannot find file containing module: '"
<< nodep->modName() << "'\n"
<< nodep->modNameFileline()->warnContextPrimary()
<< V3Error::warnAdditionalInfo()
<< v3Global.opt.filePathLookedMsg(nodep->modNameFileline(), nodep->modName()));
nodep->modNameFileline()->v3warn(
MODMISSING, "Cannot find file containing module: '"
<< nodep->modName() << "'\n"
<< nodep->modNameFileline()->warnContextPrimary()
<< V3Error::warnAdditionalInfo()
<< v3Global.opt.filePathLookedMsg(nodep->modNameFileline(),
nodep->modName()));
}
if (nodep->rangep()) userIterateAndNext(nodep->rangep(), WidthVP{SELF, BOTH}.p());
userIterateAndNext(nodep->pinsp(), nullptr);

View File

@ -1,15 +1,15 @@
%Error: t/t_gen_missing.v:43:20: Cannot find file containing module: 'foo_not_needed'
%Error-MODMISSING: t/t_gen_missing.v:43:20: Cannot find file containing module: 'foo_not_needed'
43 | foo_not_needed i_foo(.x(foo[j]), .y(bar[j]));
| ^~~~~~~~~~~~~~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
... Looked in:
t/foo_not_needed
t/foo_not_needed.v
t/foo_not_needed.sv
foo_not_needed
foo_not_needed.v
foo_not_needed.sv
obj_vlt/t_gen_missing_bad/foo_not_needed
obj_vlt/t_gen_missing_bad/foo_not_needed.v
obj_vlt/t_gen_missing_bad/foo_not_needed.sv
... For error description see https://verilator.org/warn/MODMISSING?v=latest
... Looked in:
t/foo_not_needed
t/foo_not_needed.v
t/foo_not_needed.sv
foo_not_needed
foo_not_needed.v
foo_not_needed.sv
obj_vlt/t_gen_missing_bad/foo_not_needed
obj_vlt/t_gen_missing_bad/foo_not_needed.v
obj_vlt/t_gen_missing_bad/foo_not_needed.sv
%Error: Exiting due to

View File

@ -1,13 +1,13 @@
%Error: t/t_gen_nonconst_bad.v:8:4: Cannot find file containing module: 'nfound'
%Error-MODMISSING: t/t_gen_nonconst_bad.v:8:4: Cannot find file containing module: 'nfound'
8 | nfound nfound();
| ^~~~~~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
... This may be because there's no search path specified with -I<dir>.
... Looked in:
nfound
nfound.v
nfound.sv
obj_dir/nfound
obj_dir/nfound.v
obj_dir/nfound.sv
... For error description see https://verilator.org/warn/MODMISSING?v=latest
... This may be because there's no search path specified with -I<dir>.
... Looked in:
nfound
nfound.v
nfound.sv
obj_dir/nfound
obj_dir/nfound.v
obj_dir/nfound.sv
%Error: Exiting due to

View File

@ -1,7 +1,7 @@
%Error: t/t_inst_long_bad.v:9:3: Cannot find file containing module: 'long_long_long_long_long_long___Vhsh1JZCXQVBM1QiASYlLmgTuAXYyUr7VAbJYwVHfiAD'
%Error-MODMISSING: t/t_inst_long_bad.v:9:3: Cannot find file containing module: 'long_long_long_long_long_long___Vhsh1JZCXQVBM1QiASYlLmgTuAXYyUr7VAbJYwVHfiAD'
9 | long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_ inst ();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
... Note: Name is longer than 127 characters; automatic file lookup may have failed due to OS filename length limits.
... Suggest putting filename with this module/package onto command line instead.
... For error description see https://verilator.org/warn/MODMISSING?v=latest
... Note: Name is longer than 127 characters; automatic file lookup may have failed due to OS filename length limits.
... Suggest putting filename with this module/package onto command line instead.
%Error: Exiting due to

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.lint()
test.passes()

View File

@ -0,0 +1,10 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2011 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t(input i);
// verilator lint_off MODMISSING
foobar sub(i);
endmodule