When running with VERILATOR_ROOT, optionally find binaries under bin.

This commit is contained in:
Wilson Snyder 2010-12-07 11:43:43 -05:00
parent 79ca7f3cb5
commit d13e6c73db
2 changed files with 17 additions and 3 deletions

View File

@ -9,6 +9,8 @@ indicates the contributor was also the author of the fix; Thanks!
*** Suppress WIDTH warnings when adding/subtracting 1'b1.
**** When running with VERILATOR_ROOT, optionally find binaries under bin.
* Verilator 3.805 2010/11/02
**** Add warning when directory contains spaces, msg378. [Salman Sheikh]

View File

@ -113,9 +113,20 @@ sub debug {
sub verilator_bin {
my $bin = "";
# Use VERILATOR_ROOT if defined, else assume verilator_bin is in the search path
$bin .= $ENV{VERILATOR_ROOT}."/" if defined($ENV{VERILATOR_ROOT});
$bin .= ($ENV{VERILATOR_BIN}
|| ($Debug ? "verilator_bin_dbg" : "verilator_bin"));
my $basename = ($ENV{VERILATOR_BIN}
|| ($Debug ? "verilator_bin_dbg" : "verilator_bin"));
if (defined($ENV{VERILATOR_ROOT})) {
my $dir = $ENV{VERILATOR_ROOT}."/";
if (-x "$basename") {
$bin = $basename;
} elsif (-x "$dir/bin/$basename") { # From a "make install" into VERILATOR_ROOT
$bin = "$dir/bin/$basename";
} else {
$bin = "$dir/$basename"; # From pointing to kit directory
}
} else {
$bin = $basename;
}
return $bin;
}
@ -126,6 +137,7 @@ sub verilator_bin {
sub run {
# Run command, check errors
my $command = shift;
$! = undef; # Cleanup -x
print "\t$command\n" if $Debug>=3;
system($command);
my $status = $?;