Add instance module location helper when pin not found

This commit is contained in:
Wilson Snyder 2026-01-21 07:50:46 -05:00
parent 488fe4208f
commit 86cd249816
6 changed files with 46 additions and 2 deletions

View File

@ -3315,15 +3315,23 @@ class LinkDotResolveVisitor final : public VNVisitor {
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
return;
} else {
const string suggest
const std::string suggest
= (nodep->param() ? m_statep->suggestSymFlat(m_pinSymp, nodep->name(),
LinkNodeMatcherVarParam{})
: m_statep->suggestSymFlat(m_pinSymp, nodep->name(),
LinkNodeMatcherVarIO{}));
const std::string decl
= ((m_cellp && m_cellp->modp())
? "\n"s + nodep->warnMore() + "... Location of instance's "
+ m_cellp->modp()->verilogKwd() + " declaration\n"
+ m_cellp->modp()->warnContextSecondary()
: "");
nodep->v3warn(PINNOTFOUND,
ucfirst(whatp)
<< " not found: " << nodep->prettyNameQ() << '\n'
<< (suggest.empty() ? "" : nodep->warnMore() + suggest));
<< (suggest.empty() ? "" : nodep->warnMore() + suggest)
<< '\n'
<< nodep->warnContextPrimary() << decl);
return;
}
}

View File

@ -5,5 +5,8 @@
%Error-PINNOTFOUND: t/t_interface_generic_bad3.v:21:42: Pin not found: '__pinNumber2'
21 | GenericModule genericModule (inf_inst, inf_inst);
| ^~~~~~~~
: ... Location of instance's module declaration
11 | module GenericModule (interface a);
| ^~~~~~~~~~~~~
... For error description see https://verilator.org/warn/PINNOTFOUND?v=latest
%Error: Exiting due to

View File

@ -17,11 +17,17 @@
: ... Suggested alternative: 'exists'
21 | .nexist(i2)
| ^~~~~~
: ... Location of instance's module declaration
26 | module sub
| ^~~
... For error description see https://verilator.org/warn/PINNOTFOUND?v=latest
%Error-PINNOTFOUND: t/t_lint_pindup_bad.v:15:9: Parameter not found: 'NEXIST'
: ... Suggested alternative: 'EXIST'
15 | #(.NEXIST(1),
| ^~~~~~
: ... Location of instance's module declaration
26 | module sub
| ^~~
%Error: t/t_lint_pindup_bad.v:17:9: Duplicate parameter connection: 'P'
17 | .P(3))
| ^

View File

@ -1,8 +1,14 @@
%Error-PINNOTFOUND: t/t_lint_pinnotfound_bad.v:12:13: Pin not found: 'x'
12 | b b_inst1 (.x(1'b0));
| ^
: ... Location of instance's module declaration
18 | module b;
| ^
... For error description see https://verilator.org/warn/PINNOTFOUND?v=latest
%Error-PINNOTFOUND: t/t_lint_pinnotfound_bad.v:13:6: Parameter not found: 'PX'
13 | b #(.PX(1'b0)) b_inst2 ();
| ^~
: ... Location of instance's module declaration
18 | module b;
| ^
%Error: Exiting due to

View File

@ -5,19 +5,37 @@
%Error-PINNOTFOUND: t/t_param_implicit_local_bad.v:17:21: Parameter not found: '__paramNumber3'
17 | mod1 # ( 3, 4, 5 ) i_mod1 ();
| ^
: ... Location of instance's module declaration
26 | module mod1 # (
| ^~~~
%Error-PINNOTFOUND: t/t_param_implicit_local_bad.v:19:15: Parameter not found: '__paramNumber1'
19 | mod3 # ( 7, 24, 25 ) i_mod3 ();
| ^
: ... Location of instance's module declaration
38 | module mod3 #() ();
| ^~~~
%Error-PINNOTFOUND: t/t_param_implicit_local_bad.v:19:18: Parameter not found: '__paramNumber2'
19 | mod3 # ( 7, 24, 25 ) i_mod3 ();
| ^~
: ... Location of instance's module declaration
38 | module mod3 #() ();
| ^~~~
%Error-PINNOTFOUND: t/t_param_implicit_local_bad.v:19:22: Parameter not found: '__paramNumber3'
19 | mod3 # ( 7, 24, 25 ) i_mod3 ();
| ^~
: ... Location of instance's module declaration
38 | module mod3 #() ();
| ^~~~
%Error-PINNOTFOUND: t/t_param_implicit_local_bad.v:20:22: Parameter not found: '__paramNumber3'
20 | intf1 # ( 8, 15, 17 ) i_intf1 ();
| ^~
: ... Location of instance's interface declaration
43 | interface intf1 # (
| ^~~~~
%Error-PINNOTFOUND: t/t_param_implicit_local_bad.v:21:22: Parameter not found: '__paramNumber3'
21 | prgm1 # ( 9, 40, 41 ) i_prgm1 ();
| ^~
: ... Location of instance's program declaration
50 | program prgm1 # (
| ^~~~~
%Error: Exiting due to

View File

@ -13,6 +13,9 @@
%Error-PINNOTFOUND: t/t_udp_bad.v:10:13: Pin not found: '__pinNumber1'
10 | udp_x x (a, b);
| ^
: ... Location of instance's primitive declaration
14 | primitive udp_x (a_bad, b, c_bad);
| ^~~~~
... For error description see https://verilator.org/warn/PINNOTFOUND?v=latest
%Error: t/t_udp_bad.v:17:11: Multiple outputs not allowed in udp modules
17 | output c_bad;