From fa63bc6b78c93b6afb39de201994735ab3ba25cf Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 29 Oct 2015 21:44:02 -0400 Subject: [PATCH] Fix error message on missing interface, bug985. --- Changes | 2 ++ src/V3LinkDot.cpp | 9 ++++++- test_regress/t/t_interface_missing_bad.pl | 18 +++++++++++++ test_regress/t/t_interface_missing_bad.v | 33 +++++++++++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100755 test_regress/t/t_interface_missing_bad.pl create mode 100644 test_regress/t/t_interface_missing_bad.v diff --git a/Changes b/Changes index 1bb3076f2..fa42e52c8 100644 --- a/Changes +++ b/Changes @@ -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 diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 96c32463e..3c88f993f 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -372,7 +372,14 @@ public: UINFO(9, " insAllIface se"<<(void*)varSymp<<" "<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: "<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 diff --git a/test_regress/t/t_interface_missing_bad.pl b/test_regress/t/t_interface_missing_bad.pl new file mode 100755 index 000000000..a1b6d3a6f --- /dev/null +++ b/test_regress/t/t_interface_missing_bad.pl @@ -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; diff --git a/test_regress/t/t_interface_missing_bad.v b/test_regress/t/t_interface_missing_bad.v new file mode 100644 index 000000000..d95134482 --- /dev/null +++ b/test_regress/t/t_interface_missing_bad.v @@ -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 +