Format: perltidy spacing cleanup. No functional change.

This commit is contained in:
Wilson Snyder 2021-09-07 23:50:28 -04:00
parent 2a79e46c46
commit c678e7ec3e
30 changed files with 288 additions and 285 deletions

View File

@ -34,11 +34,11 @@ my $opt_quiet_exit;
# No arguments can't do anything useful. Give help
if ($#ARGV < 0) {
pod2usage(-exitstatus=>2, -verbose=>0);
pod2usage(-exitstatus => 2, -verbose => 0);
}
# Insert debugging options up front
push @ARGV, (split ' ',$ENV{VERILATOR_TEST_FLAGS}||"");
push @ARGV, (split ' ', $ENV{VERILATOR_TEST_FLAGS} || "");
# We sneak a look at the flags so we can do some pre-environment checks
# All flags will hit verilator...
@ -60,7 +60,7 @@ if (! GetOptions(
# Additional parameters
"<>" => sub {}, # Ignored
)) {
pod2usage(-exitstatus=>2, -verbose=>0);
pod2usage(-exitstatus => 2, -verbose => 0);
}
if ($opt_gdbbt && !gdb_works()) {
@ -73,12 +73,12 @@ if ($opt_gdbbt && !gdb_works()) {
# Starting with that, escape all special chars for the shell;
# The shell will undo the escapes and the verilator binary should
# then see exactly the contents of @Opt_Verilator_Sw.
my @quoted_sw = map {sh_escape($_)} @Opt_Verilator_Sw;
my @quoted_sw = map { sh_escape($_) } @Opt_Verilator_Sw;
if ($opt_gdb) {
# Generic GDB interactive
run (aslr_off()
.($ENV{VERILATOR_GDB}||"gdb")
." ".verilator_bin()
. ($ENV{VERILATOR_GDB} || "gdb")
. " " . verilator_bin()
# Note, uncomment to set breakpoints before running:
# ." -ex 'break main'"
@ -87,42 +87,42 @@ if ($opt_gdb) {
# escapes as you would expect in a double-quoted string.
# That's not true for a single-quoted string, where \'
# actually terminates the string -- not what we want!
." -ex \"run ".join(' ', @quoted_sw)."\""
." -ex 'set width 0'"
." -ex 'bt'");
. " -ex \"run " . join(' ', @quoted_sw) . "\""
. " -ex 'set width 0'"
. " -ex 'bt'");
} elsif ($opt_rr) {
# Record with rr
run (aslr_off()
."rr record ".verilator_bin()
." ".join(' ', @quoted_sw));
. "rr record " . verilator_bin()
. " " . join(' ', @quoted_sw));
} elsif ($opt_gdbbt && $Debug) {
# Run under GDB to get gdbbt
run (aslr_off()
."gdb"
." ".verilator_bin()
." --batch --quiet --return-child-result"
." -ex \"run ".join(' ', @quoted_sw)."\""
." -ex 'set width 0'"
." -ex 'bt' -ex 'quit'");
. "gdb"
. " " . verilator_bin()
. " --batch --quiet --return-child-result"
. " -ex \"run " . join(' ', @quoted_sw)."\""
. " -ex 'set width 0'"
. " -ex 'bt' -ex 'quit'");
} elsif ($Debug) {
# Debug
run(aslr_off()
.verilator_bin()." ".join(' ',@quoted_sw));
. verilator_bin() . " " . join(' ',@quoted_sw));
} else {
# Normal, non gdb
run(verilator_bin()." ".join(' ',@quoted_sw));
run(verilator_bin() . " " . join(' ',@quoted_sw));
}
#----------------------------------------------------------------------
sub usage {
pod2usage(-verbose=>2, -exitval=>0, -output=>\*STDOUT);
pod2usage(-verbose => 2, -exitval => 0, -output => \*STDOUT);
}
sub debug {
shift;
my $level = shift;
$Debug = $level||3;
$Debug = $level || 3;
}
#######################################################################
@ -169,7 +169,7 @@ sub gdb_works {
." -ex 'bt'"
." -ex 'quit'");
my $status = $?;
return $status==0;
return $status == 0;
}
sub aslr_off {
@ -185,7 +185,7 @@ sub run {
# Run command, check errors
my $command = shift;
$! = undef; # Cleanup -x
print "\t$command\n" if $Debug>=3;
print "\t$command\n" if $Debug >= 3;
system($command);
my $status = $?;
if ($status) {
@ -193,7 +193,7 @@ sub run {
warn "%Error: verilator: Misinstalled, or VERILATOR_ROOT might need to be in environment\n";
}
if ($Debug) { # For easy rerunning
warn "%Error: export VERILATOR_ROOT=".($ENV{VERILATOR_ROOT}||"")."\n";
warn "%Error: export VERILATOR_ROOT=" . ($ENV{VERILATOR_ROOT} || "") . "\n";
warn "%Error: $command\n";
}
if ($status & 127) {

View File

@ -30,7 +30,7 @@ $Debug = 0;
# No arguments can't do anything useful. Give help
if ($#ARGV < 0) {
pod2usage(-exitstatus=>2, -verbose=>0);
pod2usage(-exitstatus => 2, -verbose => 0);
}
# We sneak a look at the flags so we can do some pre-environment checks
@ -40,7 +40,7 @@ foreach my $sw (@ARGV) {
push @Opt_Verilator_Sw, $sw;
}
Getopt::Long::config("no_auto_abbrev","pass_through");
Getopt::Long::config("no_auto_abbrev", "pass_through");
if (! GetOptions (
# Major operating modes
"help" => \&usage,
@ -49,23 +49,23 @@ if (! GetOptions (
# Additional parameters
"<>" => sub {}, # Ignored
)) {
pod2usage(-exitstatus=>2, -verbose=>0);
pod2usage(-exitstatus => 2, -verbose => 0);
}
# Normal, non gdb
run(verilator_coverage_bin()
." ".join(' ',@Opt_Verilator_Sw));
. " " . join(' ', @Opt_Verilator_Sw));
#----------------------------------------------------------------------
sub usage {
pod2usage(-verbose=>2, -exitval=>0, -output=>\*STDOUT);
pod2usage(-verbose => 2, -exitval => 0, -output => \*STDOUT);
}
sub debug {
shift;
my $level = shift;
$Debug = $level||3;
$Debug = $level || 3;
}
#######################################################################
@ -107,7 +107,7 @@ sub run {
# Run command, check errors
my $command = shift;
$! = undef; # Cleanup -x
print "\t$command\n" if $Debug>=3;
print "\t$command\n" if $Debug >= 3;
system($command);
my $status = $?;
if ($status) {
@ -115,11 +115,11 @@ sub run {
warn "%Error: verilator_coverage: Misinstalled, or VERILATOR_ROOT might need to be in environment\n";
}
if ($Debug) { # For easy rerunning
warn "%Error: export VERILATOR_ROOT=".($ENV{VERILATOR_ROOT}||"")."\n";
warn "%Error: export VERILATOR_ROOT=" . ($ENV{VERILATOR_ROOT} || "") . "\n";
warn "%Error: $command\n";
}
if ($status & 127) {
if (($status & 127) == 8 || ($status & 127) == 11) { # SIGFPA or SIGSEGV
if (($status & 127) == 8 || ($status & 127) == 11) { # SIGFPA or SIGSEGV
warn "%Error: Verilator_coverage internal fault, sorry.\n" if !$Debug;
} elsif (($status & 127) == 6) { # SIGABRT
warn "%Error: Verilator_coverage aborted.\n" if !$Debug;

View File

@ -10,11 +10,11 @@
require 5.005;
use warnings;
print "// DESCR"."IPTION: Generated by verilator_includer via makefile\n";
print "// DESCR" . "IPTION: Generated by verilator_includer via makefile\n";
foreach my $param (@ARGV) {
if ($param =~ /^-D([^=]+)=(.*)/) {
print "#define $1 $2\n"
print "#define $1 $2\n";
} else {
print "#include \"$param\"\n"
print "#include \"$param\"\n";
}
}

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ file_grep_any(\@files, qr/dly__t__DOT__v1/i);
file_grep_any(\@files, qr/dly__t__DOT__v2/i);
execute(
check_finished=>1,
check_finished => 1,
);
ok(1);

View File

@ -19,7 +19,7 @@ if ($Self->{vlt_all}) {
}
execute(
check_finished=>1,
check_finished => 1,
);
ok(1);

View File

@ -28,7 +28,7 @@ foreach my $file (
}
execute(
check_finished=>1,
check_finished => 1,
);
ok(1);

View File

@ -11,7 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(simulator => 1);
compile(
verilator_flags2=>["-no-order-clock-delay"],
verilator_flags2 => ["-no-order-clock-delay"],
);
execute(

View File

@ -11,7 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(simulator => 1);
compile(
verilator_flags2=>["-Wno-UNOPTTHREADS", "--stats"],
verilator_flags2 => ["-Wno-UNOPTTHREADS", "--stats"],
);
execute(

View File

@ -11,7 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(simulator => 1);
compile(
verilator_flags2=>["-Wno-UNOPTTHREADS", "--stats", "--coverage", "--trace"],
verilator_flags2 => ["-Wno-UNOPTTHREADS", "--stats", "--coverage", "--trace"],
);
execute(

View File

@ -11,7 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(simulator => 1);
compile(
verilator_flags2=>["-Wno-UNOPTTHREADS", "--stats"],
verilator_flags2 => ["-Wno-UNOPTTHREADS", "--stats"],
);
execute(

View File

@ -12,7 +12,7 @@ scenarios(simulator => 1);
compile(
v_flags2 => ["t/$Self->{name}.cpp"],
verilator_flags2=>["-Wno-UNOPTTHREADS", "--stats"],
verilator_flags2 => ["-Wno-UNOPTTHREADS", "--stats"],
);
execute(

View File

@ -11,7 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(simulator => 1);
compile(
verilator_flags2=>["--stats"],
verilator_flags2 => ["--stats"],
);
execute(

View File

@ -51,7 +51,7 @@ if (!-r "$root/.git") {
}
if (keys %names) {
error("Files like stdint.h instead of cstdint: ",join(' ',sort keys %names));
error("Files like stdint.h instead of cstdint: ", join(' ', sort keys %names));
}
}

View File

@ -68,7 +68,7 @@ sub formats {
$lnmatch or error("Check line number regexp is correct, no matches");
if (keys %warns) {
# First warning lists everything as that's shown in the driver summary
error($summary." ",join(' ',sort keys %warns));
error($summary . " ", join(' ', sort keys %warns));
foreach my $file (sort keys %warns) {
error($warns{$file});
}

View File

@ -32,7 +32,7 @@ if (!-r "$root/.git") {
}
foreach my $bfiles (@batch) {
my $cmd = "cd $root && grep -n -P '(FIX"."ME|BO"."ZO)' $bfiles | sort";
my $cmd = "cd $root && grep -n -P '(FIX" . "ME|BO" . "ZO)' $bfiles | sort";
my $grep = `$cmd`;
if ($grep ne "") {
print "$grep\n";
@ -43,7 +43,7 @@ if (!-r "$root/.git") {
}
}
if (scalar(%names) >= 1) {
error("Files with FIX"."MEs: ",join(' ',sort keys %names));
error("Files with FIX" . "MEs: ", join(' ', sort keys %names));
}
}

View File

@ -34,7 +34,7 @@ sub inctree {
my $grep = `$cmd`;
foreach my $line (split /\n/, $grep) {
if ($line =~ /^(\S+):(\d+):#\s*include\s*(\S+)/) {
my $filename = $1; my $line = $2+0; my $inc = $3;
my $filename = $1; my $line = $2 + 0; my $inc = $3;
(my $base = $filename) =~ s!.*/(.*?)!$1!;
$inc =~ s/[<>"]//g;
$Files{$base}{filename} = $filename;

View File

@ -19,7 +19,7 @@ if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
my $cwd = getcwd();
my $destdir = "$cwd/".$Self->{obj_dir};
my $destdir = "$cwd/" . $Self->{obj_dir};
# Start clean
run(cmd => ["rm -rf $destdir && mkdir -p $destdir"],
check_finished => 0);
@ -48,7 +48,7 @@ if (!-r "$root/.git") {
push @files, $file;
}
if ($#files >= 0) {
error("Uninstall missed files: ",join(' ',@files));
error("Uninstall missed files: ", join(' ',@files));
}
}

View File

@ -48,7 +48,7 @@ sub uint {
}
}
if (keys %names) {
error("Files with uint32*_t instead of vluint32s: ",join(' ',sort keys %names));
error("Files with uint32*_t instead of vluint32s: ", join(' ', sort keys %names));
}
}
@ -69,7 +69,7 @@ sub printfll {
}
}
if (keys %names) {
error("Files with %ll instead of VL_PRI64: ",join(' ',sort keys %names));
error("Files with %ll instead of VL_PRI64: ", join(' ', sort keys %names));
}
}
@ -87,7 +87,7 @@ sub cstr {
}
}
if (keys %names) {
error("Files with potential c_str() lifetime issue: ",join(' ',sort keys %names));
error("Files with potential c_str() lifetime issue: ", join(' ', sort keys %names));
}
}
@ -106,7 +106,7 @@ sub vsnprintf {
}
}
if (keys %names) {
error("Files with vsnprintf, use VL_VSNPRINTF: ",join(' ',sort keys %names));
error("Files with vsnprintf, use VL_VSNPRINTF: ", join(' ', sort keys %names));
}
}
@ -127,7 +127,7 @@ sub final {
}
}
if (keys %names) {
error("Files with classes without final/VL_NOT_FINAL: ",join(' ',sort keys %names));
error("Files with classes without final/VL_NOT_FINAL: ", join(' ', sort keys %names));
}
}

View File

@ -43,10 +43,10 @@ if (!-r "$root/.git") {
$btab = 0;
print " File $file\n" if $Self->{verbose};
}
elsif ($line =~ m!^@@ -?[0-9]+,?[0-9]* \+?([0-9]+)!) {
elsif ($line =~ m!^@@ -?[0-9]+,?[0-9]* \+?([0-9]+)!) {
$lineno = $1 - 1;
}
elsif ($line =~ m!^ !) {
elsif ($line =~ m!^ !) {
++$lineno;
if ($line =~ m!^[- ].*\t!) {
print " Had tabs\n" if $Self->{verbose} && !$atab;
@ -72,7 +72,7 @@ if (!-r "$root/.git") {
if ($len >= 100
&& $file !~ $Tabs_Exempt_Re
&& $file !~ $Wide_Exempt_Re) {
print" Wide $line\n" if $Self->{verbose};
print " Wide $line\n" if $Self->{verbose};
$summary = "File modification adds a new >100 column line:" if !$summary;
$warns{$file} = "File modification adds a new >100 column line: $file:$lineno";
}
@ -81,7 +81,7 @@ if (!-r "$root/.git") {
}
if (keys %warns) {
# First warning lists everything as that's shown in the driver summary
error($summary." ",join(' ',sort keys %warns));
error($summary . " ", join(' ', sort keys %warns));
foreach my $file (sort keys %warns) {
error($warns{$file});
}

View File

@ -27,16 +27,16 @@ if (!-r "$root/.git") {
next if $file =~ /nodist/;
if (_has_tabs("$root/$file")) {
$warns{$file} = "File not in git or .gitignore (with tabs): $file";
$summary = "Files untracked in git or .gitignore (with tabs):"
$summary = "Files untracked in git or .gitignore (with tabs):";
} else {
$warns{$file} = "File not in git or .gitignore: $file";
$summary ||= "Files untracked in git or .gitignore:"
$summary ||= "Files untracked in git or .gitignore:";
}
}
}
if (keys %warns) {
# First warning lists everything as that's shown in the driver summary
error($summary." ",join(' ',sort keys %warns));
error($summary . " ", join(' ', sort keys %warns));
foreach my $file (sort keys %warns) {
error($warns{$file});
}

View File

@ -66,10 +66,10 @@ foreach my $file (sort keys %files) {
if (keys %warns) {
# First warning lists everything as that's shown in the driver summary
if ($ENV{HARNESS_UPDATE_GOLDEN}) {
error("Updated files with whitespace errors: ",join(' ',sort keys %warns));
error("Updated files with whitespace errors: ", join(' ', sort keys %warns));
error("To auto-fix: HARNESS_UPDATE_GOLDEN=1 {command} or --golden");
} else {
error("Files have whitespace errors: ",join(' ',sort keys %warns));
error("Files have whitespace errors: ", join(' ', sort keys %warns));
error("To auto-fix: HARNESS_UPDATE_GOLDEN=1 {command} or --golden");
}
foreach my $file (sort keys %warns) {

View File

@ -26,10 +26,10 @@ compile(
my @files = glob($tmp_dir . "/*");
error("Did not produce DPI header") if scalar(@files) == 0;
error("Too many files created:".join(', ', @files)) if scalar(@files) > 1;
error("Too many files created:" . join(', ', @files)) if scalar(@files) > 1;
my $tmp_header = $files[0];
print("============".$tmp_header."\n");
print("============" . $tmp_header . "\n");
error("Unexpected file $tmp_header") unless $tmp_header =~ /__Dpi\.h$/;
compile(

View File

@ -24,7 +24,7 @@ sub gen {
$fh->print("\n");
my $prev = "i";
my $n = 9000;
for (my $i=1; $i<$n; ++$i) {
for (my $i = 1; $i < $n; ++$i) {
$fh->printf(" wire [63:0] ass%04x = (sel == 16'h%04x) ? 64'h0 : $prev;\n", $i, $i);
$prev = sprintf("ass%04x", $i);
}
@ -34,8 +34,8 @@ sub gen {
$fh->print("\n");
$fh->print(" always @ (posedge clk) begin\n");
$fh->print(' $write("*-* All Finished *-*\n");',"\n");
$fh->print(' $finish;',"\n");
$fh->print(' $write("*-* All Finished *-*\n");', "\n");
$fh->print(' $finish;', "\n");
$fh->print(" end\n");
$fh->print("endmodule\n");
}
@ -45,8 +45,8 @@ top_filename("$Self->{obj_dir}/t_gate_chained.v");
gen($Self->{top_filename});
compile(
verilator_flags2=>["--stats --x-assign fast --x-initial fast",
"-Wno-UNOPTTHREADS"],
verilator_flags2 => ["--stats --x-assign fast --x-initial fast",
"-Wno-UNOPTTHREADS"],
);
execute(

View File

@ -15,7 +15,7 @@ $Self->{sim_time} = $Self->{cycles} * 10 + 1000;
compile(
v_flags2 => ["+define+SIM_CYCLES=$Self->{cycles}",],
verilator_flags2=>["-Wno-UNOPTTHREADS", "--stats"],
verilator_flags2 => ["-Wno-UNOPTTHREADS", "--stats"],
);
if ($Self->{vlt}) {

View File

@ -51,7 +51,7 @@ sub preproc_check {
my $check = shift @Line_Checks;
if (!$check) { error("$filename2:$.: Extra Line_Preproc_Check\n"); }
if ($linecmt != $check) { error("$filename2:$.: __LINE__ inserted $linecmt, exp=$check\n"); }
if ($lineno != $check) { error("$filename2:$.: __LINE__ on `line $lineno, exp=$check\n"); }
if ($lineno != $check) { error("$filename2:$.: __LINE__ on `line $lineno, exp=$check\n"); }
}
}
$fh->close;

View File

@ -34,18 +34,18 @@ sub gen {
$fh->print(" initial begin\n");
my $n = 100;
for (my $i=1; $i<$n; ++$i) {
for (my $i = 1; $i < $n; ++$i) {
# If statement around the timing is important to make the code scheduling
# mostly unpredictable
$fh->printf(" if (cnt == %d) begin\n", $i-1);
$fh->printf(" if (cnt == %d) begin\n", $i - 1);
$fh->printf(" #1; ++cnt; `MSG((\"[%0t] cnt?=${i}\", \$time));"
." if (cnt != %d) \$stop;\n", $i);
$fh->printf(" end\n");
}
$fh->print("\n");
$fh->print(' $write("*-* All Finished *-*\n");',"\n");
$fh->print(' $finish;',"\n");
$fh->print(' $write("*-* All Finished *-*\n");', "\n");
$fh->print(' $finish;', "\n");
$fh->print(" end\n");
$fh->print("endmodule\n");
}
@ -55,8 +55,8 @@ top_filename("$Self->{obj_dir}/t_timing_long.v");
gen($Self->{top_filename});
compile(
#verilator_flags2=>["--exe --build --main --timing"], # Unsupported
verilator_flags2=>["--exe --build --main -Wno-STMTDLY"],
# verilator_flags2 => ["--exe --build --main --timing"], # Unsupported
verilator_flags2 => ["--exe --build --main -Wno-STMTDLY"],
verilator_make_cmake => 0,
verilator_make_gmake => 0,
make_main => 0,

View File

@ -20,7 +20,7 @@ execute(
check_finished => 1,
);
file_grep ("$Self->{obj_dir}/simx.vcd", qr/ PARAM /);
file_grep("$Self->{obj_dir}/simx.vcd", qr/ PARAM /);
vcd_identical("$Self->{obj_dir}/simx.vcd", $Self->{golden_filename});

View File

@ -11,7 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(simulator => 1);
compile(
verilator_flags2=>["-Wno-UNOPTFLAT"],
verilator_flags2 => ["-Wno-UNOPTFLAT"],
);
execute(

View File

@ -11,7 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(simulator => 1);
compile(
verilator_flags2=>["-Wno-SYMRSVDWORD"],
verilator_flags2 => ["-Wno-SYMRSVDWORD"],
);
execute();