diff --git a/src/V3Options.cpp b/src/V3Options.cpp index eb31d5502..8a3f20b72 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -553,7 +553,7 @@ string V3Options::filePath(FileLine* fl, const string& modname, const string& la // Find a filename to read the specified module name, // using the incdir and libext's. // Return "" if not found. - const string filename = V3Os::filenameCleanup(modname); + const string filename = V3Os::filenameCleanup(VName::dehash(modname)); if (!V3Os::filenameIsRel(filename)) { // filename is an absolute path, so can find getStdPackagePath() string exists = filePathCheckOneDir(filename, ""); @@ -585,8 +585,8 @@ void V3Options::filePathLookedMsg(FileLine* fl, const string& modname) { static bool shown_notfound_msg = false; if (modname.find("__Vhsh") != string::npos) { std::cerr << V3Error::warnMoreStandalone() - << "... Unsupported: Name is longer than 127 characters;" - << " automatic file lookup not supported.\n"; + << "... Note: Name is longer than 127 characters; automatic" + << " file lookup may have failed due to OS filename length limits.\n"; std::cerr << V3Error::warnMoreStandalone() << "... Suggest putting filename with this module/package" << " onto command line instead.\n"; diff --git a/test_regress/t/t_inst_long.pl b/test_regress/t/t_inst_long.pl new file mode 100755 index 000000000..425516114 --- /dev/null +++ b/test_regress/t/t_inst_long.pl @@ -0,0 +1,58 @@ +#!/usr/bin/env 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. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-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"); + +compile(); + +ok(1); +1; diff --git a/test_regress/t/t_inst_long_bad.out b/test_regress/t/t_inst_long_bad.out index 3020fe05a..bef6bf9a1 100644 --- a/test_regress/t/t_inst_long_bad.out +++ b/test_regress/t/t_inst_long_bad.out @@ -1,6 +1,6 @@ -%Error: obj_vlt/t_inst_long_bad/t_inst_long.v:4:3: Cannot find file containing module: 'long_long_long_long_long_long___Vhsh1JZCXQVBM1QiASYlLmgTuAXYyUr7VAbJYwVHfiAD' - 4 | 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 (); +%Error: 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 (); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ... Unsupported: Name is longer than 127 characters; automatic file lookup not supported. + ... 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 diff --git a/test_regress/t/t_inst_long_bad.pl b/test_regress/t/t_inst_long_bad.pl index 73eaa142a..a60503a1f 100755 --- a/test_regress/t/t_inst_long_bad.pl +++ b/test_regress/t/t_inst_long_bad.pl @@ -8,49 +8,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Version 2.0. # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-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"); +scenarios(linter => 1); lint( fails => 1, diff --git a/test_regress/t/t_inst_long_bad.v b/test_regress/t/t_inst_long_bad.v new file mode 100644 index 000000000..5340a983a --- /dev/null +++ b/test_regress/t/t_inst_long_bad.v @@ -0,0 +1,11 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2012 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +module t; + + 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 (); + +endmodule