Fix error message on missing interface, bug985.

This commit is contained in:
Wilson Snyder 2015-10-29 21:44:02 -04:00
parent 379bfd062f
commit fa63bc6b78
4 changed files with 61 additions and 1 deletions

View File

@ -39,6 +39,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix crash in commandArgsPlusMatch, bug987. [Jamie Iles]
**** Fix error message on missing interface, bug985. [Todd Strader]
* Verilator 3.876 2015-08-12

View File

@ -372,7 +372,14 @@ public:
UINFO(9, " insAllIface se"<<(void*)varSymp<<" "<<varp<<endl);
AstIfaceRefDType* ifacerefp = varp->subDTypep()->castIfaceRefDType();
if (!ifacerefp) varp->v3fatalSrc("Non-ifacerefs on list!");
if (!ifacerefp->ifaceViaCellp()) ifacerefp->v3fatalSrc("Unlinked interface");
if (!ifacerefp->ifaceViaCellp()) {
if (!ifacerefp->cellp()) { // Probably a NotFoundModule, or a normal module if made mistake
ifacerefp->v3error("Cannot find file containing interface: "<<AstNode::prettyName(ifacerefp->ifaceName()));
continue;
} else {
ifacerefp->v3fatalSrc("Unlinked interface");
}
}
VSymEnt* ifaceSymp = getNodeSym(ifacerefp->ifaceViaCellp());
VSymEnt* ifOrPortSymp = ifaceSymp;
// Link Modport names to the Modport Node under the Interface

View File

@ -0,0 +1,18 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003 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.
compile (
fails=>1,
expect=>
qr{%Error: t/t_interface_missing_bad.v:\d+: Cannot find file containing interface: foo_intf
.*},
);
ok(1);
1;

View File

@ -0,0 +1,33 @@
// DESCRIPTION: Verilator: Missing interface test
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Todd Strader.
// Interface intentionally not defined
//interface foo_intf;
// logic a;
//endinterface
module foo_mod
(
foo_intf foo
);
endmodule
module t (/*AUTOARG*/);
foo_intf the_foo ();
foo_mod
foo_mod
(
.foo (the_foo)
);
initial begin
$write("*-* All Finished *-*\n");
$finish;
end
endmodule