Improve error on > 127 char modnames. #2106.

This commit is contained in:
Wilson Snyder 2020-01-14 07:33:12 -05:00
parent 67bb0c78c8
commit af38e8d387
3 changed files with 72 additions and 1 deletions

View File

@ -374,7 +374,12 @@ string V3Options::filePath(FileLine* fl, const string& modname, const string& la
void V3Options::filePathLookedMsg(FileLine* fl, const string& modname) {
static bool shown_notfound_msg = false;
if (!shown_notfound_msg) {
if (modname.find("__Vhsh") != string::npos) {
std::cerr << V3Error::warnMore() << "... Unsupported: Name is longer than 127 characters;"
<< " automatic file lookup not supported.\n";
std::cerr << V3Error::warnMore() << "... Suggest putting filename with this module/package"
<< " onto command line instead.\n";
} else if (!shown_notfound_msg) {
shown_notfound_msg = true;
if (m_impp->m_incDirUsers.empty()) {
fl->v3error("This may be because there's no search path specified with -I<dir>."<<endl);

View File

@ -0,0 +1,6 @@
%Error: obj_vlt/t_inst_long_bad/t_inst_long.v:4: Cannot find file containing module: 'long_long_long_long_long_long_lo__Vhsh1JZCXQVBM1QiASYlLmgTuAXYyUr7VAbJYwVHfiAD'
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 ();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... Unsupported: Name is longer than 127 characters; automatic file lookup not supported.
... Suggest putting filename with this module/package onto command line instead.
%Error: Exiting due to

View File

@ -0,0 +1,60 @@
#!/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.
use IO::File;
use strict;
use vars qw($Self);
scenarios(vlt => 1);
my $length = 200;
my $long = "long_" x (($length + 4) / 5);
sub gen_top {
my $filename = shift;
my $fh = IO::File->new(">$filename")
or $Self->error("Can't write $filename");
$fh->print("// Generated by t_inst_long.pl\n");
$fh->print("module t;\n");
$fh->print("\n");
$fh->print(" ${long} inst ();\n");
$fh->print("\n");
$fh->print("endmodule\n");
$fh->close;
}
sub gen_sub {
my $filename = shift;
my $fh = IO::File->new(">$filename")
or $Self->error("Can't write $filename");
$fh->print("// Generated by t_inst_long.pl\n");
$fh->print("module ${long};\n");
$fh->print("\n");
$fh->print(" initial begin\n");
$fh->print(" \$write(\"*-* All Finished *-*\\n\");\n");
$fh->print(" \$finish;\n");
$fh->print(" end\n");
$fh->print("endmodule\n");
$fh->close;
}
top_filename("$Self->{obj_dir}/t_inst_long.v", $long);
gen_top($Self->{top_filename});
gen_sub("$Self->{obj_dir}/${long}.v");
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;