diff --git a/bin/verilator b/bin/verilator index 0a9ceaf71..c188ac3a2 100755 --- a/bin/verilator +++ b/bin/verilator @@ -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) { diff --git a/bin/verilator_coverage b/bin/verilator_coverage index ab76d15ba..0ec1f1bac 100755 --- a/bin/verilator_coverage +++ b/bin/verilator_coverage @@ -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; diff --git a/bin/verilator_includer b/bin/verilator_includer index d6c26860b..356849827 100755 --- a/bin/verilator_includer +++ b/bin/verilator_includer @@ -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"; } } diff --git a/test_regress/driver.pl b/test_regress/driver.pl index 9a04b9ebd..bf8590571 100755 --- a/test_regress/driver.pl +++ b/test_regress/driver.pl @@ -5,9 +5,10 @@ require 5.006_001; use warnings; use Cwd; + BEGIN { if (!$ENV{VERILATOR_ROOT} && -x "../bin/verilator") { - $ENV{VERILATOR_ROOT} = Cwd::getcwd()."/.."; + $ENV{VERILATOR_ROOT} = Cwd::getcwd() . "/.."; } $ENV{MAKE} ||= "make"; $ENV{CXX} ||= "c++"; @@ -16,7 +17,7 @@ BEGIN { use Getopt::Long; use IO::File; use Pod::Usage; -use Data::Dumper; $Data::Dumper::Sortkeys=1; +use Data::Dumper; $Data::Dumper::Sortkeys = 1; use FindBin qw($RealBin); use strict; use vars qw($Debug %Vars $Driver $Fork); @@ -30,7 +31,7 @@ $::Driver = 1; $::Have_Forker = 0; eval "use Parallel::Forker; \$Fork=Parallel::Forker->new(use_sig_child=>1, poll_interval=>10*1000); \$::Have_Forker=1;"; -$Fork = Forker->new(use_sig_child=>1) if !$Fork; +$Fork = Forker->new(use_sig_child => 1) if !$Fork; my $forker_Min_Version = 1.258; if ($::Have_Forker && $Parallel::Forker::VERSION < $forker_Min_Version) { print STDERR "driver.pl: Parallel::Forker is older than $forker_Min_Version, suggest 'cpan install Parallel::Forker'\n"; @@ -62,7 +63,7 @@ autoflush STDOUT 1; autoflush STDERR 1; our @Orig_ARGV = @ARGV; -our @Orig_ARGV_Sw; foreach (@Orig_ARGV) { push @Orig_ARGV_Sw, $_ if /^-/ && !/^-j/; } +our @Orig_ARGV_Sw; foreach (@Orig_ARGV) { push @Orig_ARGV_Sw, $_ if /^-/ && !/^-j/; } our $Start = time(); our $Vltmt_threads = 3; @@ -133,7 +134,7 @@ if (! GetOptions( die "%Error: Bad usage, try '$0 --help'\n"; } -$opt_jobs = calc_jobs() if defined $opt_jobs && $opt_jobs==0; +$opt_jobs = calc_jobs() if defined $opt_jobs && $opt_jobs == 0; $Fork->max_proc($opt_jobs); if ((scalar keys %opt_scenarios) < 1) { @@ -142,10 +143,10 @@ if ((scalar keys %opt_scenarios) < 1) { } our @Test_Dirs = "t"; -push @Test_Dirs, split(/:/,$ENV{VERILATOR_TESTS_SITE}) - if (($#opt_tests<0 ? $opt_site : 1) && $ENV{VERILATOR_TESTS_SITE}); +push @Test_Dirs, split(/:/, $ENV{VERILATOR_TESTS_SITE}) + if (($#opt_tests < 0 ? $opt_site : 1) && $ENV{VERILATOR_TESTS_SITE}); -if ($#opt_tests<0) { # Run everything +if ($#opt_tests < 0) { # Run everything my %uniq; foreach my $dir (@Test_Dirs) { my @stats = stat($dir); # Uniquify by inode, so different paths to same place get combined @@ -155,7 +156,7 @@ if ($#opt_tests<0) { # Run everything } @opt_tests = _calc_hashset(@opt_tests) if $opt_hashset; -if ($#opt_tests>=2 && $opt_jobs>=2) { +if ($#opt_tests >= 2 && $opt_jobs >= 2) { # Without this tests such as t_debug_sigsegv_bt_bad.pl will occasionally # block on input and cause a SIGSTOP, then a "fg" was needed to resume testing. if (!$::Have_Forker) { @@ -165,7 +166,6 @@ if ($#opt_tests>=2 && $opt_jobs>=2) { open(STDIN, "+>/dev/null"); } - mkdir "obj_dist"; my $timestart = strftime("%Y%m%d_%H%M%S", localtime); @@ -185,8 +185,8 @@ my $runner; } if ($opt_rerun && $runner->fail_count) { - print("="x70,"\n"); - print("="x70,"\n"); + print("=" x 70, "\n"); + print("=" x 70, "\n"); print("RERUN ==\n\n"); # Avoid parallel run to ensure that isn't causing problems @@ -215,7 +215,7 @@ exit(10) if $runner->fail_count; #---------------------------------------------------------------------- sub usage { - pod2usage(-verbose=>2, -exitval=>0, -output=>\*STDOUT); + pod2usage(-verbose => 2, -exitval => 0, -output => \*STDOUT); exit(1); # Unreachable } @@ -232,7 +232,7 @@ sub parameter { ($param =~ /^(\d+)$/) or die "%Error: Expected number following $_Parameter_Next_Level: $param\n"; push @Opt_Driver_Verilator_Flags, $param; - $_Parameter_Next_Level = undef; + $_Parameter_Next_Level = undef; } elsif ($param =~ /\.pl/) { push @opt_tests, $param; @@ -250,6 +250,7 @@ sub parameter { } our $_Max_Procs; + sub max_procs { if (!defined $_Max_Procs) { $_Max_Procs = `python3 -c 'import multiprocessing\nprint(multiprocessing.cpu_count())'`; @@ -272,7 +273,7 @@ sub calc_threads { sub calc_jobs { my $ok = max_procs(); $ok && !$@ or die "%Error: Can't use -j: $@\n"; - print "driver.pl: Found $ok cores, using -j ",$ok+1,"\n"; + print "driver.pl: Found $ok cores, using -j ", $ok + 1, "\n"; return $ok + 1; } @@ -351,10 +352,10 @@ sub one_test { open(STDOUT, ">/dev/null"); open(STDERR, ">&STDOUT"); } - print("="x70,"\n"); + print("=" x 70, "\n"); my $test = VTest->new(@params, running_id => $process->{running_id}); - $test->oprint("="x50,"\n"); + $test->oprint("=" x 50, "\n"); unlink $test->{status_filename}; $test->_prep; $test->_read; @@ -373,7 +374,7 @@ sub one_test { } elsif ($test->scenario_off && !$test->errors) { } elsif ($test->skips && !$test->errors) { push @{$self->{skip_msgs}}, - ("\t#".$test->soprint("-Skip: $test->{skips}\n")); + ("\t#" . $test->soprint("-Skip: $test->{skips}\n")); $self->{skip_cnt}++; } elsif ($test->unsupporteds && !$test->errors) { $self->{unsup_cnt}++; @@ -384,19 +385,19 @@ sub one_test { my $upperdir = (Cwd::getcwd() =~ /test_regress/ ? 'test_regress/' : ''); push @{$self->{fail_msgs}}, - ("\t#".$test->soprint("%Error: $test->{errors}\n") - ."\t\t$makecmd " - .$upperdir.$test->{pl_filename} - ." ".join(' ', _manual_args()) - ." --".$test->{scenario}."\n"); + ("\t#" . $test->soprint("%Error: $test->{errors}\n") + . "\t\t$makecmd " + . $upperdir . $test->{pl_filename} + . " " . join(' ', _manual_args()) + . " --" . $test->{scenario} . "\n"); push @{$self->{fail_tests}}, $test; $self->{fail_cnt}++; $self->report($self->{driver_log_filename}); my $other = ""; foreach my $proc ($::Fork->running) { - $other .= " ".$proc->{test_pl_filename}; + $other .= " " . $proc->{test_pl_filename}; } - $test->oprint("Simultaneous running tests:",$other,"\n") + $test->oprint("Simultaneous running tests:", $other, "\n") if $other && !$opt_quiet; if ($opt_stop) { die "%Error: --stop and errors found\n"; } } @@ -409,15 +410,15 @@ sub one_test { sub wait_and_report { my $self = shift; - $self->print_summary(force=>1); + $self->print_summary(force => 1); # Wait for all children to finish while ($::Fork->is_any_left) { $::Fork->poll; if ((time() - ($self->{_last_summary_time} || 0) >= 30) && (!$opt_gdb && !$opt_gdbsim)) { # Don't show for interactive gdb etc - $self->print_summary(force=>1, show_running=>1); + $self->print_summary(force => 1, show_running => 1); } - Time::HiRes::usleep 100*1000; + Time::HiRes::usleep 100 * 1000; } $runner->report(undef); $runner->report($self->{driver_log_filename}); @@ -433,7 +434,7 @@ sub report { } $fh->print("\n"); - $fh->print("="x70,"\n"); + $fh->print("=" x 70, "\n"); foreach my $f (sort @{$self->{fail_msgs}}) { chomp $f; $fh->print("$f\n"); @@ -445,7 +446,7 @@ sub report { my $sum = ($self->{fail_cnt} && "FAILED" || $self->{skip_cnt} && "PASSED w/SKIPS" || "PASSED"); - $fh->print("TESTS DONE, $sum: ".$self->sprint_summary."\n"); + $fh->print("TESTS DONE, $sum: " . $self->sprint_summary . "\n"); } sub print_summary { @@ -457,13 +458,13 @@ sub print_summary { || ($self->{left_cnt} < 5) || (time() - ($self->{_last_summary_time} || 0) >= 15)) { # Don't show for interactive gdb etc $self->{_last_summary_time} = time(); - print STDERR ("==SUMMARY: ".$self->sprint_summary."\n"); + print STDERR ("==SUMMARY: " . $self->sprint_summary . "\n"); if ($params{show_running}) { my $other; foreach my $proc ($::Fork->running) { - $other .= " ".$proc->{test_pl_filename}; + $other .= " " . $proc->{test_pl_filename}; } - print STDERR ("==STILL RUNNING: ".$other."\n"); + print STDERR ("==STILL RUNNING: " . $other . "\n"); } } } @@ -473,7 +474,7 @@ sub sprint_summary { my $delta = time() - $::Start; my $leftmsg = $::Have_Forker ? $self->{left_cnt} : "NO-FORKER"; - my $pct = int(100*($self->{left_cnt} / ($self->{all_cnt} + 0.001)) + 0.999); + my $pct = int(100 * ($self->{left_cnt} / ($self->{all_cnt} + 0.001)) + 0.999); # Fudge of 120% works out about right so ETA correctly predicts completion time my $eta = 1.2 * (($self->{all_cnt} * ($delta / (($self->{all_cnt} - $self->{left_cnt})+0.001))) @@ -487,8 +488,8 @@ sub sprint_summary { $out .= " Failed-First $self->{fail1_cnt}" if $self->{fail1_cnt}; $out .= " Skipped $self->{skip_cnt}" if $self->{skip_cnt}; $out .= " Unsup $self->{unsup_cnt}"; - $out .= sprintf(" Eta %d:%02d", int($eta/60), $eta%60) if $self->{left_cnt} > 10 && $eta > 10; - $out .= sprintf(" Time %d:%02d", int($delta/60), $delta%60); + $out .= sprintf(" Eta %d:%02d", int($eta / 60), $eta % 60) if $self->{left_cnt} > 10 && $eta > 10; + $out .= sprintf(" Time %d:%02d", int($delta / 60), $delta % 60); return $out; } @@ -566,7 +567,7 @@ sub new { my $scen_dir = File::Spec->abs2rel("$self->{t_dir}/../obj_$self->{scenario}"); $scen_dir =~ s!^t/\.\./!!; # Simplify filenames on local runs mkdir $scen_dir; # Not a mkpath so find out if trying to build somewhere odd - $self->{obj_dir} ="$scen_dir/$self->{name}"; + $self->{obj_dir} = "$scen_dir/$self->{name}"; } my $define_opt = defineOpt($self->{xsim}); @@ -588,21 +589,21 @@ sub new { (-r 'input.vc' ? " -f input.vc " : "")) .($self->{t_dir} !~ m!/test_regress! # Don't include standard dir, only site's ? " +incdir+$self->{t_dir} -y $self->{t_dir}" : "") - . " ".$define_opt."TEST_OBJ_DIR=$self->{obj_dir}" - .($opt_verbose ? " ".$define_opt."TEST_VERBOSE=1":"") - .($opt_benchmark ? " ".$define_opt."TEST_BENCHMARK=$opt_benchmark":"") - .($opt_trace ? " ".$define_opt."WAVES=1":"") + . " " . $define_opt . "TEST_OBJ_DIR=$self->{obj_dir}" + .($opt_verbose ? " " . $define_opt . "TEST_VERBOSE=1":"") + .($opt_benchmark ? " " . $define_opt . "TEST_BENCHMARK=$opt_benchmark":"") + .($opt_trace ? " " . $define_opt . "WAVES=1":"") ))], v_flags2 => [], # Overridden in some sim files v_other_filenames => [], # After the filename so we can spec multiple files all_run_flags => [], pli_flags => ["-I$ENV{VERILATOR_ROOT}/include/vltstd -fPIC -shared" - .(($^O eq "darwin" ) - ? " -Wl,-undefined,dynamic_lookup" - : " -export-dynamic") - .($opt_verbose ? " -DTEST_VERBOSE=1":"") - .(cfg_with_m32() ? " -m32" : "") - ." -o $self->{obj_dir}/libvpi.so"], + . (($^O eq "darwin" ) + ? " -Wl,-undefined,dynamic_lookup" + : " -export-dynamic") + . ($opt_verbose ? " -DTEST_VERBOSE=1":"") + . (cfg_with_m32() ? " -m32" : "") + . " -o $self->{obj_dir}/libvpi.so"], tool_c_flags => [], # ATSIM atsim => 0, @@ -674,15 +675,15 @@ sub new { $self->{vlt_all} = $self->{vlt} || $self->{vltmt}; # Any Verilator scenario - $self->{VM_PREFIX} ||= "V".$self->{name}; - $self->{stats} ||= "$self->{obj_dir}/V".$self->{name}."__stats.txt"; - $self->{status_filename} ||= "$self->{obj_dir}/V".$self->{name}.".status"; + $self->{VM_PREFIX} ||= "V" . $self->{name}; + $self->{stats} ||= "$self->{obj_dir}/V" . $self->{name} . "__stats.txt"; + $self->{status_filename} ||= "$self->{obj_dir}/V" . $self->{name} . ".status"; $self->{run_log_filename} ||= "$self->{obj_dir}/vlt_sim.log"; $self->{coverage_filename} ||= "$self->{obj_dir}/coverage.dat"; $self->{main_filename} ||= "$self->{obj_dir}/$self->{VM_PREFIX}__main.cpp"; ($self->{top_filename} ||= $self->{pl_filename}) =~ s/\.pl$//; ($self->{golden_filename} ||= $self->{pl_filename}) =~ s/\.pl$/.out/; - if (-e ($self->{top_filename}.".vhd")) { # If VHDL file exists + if (-e ($self->{top_filename} . ".vhd")) { # If VHDL file exists $self->{vhdl} = 1; $self->{top_filename} .= ".vhd"; } else { @@ -693,13 +694,13 @@ sub new { } else { $self->{top_shell_filename} = "$self->{obj_dir}/$self->{VM_PREFIX}__top.v"; } - $self->{pli_filename} ||= $self->{name}.".cpp"; + $self->{pli_filename} ||= $self->{name} . ".cpp"; return $self; } sub benchmarksim_filename { my $self = (ref $_[0] ? shift : $Self); - return $self->{obj_dir}."/$self->{name}_benchmarksim.csv"; + return $self->{obj_dir} . "/$self->{name}_benchmarksim.csv"; } sub init_benchmarksim { @@ -707,16 +708,16 @@ sub init_benchmarksim { # Simulations with benchmarksim enabled append to the same file between runs. # Test files must ensure a clean benchmark data file before executing tests. my $filename = $self->benchmarksim_filename(); - my $fh = IO::File->new(">".$filename) or die "%Error: $! ".$filename; + my $fh = IO::File->new(">" . $filename) or die "%Error: $! " . $filename; print $fh "# Verilator simulation benchmark data\n"; - print $fh "# Test name: ".$self->{name}."\n"; - print $fh "# Top file: ".$self->{top_filename}."\n"; + print $fh "# Test name: " . $self->{name} . "\n"; + print $fh "# Top file: " . $self->{top_filename} . "\n"; print $fh "evals, time[s]\n"; } sub soprint { my $self = (ref $_[0] ? shift : $Self); - my $str = "$self->{scenario}/$self->{name}: ".join('',@_); + my $str = "$self->{scenario}/$self->{name}: " . join('', @_); $str =~ s/\n\n+$/\n/s; return $str; } @@ -728,35 +729,35 @@ sub oprint { sub error { my $self = (ref $_[0] ? shift : $Self); - my $msg = join('',@_); + my $msg = join('', @_); # Called from tests as: error("Reason message"[, ...]); - warn "%Warning: $self->{scenario}/$self->{name}: ".$msg."\n"; + warn "%Warning: $self->{scenario}/$self->{name}: " . $msg . "\n"; $self->{errors} ||= $msg; } sub error_keep_going { my $self = (ref $_[0] ? shift : $Self); - my $msg = join('',@_); + my $msg = join('', @_); # Called from tests as: error_keep_going("Reason message"[, ...]); - warn "%Warning: $self->{scenario}/$self->{name}: ".$msg."\n"; + warn "%Warning: $self->{scenario}/$self->{name}: " . $msg . "\n"; $self->{errors_keep_going} ||= $msg; } sub skip { my $self = (ref $_[0] ? shift : $Self); - my $msg = join('',@_); + my $msg = join('', @_); # Called from tests as: skip("Reason message"[, ...]); - warn "-Skip: $self->{scenario}/$self->{name}: ".$msg."\n"; - $self->{skips} ||= "Skip: ".$msg; + warn "-Skip: $self->{scenario}/$self->{name}: " . $msg . "\n"; + $self->{skips} ||= "Skip: " . $msg; } sub unsupported { my $self = (ref $_[0] ? shift : $Self); - my $msg = join('',@_); + my $msg = join('', @_); # Called from tests as: unsupported("Reason message"[, ...]); - warn "-Unsupported: $self->{scenario}/$self->{name}: ".$msg."\n"; + warn "-Unsupported: $self->{scenario}/$self->{name}: " . $msg . "\n"; if (!$::Opt_Unsupported) { - $self->{unsupporteds} ||= "Unsupported: ".$msg; + $self->{unsupporteds} ||= "Unsupported: " . $msg; } } @@ -879,7 +880,7 @@ sub clean_objs { } sub compile_vlt_cmd { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my %param = (%{$self}, @_); # Default arguments are from $self return 1 if $self->errors || $self->skips || $self->unsupporteds; @@ -888,17 +889,17 @@ sub compile_vlt_cmd { $self->compile_vlt_flags(%param), $param{top_filename}, @{$param{v_other_filenames}}, - $param{stdout_filename}?"> ".$param{stdout_filename}:"" + $param{stdout_filename} ? "> " . $param{stdout_filename} : "" ); return @vlt_cmd; } sub compile_vlt_flags { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my %param = (%{$self}, @_); # Default arguments are from $self return 1 if $self->errors || $self->skips || $self->unsupporteds; - my $checkflags = join(' ',@{$param{v_flags}}, + my $checkflags = join(' ', @{$param{v_flags}}, @{$param{v_flags2}}, @{$param{verilator_flags}}, @{$param{verilator_flags2}}, @@ -932,24 +933,24 @@ sub compile_vlt_flags { unshift @verilator_flags, "--make cmake" if $param{verilator_make_cmake}; unshift @verilator_flags, "--exe" if $param{make_main} && $param{verilator_make_gmake}; - unshift @verilator_flags, "../".$self->{main_filename} if + unshift @verilator_flags, "../" . $self->{main_filename} if $param{make_main} && $param{verilator_make_gmake}; if (defined $opt_optimize) { my $letters = ""; if ($opt_optimize =~ /[a-zA-Z]/) { $letters = $opt_optimize; } else { # Randomly turn on/off different optimizations - foreach my $l ('a'..'z') { + foreach my $l ('a' .. 'z') { $letters .= ((rand() > 0.5) ? $l : uc $l); } unshift @verilator_flags, "--trace" if rand() > 0.5; unshift @verilator_flags, "--coverage" if rand() > 0.5; } - unshift @verilator_flags, "--O".$letters; + unshift @verilator_flags, "--O" . $letters; } my @cmdargs = ( - "--prefix ".$param{VM_PREFIX}, + "--prefix " . $param{VM_PREFIX}, @verilator_flags, @{$param{verilator_flags2}}, @{$param{verilator_flags3}}, @@ -963,8 +964,8 @@ sub compile_vlt_flags { } sub driver_verilator_flags { - #my $self = (ref $_[0] ? shift : $Self); - return @Opt_Driver_Verilator_Flags + # my $self = (ref $_[0] ? shift : $Self); + return @Opt_Driver_Verilator_Flags; } sub lint { @@ -981,7 +982,7 @@ sub lint { } sub compile { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my %param = (tee => 1, %{$self}, @_); # Default arguments are from $self return 1 if $self->errors || $self->skips || $self->unsupporteds; @@ -994,7 +995,7 @@ sub compile { = $self->{top_shell_filename} = ""; } else { $param{top_shell_filename} - = $self->{top_shell_filename} = "$self->{obj_dir}/$self->{VM_PREFIX}__top.".$self->v_suffix; + = $self->{top_shell_filename} = "$self->{obj_dir}/$self->{VM_PREFIX}__top." . $self->v_suffix; } if ($param{atsim}) { @@ -1002,7 +1003,7 @@ sub compile { $self->_make_top() if $param{make_top_shell}; $self->_run(logfile=>"$self->{obj_dir}/atsim_compile.log", fails=>$param{fails}, - cmd=>[($ENV{VERILATOR_ATSIM}||"atsim"), + cmd=>[($ENV{VERILATOR_ATSIM} || "atsim"), @{$param{atsim_flags}}, @{$param{atsim_flags2}}, @{$param{v_flags}}, @@ -1018,9 +1019,9 @@ sub compile { $self->_make_top() if $param{make_top_shell}; $self->_run(logfile=>"$self->{obj_dir}/ghdl_compile.log", fails=>$param{fails}, - cmd=>[($ENV{VERILATOR_GHDL}||"ghdl"), + cmd=>[($ENV{VERILATOR_GHDL} || "ghdl"), # Add -c here, as having -c twice freaks it out - ((($ENV{VERILATOR_GHDL}||' ') =~ / -c\b/) ? "" : "-c"), + ((($ENV{VERILATOR_GHDL} || ' ') =~ / -c\b/) ? "" : "-c"), @{$param{ghdl_flags}}, @{$param{ghdl_flags2}}, #@{$param{v_flags}}, # Not supported @@ -1036,7 +1037,7 @@ sub compile { $self->_make_top() if $param{make_top_shell}; $self->_run(logfile=>"$self->{obj_dir}/vcs_compile.log", fails=>$param{fails}, - cmd=>[($ENV{VERILATOR_VCS}||"vcs"), + cmd=>[($ENV{VERILATOR_VCS} || "vcs"), @{$param{vcs_flags}}, @{$param{vcs_flags2}}, ($opt_verbose ? " -CFLAGS -DTEST_VERBOSE=1":""), @@ -1053,12 +1054,12 @@ sub compile { my @more_args; if ($self->vhdl) { ((my $ts = $param{top_shell_filename}) =~ s!\.v!!); - $ts =~ s!.*/!!;; + $ts =~ s!.*/!!; push @more_args, "-vhdltop", $ts; } $self->_run(logfile=>"$self->{obj_dir}/nc_compile.log", fails=>$param{fails}, - cmd=>[($ENV{VERILATOR_NCVERILOG}||"ncverilog"), + cmd=>[($ENV{VERILATOR_NCVERILOG} || "ncverilog"), @{$param{nc_flags}}, @{$param{nc_flags2}}, @{$param{v_flags}}, @@ -1075,7 +1076,7 @@ sub compile { $self->_run(logfile=>"$self->{obj_dir}/ms_compile.log", fails=>$param{fails}, cmd=>[("vlib $self->{obj_dir}/work && "), - ($ENV{VERILATOR_MODELSIM}||"vlog"), + ($ENV{VERILATOR_MODELSIM} || "vlog"), @{$param{ms_flags}}, @{$param{ms_flags2}}, @{$param{v_flags}}, @@ -1088,7 +1089,7 @@ sub compile { elsif ($param{iv}) { $param{tool_define} ||= $param{iv_define}; $self->_make_top() if $param{make_top_shell}; - my @cmd = (($ENV{VERILATOR_IVERILOG}||"iverilog"), + my @cmd = (($ENV{VERILATOR_IVERILOG} || "iverilog"), @{$param{iv_flags}}, @{$param{iv_flags2}}, @{$param{v_flags}}, @@ -1107,7 +1108,7 @@ sub compile { $self->_make_top() if $param{make_top_shell}; $self->_run(logfile=>"$self->{obj_dir}/xsim_compile.log", fails=>$param{fails}, - cmd=>[($ENV{VERILATOR_XVLOG}||"xvlog"), + cmd=>[($ENV{VERILATOR_XVLOG} || "xvlog"), @{$param{xsim_flags}}, @{$param{xsim_flags2}}, @{$param{v_flags}}, @@ -1165,16 +1166,16 @@ sub compile { expect => $param{expect}, expect_filename => $param{expect_filename}, verilator_run => 1, - cmd => ["cd \"".$self->{obj_dir}."\" && cmake", - "\"".$self->{t_dir}."/..\"", + cmd => ["cd \"" . $self->{obj_dir} . "\" && cmake", + "\"" . $self->{t_dir} . "/..\"", "-DTEST_VERILATOR_ROOT=$ENV{VERILATOR_ROOT}", "-DTEST_NAME=$self->{name}", "-DTEST_CSOURCES=\"@csources\"", "-DTEST_VERILATOR_ARGS=\"@vlt_args\"", "-DTEST_VERILATOR_SOURCES=\"$param{top_filename} @{$param{v_other_filenames}}\"", - "-DTEST_VERBOSE=\"".($self->{verbose} ? 1 : 0)."\"", - "-DTEST_SYSTEMC=\"" .($self->sc ? 1 : 0). "\"", - "-DCMAKE_PREFIX_PATH=\"".(($ENV{SYSTEMC_INCLUDE}||$ENV{SYSTEMC}||'')."/..\""), + "-DTEST_VERBOSE=\"" . ($self->{verbose} ? 1 : 0) . "\"", + "-DTEST_SYSTEMC=\"" . ($self->sc ? 1 : 0) . "\"", + "-DCMAKE_PREFIX_PATH=\"" . (($ENV{SYSTEMC_INCLUDE} || $ENV{SYSTEMC} || '') . "/..\""), "-DTEST_OPT_FAST=\"" . ($param{benchmark} ? "-Os" : "-O0") . "\"", "-DTEST_OPT_GLOBAL=\"" . ($param{benchmark} ? "-Os" : "-O0") . "\"", "-DTEST_VERILATION=\"" . $::Opt_Verilation . "\"", @@ -1187,17 +1188,17 @@ sub compile { $self->_run(logfile => "$self->{obj_dir}/vlt_gcc.log", entering => "$self->{obj_dir}", cmd => [$ENV{MAKE}, - "-C ".$self->{obj_dir}, - "-f ".$FindBin::RealBin."/Makefile_obj", + "-C " . $self->{obj_dir}, + "-f " . $FindBin::RealBin . "/Makefile_obj", ($self->{verbose} ? "" : "--no-print-directory"), "VM_PREFIX=$self->{VM_PREFIX}", "TEST_OBJ_DIR=$self->{obj_dir}", - "CPPFLAGS_DRIVER=-D".uc($self->{name}), + "CPPFLAGS_DRIVER=-D" . uc($self->{name}), ($self->{verbose} ? "CPPFLAGS_DRIVER2=-DTEST_VERBOSE=1":""), ($param{benchmark} ? "" : "OPT_FAST=-O0"), ($param{benchmark} ? "" : "OPT_GLOBAL=-O0"), "$self->{VM_PREFIX}", # bypass default rule, as we don't need archive - ($param{make_flags}||""), + ($param{make_flags} || ""), ]); } @@ -1217,8 +1218,8 @@ sub compile { if ($param{make_pli}) { $self->oprint("Compile vpi\n") if $self->{verbose}; my @cmd = ($ENV{CXX}, @{$param{pli_flags}}, - "-D".$param{tool_define}, - "-DIS_VPI", ($ENV{CFLAGS}||''), + "-D" . $param{tool_define}, + "-DIS_VPI", ($ENV{CFLAGS} || ''), "$self->{t_dir}/$self->{pli_filename}"); $self->_run(logfile=>"$self->{obj_dir}/pli_compile.log", @@ -1230,7 +1231,7 @@ sub compile { } sub execute { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); return 1 if $self->errors || $self->skips || $self->unsupporteds; my %param = (%{$self}, @_); # Default arguments are from $self # params may be expect or {tool}_expect @@ -1245,7 +1246,7 @@ sub execute { if ($param{atsim}) { $self->_run(logfile=>"$self->{obj_dir}/atsim_sim.log", fails=>$param{fails}, - cmd=>["echo q | ".$run_env."$self->{obj_dir}/athdl_sv", + cmd=>["echo q | " . $run_env . "$self->{obj_dir}/athdl_sv", @{$param{atsim_run_flags}}, @{$param{all_run_flags}}, ], @@ -1257,7 +1258,7 @@ sub execute { elsif ($param{ghdl}) { $self->_run(logfile=>"$self->{obj_dir}/ghdl_sim.log", fails=>$param{fails}, - cmd=>[$run_env."$self->{obj_dir}/simghdl", + cmd=>[$run_env . "$self->{obj_dir}/simghdl", @{$param{ghdl_run_flags}}, @{$param{all_run_flags}}, ], @@ -1267,7 +1268,7 @@ sub execute { ); } elsif ($param{iv}) { - my @cmd = ($run_env."$self->{obj_dir}/simiv", + my @cmd = ($run_env . "$self->{obj_dir}/simiv", @{$param{iv_run_flags}}, @{$param{all_run_flags}}, ); @@ -1284,13 +1285,13 @@ sub execute { ); } elsif ($param{ms}) { - my @pli_opt=(); + my @pli_opt = (); if ($param{use_libvpi}) { unshift @pli_opt, "-pli $self->{obj_dir}/libvpi.so"; } $self->_run(logfile=>"$self->{obj_dir}/ms_sim.log", fails=>$param{fails}, - cmd=>["echo q | ".$run_env.($ENV{VERILATOR_MODELSIM}||"vsim"), + cmd=>["echo q | " . $run_env . ($ENV{VERILATOR_MODELSIM} || "vsim"), @{$param{ms_run_flags}}, @{$param{all_run_flags}}, @{pli_opt}, @@ -1304,7 +1305,7 @@ sub execute { elsif ($param{nc}) { $self->_run(logfile=>"$self->{obj_dir}/nc_sim.log", fails=>$param{fails}, - cmd=>["echo q | ".$run_env.($ENV{VERILATOR_NCVERILOG}||"ncverilog"), + cmd=>["echo q | " . $run_env . ($ENV{VERILATOR_NCVERILOG} || "ncverilog"), @{$param{nc_run_flags}}, @{$param{all_run_flags}}, ], @@ -1317,7 +1318,7 @@ sub execute { #my $fh = IO::File->new(">simv.key") or die "%Error: $! simv.key,"; #$fh->print("quit\n"); $fh->close; $self->_run(logfile=>"$self->{obj_dir}/vcs_sim.log", - cmd=>["echo q | ".$run_env."./simv", + cmd=>["echo q | " . $run_env . "./simv", @{$param{vcs_run_flags}}, @{$param{all_run_flags}}, ], @@ -1329,7 +1330,7 @@ sub execute { elsif ($param{xsim}) { $self->_run(logfile=>"$self->{obj_dir}/xsim_sim.log", fails=>$param{fails}, - cmd=>[$run_env.($ENV{VERILATOR_XELAB}||"xelab"), + cmd=>[$run_env.($ENV{VERILATOR_XELAB} || "xelab"), @{$param{xsim_run_flags}}, @{$param{xsim_run_flags2}}, @{$param{all_run_flags}}, @@ -1346,7 +1347,7 @@ sub execute { $param{executable} ||= "$self->{obj_dir}/$param{VM_PREFIX}"; my $debugger = ""; if ($opt_gdbsim) { - $debugger = ($ENV{VERILATOR_GDB}||"gdb")." "; + $debugger = ($ENV{VERILATOR_GDB} || "gdb") . " "; } elsif ($opt_rrsim) { $debugger = "rr record "; } @@ -1370,7 +1371,7 @@ sub execute { } sub setenv { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $var = shift; my $val = shift; print "\texport $var='$val'\n"; @@ -1378,7 +1379,7 @@ sub setenv { } sub inline_checks { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); return 1 if $self->errors || $self->skips || $self->unsupporteds; return 1 if !$self->{vlt_all}; @@ -1392,21 +1393,21 @@ sub inline_checks { while (defined(my $line = $fh->getline)) { if ($line =~ /CHECK/) { if ($line =~ /CHECK_COVER *\( *([---0-9]+) *, *"([^"]+)" *, *("([^"]+)" *,|) *(\d+) *\)/) { - my $lineno = ($. + $1); my $hier=$2; my $comment=$4; my $count=$5; - my $regexp = "\001l\002".$lineno; - $regexp .= ".*\001o\002".quotemeta($comment) if $comment; - $regexp .= ".*\001h\002".quotemeta($hier) if $hier; - $regexp .= ".*' ".$count; + my $lineno = ($. + $1); my $hier = $2; my $comment = $4; my $count = $5; + my $regexp = "\001l\002" . $lineno; + $regexp .= ".*\001o\002" . quotemeta($comment) if $comment; + $regexp .= ".*\001h\002" . quotemeta($hier) if $hier; + $regexp .= ".*' " . $count; if ($contents !~ /$regexp/) { - $self->error("CHECK_COVER: $covfn: Regexp not found: $regexp\n". + $self->error("CHECK_COVER: $covfn: Regexp not found: $regexp\n" . "From $self->{top_filename}:$.: $line"); } } elsif ($line =~ /CHECK_COVER_MISSING *\( *([---0-9]+) *\)/) { my $lineno = ($. + $1); - my $regexp = "\001l\002".$lineno; + my $regexp = "\001l\002" . $lineno; if ($contents =~ /$regexp/) { - $self->error("CHECK_COVER_MISSING: $covfn: Regexp found: $regexp\n". + $self->error("CHECK_COVER_MISSING: $covfn: Regexp found: $regexp\n" . "From $self->{top_filename}:$.: $line"); } } @@ -1422,51 +1423,51 @@ sub inline_checks { # Accessors sub ok { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); $self->{ok} = $_[0] if defined $_[0]; $self->{ok} = 0 if $self->{errors} || $self->{errors_keep_going} || $self->{skips} || $self->unsupporteds; return $self->{ok}; } sub continuing { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); return !($self->errors || $self->skips || $self->unsupporteds); } sub errors { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); return $self->{errors}; } sub golden_filename { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); $self->{golden_filename} = shift if defined $_[0]; return $self->{golden_filename}; } sub scenario_off { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); return $self->{scenario_off}; } sub skips { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); return $self->{skips}; } sub unsupporteds { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); return $self->{unsupporteds}; } sub top_filename { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); $self->{top_filename} = shift if defined $_[0]; return $self->{top_filename}; } sub vhdl { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); $self->{vhdl} = shift if defined $_[0]; if ($self->{vhdl}) { $self->{top_filename} =~ s/\.v$/\.vhdl/; @@ -1475,18 +1476,18 @@ sub vhdl { } sub v_suffix { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); # Suffix for file type, e.g. .vhdl or .v return $self->{vhdl} ? "vhdl" : "v"; } sub sc { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); return $self->{sc}; } sub have_sc { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); return 1 if (defined $ENV{SYSTEMC} || defined $ENV{SYSTEMC_INCLUDE} || $ENV{CFG_HAVE_SYSTEMC}); return 1 if $self->verilator_version =~ /systemc found *= *1/i; return 0; @@ -1534,7 +1535,7 @@ sub get_default_vltmt_threads { } sub pli_filename { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); $self->{pli_filename} = shift if defined $_[0]; return $self->{pli_filename}; } @@ -1545,7 +1546,7 @@ sub too_few_cores { } sub skip_if_too_few_cores { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); if (too_few_cores()) { $self->skip("Skipping due to too few cores\n"); } @@ -1560,7 +1561,7 @@ sub wno_unopthreads_for_few_cores { } sub VM_PREFIX { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); $self->{VM_PREFIX} = shift if defined $_[0]; return $self->{VM_PREFIX}; } @@ -1568,17 +1569,17 @@ sub VM_PREFIX { #---------------------------------------------------------------------- sub run { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); $self->_run(@_); } sub _run { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my %param = (tee => 1, #entering => # Print entering directory information #verilator_run => # Move gcov data to parallel area @_); - my $command = join(' ',@{$param{cmd}}); + my $command = join(' ', @{$param{cmd}}); $command = "time $command" if $opt_benchmark && $command !~ /^cd /; if ($param{verilator_run}) { @@ -1610,15 +1611,15 @@ sub _run { if ($param{logfile}) { $logfh = IO::File->new(">$param{logfile}") or die "%Error: Can't open $param{logfile}"; } - my $pid=fork(); + my $pid = fork(); if ($pid) { # Parent close CHILDWR; print "driver: Entering directory '", File::Spec->rel2abs($param{entering}), "'\n" if $param{entering}; while (1) { my $buf = ''; - my $got = sysread PARENTRD,$buf,10000; - last if defined $got && $got==0; + my $got = sysread PARENTRD, $buf, 10000; + last if defined $got && $got == 0; print $buf if $param{tee}; print $logfh $buf if $logfh; } @@ -1647,7 +1648,7 @@ sub _run { } exit($? ? 10 : 0); # $?>>8 misses coredumps } - waitpid($pid,0); + waitpid($pid, 0); $status = $? || 0; } flush STDOUT; @@ -1702,7 +1703,7 @@ sub _run { #print "**BAD $self->{name} $param{logfile} MT $moretry $try\n"; next if $moretry; $self->error("Miscompares in output from $param{cmd}[0]\n"); - $self->error("Might be error in regexp format\n") if $ok<1; + $self->error("Might be error in regexp format\n") if $ok < 1; print "GOT:\n"; print $wholefile; print "ENDGOT\n"; @@ -1753,7 +1754,7 @@ sub _make_main { my $fh = IO::File->new(">$filename") or die "%Error: $! $filename,"; print $fh "// Test defines\n"; - print $fh "#define MAIN_TIME_MULTIPLIER ".($self->{main_time_multiplier} || 1)."\n"; + print $fh "#define MAIN_TIME_MULTIPLIER " . ($self->{main_time_multiplier} || 1) . "\n"; print $fh "#include \n"; print $fh "#include \n" if $self->{benchmarksim}; @@ -1812,9 +1813,10 @@ sub _make_main { print $fh " const std::unique_ptr contextp{new VerilatedContext};\n"; print $fh " contextp->commandArgs(argc, argv);\n"; - print $fh " contextp->debug(".($self->{verilated_debug}?1:0).");\n"; + print $fh " contextp->debug(" . ($self->{verilated_debug} ? 1 : 0) . ");\n"; print $fh " srand48(5);\n"; # Ensure determinism - print $fh " contextp->randReset(".$self->{verilated_randReset}.");\n" if defined $self->{verilated_randReset}; + print $fh " contextp->randReset(" . $self->{verilated_randReset} . ");\n" + if defined $self->{verilated_randReset}; print $fh " topp.reset(new $VM_PREFIX(\"top\"));\n"; print $fh " contextp->internalsDump()\n;" if $self->{verilated_debug}; @@ -1843,7 +1845,7 @@ sub _make_main { $fh->print(" std::unique_ptr tfp{new VerilatedVcdC};\n") if $self->{trace_format} eq 'vcd-c'; $fh->print(" std::unique_ptr tfp{new VerilatedVcdSc};\n") if $self->{trace_format} eq 'vcd-sc'; $fh->print(" topp->trace(tfp.get(), 99);\n"); - $fh->print(" tfp->open(\"".$self->trace_filename."\");\n"); + $fh->print(" tfp->open(\"" . $self->trace_filename . "\");\n"); if ($self->{trace} && !$self->sc) { $fh->print(" if (tfp) tfp->dump(contextp->time());\n"); } @@ -1874,13 +1876,13 @@ sub _make_main { print $fh " while ((${time} < sim_time * MAIN_TIME_MULTIPLIER)\n"; print $fh " && !contextp->gotFinish()) {\n"; - for (my $i=0; $i<5; $i++) { + for (my $i = 0; $i < 5; $i++) { my $action = 0; if ($self->{inputs}{fastclk}) { print $fh " ${set}fastclk = !${set}fastclk;\n"; $action = 1; } - if ($i==0 && $self->{inputs}{clk}) { + if ($i == 0 && $self->{inputs}{clk}) { print $fh " ${set}clk = !${set}clk;\n"; $action = 1; } @@ -1906,20 +1908,20 @@ sub _make_main { if ($self->{benchmarksim}) { $fh->print(" {\n"); $fh->print(" const std::chrono::duration exec_s = std::chrono::steady_clock::now() - starttime;\n"); - $fh->print(" std::ofstream benchfile(\"".$self->benchmarksim_filename()."\", std::ofstream::out | std::ofstream::app);\n"); + $fh->print(" std::ofstream benchfile(\"" . $self->benchmarksim_filename() . "\", std::ofstream::out | std::ofstream::app);\n"); $fh->print(" benchfile << std::fixed << std::setprecision(9) << n_evals << \",\" << exec_s.count() << std::endl;\n"); $fh->print(" benchfile.close();\n"); $fh->print(" }\n"); } print $fh " if (!contextp->gotFinish()) {\n"; - print $fh ' vl_fatal(__FILE__, __LINE__, "main", "%Error: Timeout; never got a $finish");',"\n"; + print $fh ' vl_fatal(__FILE__, __LINE__, "main", "%Error: Timeout; never got a $finish");', "\n"; print $fh " }\n"; print $fh " topp->final();\n"; if ($self->{coverage}) { $fh->print("#if VM_COVERAGE\n"); - $fh->print(" VerilatedCov::write(\"",$self->{coverage_filename},"\");\n"); + $fh->print(" VerilatedCov::write(\"", $self->{coverage_filename}, "\");\n"); $fh->print("#endif // VM_COVERAGE\n"); } if ($self->{trace}) { @@ -1985,10 +1987,10 @@ sub _make_top_v { } # Inst print $fh " t t (\n"; - my $comma=""; + my $comma = ""; foreach my $inp (sort (keys %{$self->{inputs}})) { print $fh " ${comma}.${inp} (${inp})\n"; - $comma=","; + $comma = ","; } print $fh " );\n"; @@ -1996,8 +1998,8 @@ sub _make_top_v { print $fh "\n"; print $fh "`ifdef WAVES\n"; print $fh " initial begin\n"; - print $fh " \$display(\"-Tracing Waves to Dumpfile: ".$self->trace_filename."\");\n"; - print $fh " \$dumpfile(\"".$self->trace_filename."\");\n"; + print $fh " \$display(\"-Tracing Waves to Dumpfile: " . $self->trace_filename . "\");\n"; + print $fh " \$dumpfile(\"" . $self->trace_filename . "\");\n"; print $fh " \$dumpvars(0, top);\n"; print $fh " end\n"; print $fh "`endif\n"; @@ -2011,10 +2013,10 @@ sub _make_top_v { print $fh " fastclk = 1;\n" if $self->{inputs}{fastclk}; print $fh " clk = 1;\n" if $self->{inputs}{clk}; print $fh " while (\$time < $self->{sim_time}) begin\n"; - for (my $i=0; $i<5; $i++) { + for (my $i = 0; $i < 5; $i++) { print $fh " #1;\n"; print $fh " fastclk = !fastclk;\n" if $self->{inputs}{fastclk}; - print $fh " clk = !clk;\n" if $i==4 && $self->{inputs}{clk}; + print $fh " clk = !clk;\n" if $i == 4 && $self->{inputs}{clk}; } print $fh " end\n"; print $fh " end\n"; @@ -2039,7 +2041,7 @@ sub _make_top_vhdl { my $semi = ""; foreach my $inp (@ports) { print $fh " ${semi}${inp} : in std_logic\n"; - $semi=";"; + $semi = ";"; } print $fh " );\n"; } @@ -2060,10 +2062,10 @@ sub _make_top_vhdl { print $fh " t : t_ent\n"; if ($#ports >= 0) { print $fh " port map(\n"; - my $comma=""; + my $comma = ""; foreach my $inp (@ports) { print $fh "\t${comma}${inp} => ${inp}\n"; - $comma=","; + $comma = ","; } print $fh " )\n"; } @@ -2085,7 +2087,7 @@ sub _read_inputs_v { my $filename = $self->top_filename; $filename = "$self->{t_dir}/$filename" if !-r $filename; my $fh = IO::File->new("<$filename") or die "%Error: $! $filename,"; - my $get_sigs=1; + my $get_sigs = 1; my %inputs; while (defined(my $line = $fh->getline)) { if ($get_sigs) { @@ -2134,9 +2136,9 @@ sub verilator_version { # Returns verbose version, line 1 contains actual version if (!defined $_Verilator_Version) { my @args = ("perl", "$ENV{VERILATOR_ROOT}/bin/verilator", "-V"); - my $args = join(' ',@args); + my $args = join(' ', @args); $_Verilator_Version = `$args`; - $_Verilator_Version or die "can't fork: $! ".join(' ',@args); + $_Verilator_Version or die "can't fork: $! " . join(' ', @args); chomp $_Verilator_Version; } return $_Verilator_Version if defined $_Verilator_Version; @@ -2146,7 +2148,7 @@ sub verilator_version { # File utilities sub files_identical { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $fn1 = shift; my $fn2 = shift; my $fn1_is_logfile = shift; @@ -2201,17 +2203,17 @@ sub files_identical { } } } - my $nl = $#l1; $nl = $#l2 if ($#l2 > $nl); + my $nl = $#l1; $nl = $#l2 if ($#l2 > $nl); for (my $l=0; $l<=$nl; ++$l) { - if (($l1[$l]||"") ne ($l2[$l]||"")) { + if (($l1[$l] || "") ne ($l2[$l] || "")) { next try if $moretry; - $self->error_keep_going("Line ".($l+1)." miscompares; $fn1 != $fn2"); - warn("F1: ".($l1[$l]||"*EOF*\n") - ."F2: ".($l2[$l]||"*EOF*\n")); + $self->error_keep_going("Line " . ($l+1) . " miscompares; $fn1 != $fn2"); + warn("F1: " . ($l1[$l] || "*EOF*\n") + . "F2: " . ($l2[$l] || "*EOF*\n")); if ($ENV{HARNESS_UPDATE_GOLDEN}) { # Update golden files with current warn "%Warning: HARNESS_UPDATE_GOLDEN set: cp $fn1 $fn2\n"; my $fhw = IO::File->new(">$fn2") or $self->error("Files_identical $! $fn2\n"); - $fhw->print(join('',@l1)); + $fhw->print(join('', @l1)); } else { warn "To update reference: HARNESS_UPDATE_GOLDEN=1 {command} or --golden\n"; } @@ -2223,7 +2225,7 @@ sub files_identical { } sub files_identical_sorted { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $fn1 = shift; my $fn2 = shift; my $fn1_is_logfile = shift; @@ -2237,7 +2239,7 @@ sub files_identical_sorted { } sub copy_if_golden { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $fn1 = shift; my $fn2 = shift; if ($ENV{HARNESS_UPDATE_GOLDEN}) { # Update golden files with current @@ -2248,7 +2250,7 @@ sub copy_if_golden { } sub vcd_identical { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $fn1 = shift; my $fn2 = shift; return 0 if $self->errors || $self->skips || $self->unsupporteds; @@ -2290,7 +2292,7 @@ sub vcd_identical { } sub fst2vcd { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $fn1 = shift; my $fn2 = shift; if (!-r $fn1) { $self->error("File does not exist $fn1\n"); return 0; } @@ -2306,17 +2308,17 @@ sub fst2vcd { } sub fst_identical { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $fn1 = shift; my $fn2 = shift; return 0 if $self->errors || $self->skips || $self->unsupporteds; - my $tmp = $fn1.".vcd"; + my $tmp = $fn1 . ".vcd"; fst2vcd($fn1, $tmp); return vcd_identical($tmp, $fn2); } sub _vcd_read { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $filename = shift; my $data = {}; my $fh = IO::File->new("<$filename"); @@ -2375,34 +2377,34 @@ sub tries { } sub glob_all { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $pattern = shift; return glob($pattern); } sub glob_one { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $pattern = shift; return if $self->errors || $self->skips || $self->unsupporteds; my @files = glob($pattern); my $n = scalar @files; if ($n == 0) { - $self->error("glob_one: pattern '$pattern' does not match any files\n"); + $self->error("glob_one: pattern '$pattern' does not match any files\n"); } elsif ($n != 1) { - my $msg = "glob_one: pattern '$pattern' matches multiple files:\n"; - foreach my $file (@files) { - $msg .= $file."\n"; - } - $self->error($msg); + my $msg = "glob_one: pattern '$pattern' matches multiple files:\n"; + foreach my $file (@files) { + $msg .= $file . "\n"; + } + $self->error($msg); } else { - return $files[0]; + return $files[0]; } } sub file_grep_not { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $filename = shift; my $regexp = shift; my $expvalue = shift; @@ -2417,7 +2419,7 @@ sub file_grep_not { } sub file_grep { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $filename = shift; my $regexp = shift; my $expvalue = shift; @@ -2440,18 +2442,18 @@ sub file_grep_any { return if $self->errors || $self->skips || $self->unsupporteds; foreach my $filename (@filenames) { - my $contents = $self->file_contents($filename); - return if ($contents eq "_Already_Errored_"); - if ($contents =~ /$regexp/) { - if ($expvalue && $expvalue ne $1) { - $self->error("file_grep: $filename: Got='$1' Expected='$expvalue' in regexp: $regexp\n"); + my $contents = $self->file_contents($filename); + return if ($contents eq "_Already_Errored_"); + if ($contents =~ /$regexp/) { + if ($expvalue && $expvalue ne $1) { + $self->error("file_grep: $filename: Got='$1' Expected='$expvalue' in regexp: $regexp\n"); + } + return; } - return; - } } my $msg = "file_grep_any: Regexp '$regexp' not found in any of the following files:\n"; foreach my $filename (@filenames) { - $msg .= $filename."\n"; + $msg .= $filename . "\n"; } $self->error($msg); } @@ -2459,14 +2461,14 @@ sub file_grep_any { my %_File_Contents_Cache; sub file_contents { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $filename = shift; if (!$_File_Contents_Cache{$filename}) { my $fh = IO::File->new("<$filename"); if (!$fh) { $_File_Contents_Cache{$filename} = "_Already_Errored_"; - $self->error("File_grep file not found: ".$filename."\n"); + $self->error("File_grep file not found: " . $filename . "\n"); return $_File_Contents_Cache{$filename}; } local $/; undef $/; @@ -2479,7 +2481,7 @@ sub file_contents { } sub write_wholefile { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $filename = shift; my $contents = shift; my $fh = IO::File->new(">$filename") or die "%Error: $! writing $filename,"; @@ -2489,7 +2491,7 @@ sub write_wholefile { } sub file_sed { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my $infilename = shift; my $outfilename = shift; my $editcb = shift; @@ -2503,7 +2505,7 @@ sub file_sed { } sub extract { - my $self = (ref $_[0]? shift : $Self); + my $self = (ref $_[0] ? shift : $Self); my %param = (#in =>, #out => regexp => qr/.*/, @@ -2614,6 +2616,7 @@ sub is_any_left { return 0; } ####################################################################### 1; + package main; __END__ diff --git a/test_regress/t/t_alw_noreorder.pl b/test_regress/t/t_alw_noreorder.pl index 7d6eceb88..46d021e6b 100755 --- a/test_regress/t/t_alw_noreorder.pl +++ b/test_regress/t/t_alw_noreorder.pl @@ -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); diff --git a/test_regress/t/t_alw_nosplit.pl b/test_regress/t/t_alw_nosplit.pl index ae8fcb03f..a1d66aaad 100755 --- a/test_regress/t/t_alw_nosplit.pl +++ b/test_regress/t/t_alw_nosplit.pl @@ -19,7 +19,7 @@ if ($Self->{vlt_all}) { } execute( - check_finished=>1, + check_finished => 1, ); ok(1); diff --git a/test_regress/t/t_alw_reorder.pl b/test_regress/t/t_alw_reorder.pl index dce2f101f..90a7126da 100755 --- a/test_regress/t/t_alw_reorder.pl +++ b/test_regress/t/t_alw_reorder.pl @@ -28,7 +28,7 @@ foreach my $file ( } execute( - check_finished=>1, + check_finished => 1, ); ok(1); diff --git a/test_regress/t/t_clk_condflop_nord.pl b/test_regress/t/t_clk_condflop_nord.pl index 57e493fa0..0c03448c5 100755 --- a/test_regress/t/t_clk_condflop_nord.pl +++ b/test_regress/t/t_clk_condflop_nord.pl @@ -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( diff --git a/test_regress/t/t_const_opt.pl b/test_regress/t/t_const_opt.pl index 5dbe1ff36..ee51e8030 100755 --- a/test_regress/t/t_const_opt.pl +++ b/test_regress/t/t_const_opt.pl @@ -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( diff --git a/test_regress/t/t_const_opt_cov.pl b/test_regress/t/t_const_opt_cov.pl index a052e9321..211e1d79a 100755 --- a/test_regress/t/t_const_opt_cov.pl +++ b/test_regress/t/t_const_opt_cov.pl @@ -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( diff --git a/test_regress/t/t_const_opt_red.pl b/test_regress/t/t_const_opt_red.pl index 666e5d478..a9e16fbf5 100755 --- a/test_regress/t/t_const_opt_red.pl +++ b/test_regress/t/t_const_opt_red.pl @@ -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( diff --git a/test_regress/t/t_const_opt_shortcut.pl b/test_regress/t/t_const_opt_shortcut.pl index 89c1226dd..8955f94f0 100755 --- a/test_regress/t/t_const_opt_shortcut.pl +++ b/test_regress/t/t_const_opt_shortcut.pl @@ -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( diff --git a/test_regress/t/t_display_merge.pl b/test_regress/t/t_display_merge.pl index 66642748d..75570aba2 100755 --- a/test_regress/t/t_display_merge.pl +++ b/test_regress/t/t_display_merge.pl @@ -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( diff --git a/test_regress/t/t_dist_cinclude.pl b/test_regress/t/t_dist_cinclude.pl index 873380dce..90b0723b7 100755 --- a/test_regress/t/t_dist_cinclude.pl +++ b/test_regress/t/t_dist_cinclude.pl @@ -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)); } } diff --git a/test_regress/t/t_dist_error_format.pl b/test_regress/t/t_dist_error_format.pl index 654a7c70f..bdacfb6ac 100755 --- a/test_regress/t/t_dist_error_format.pl +++ b/test_regress/t/t_dist_error_format.pl @@ -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}); } diff --git a/test_regress/t/t_dist_fixme.pl b/test_regress/t/t_dist_fixme.pl index 3fd51c460..f722de3fe 100755 --- a/test_regress/t/t_dist_fixme.pl +++ b/test_regress/t/t_dist_fixme.pl @@ -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)); } } diff --git a/test_regress/t/t_dist_inctree.pl b/test_regress/t/t_dist_inctree.pl index 8b579db84..acbbaa079 100755 --- a/test_regress/t/t_dist_inctree.pl +++ b/test_regress/t/t_dist_inctree.pl @@ -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; diff --git a/test_regress/t/t_dist_install.pl b/test_regress/t/t_dist_install.pl index 67c6d5b2a..abf277032 100755 --- a/test_regress/t/t_dist_install.pl +++ b/test_regress/t/t_dist_install.pl @@ -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)); } } diff --git a/test_regress/t/t_dist_portability.pl b/test_regress/t/t_dist_portability.pl index 99fa2f164..b436e5cb5 100755 --- a/test_regress/t/t_dist_portability.pl +++ b/test_regress/t/t_dist_portability.pl @@ -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)); } } diff --git a/test_regress/t/t_dist_tabs.pl b/test_regress/t/t_dist_tabs.pl index cd830d4fc..f1bb39258 100755 --- a/test_regress/t/t_dist_tabs.pl +++ b/test_regress/t/t_dist_tabs.pl @@ -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}); } diff --git a/test_regress/t/t_dist_untracked.pl b/test_regress/t/t_dist_untracked.pl index 9f25d1622..254e6aa3d 100755 --- a/test_regress/t/t_dist_untracked.pl +++ b/test_regress/t/t_dist_untracked.pl @@ -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}); } diff --git a/test_regress/t/t_dist_whitespace.pl b/test_regress/t/t_dist_whitespace.pl index bf7f6ca36..451d46e98 100755 --- a/test_regress/t/t_dist_whitespace.pl +++ b/test_regress/t/t_dist_whitespace.pl @@ -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) { diff --git a/test_regress/t/t_dpi_import_hdr_only.pl b/test_regress/t/t_dpi_import_hdr_only.pl index 92c6227ed..b497878f2 100755 --- a/test_regress/t/t_dpi_import_hdr_only.pl +++ b/test_regress/t/t_dpi_import_hdr_only.pl @@ -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( diff --git a/test_regress/t/t_gate_chained.pl b/test_regress/t/t_gate_chained.pl index 3b151b61f..ac9dd39d1 100755 --- a/test_regress/t/t_gate_chained.pl +++ b/test_regress/t/t_gate_chained.pl @@ -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( diff --git a/test_regress/t/t_gate_ormux.pl b/test_regress/t/t_gate_ormux.pl index e0cf23b95..02476bffd 100755 --- a/test_regress/t/t_gate_ormux.pl +++ b/test_regress/t/t_gate_ormux.pl @@ -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}) { diff --git a/test_regress/t/t_preproc.pl b/test_regress/t/t_preproc.pl index 930deb5d7..1a9daee70 100755 --- a/test_regress/t/t_preproc.pl +++ b/test_regress/t/t_preproc.pl @@ -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; diff --git a/test_regress/t/t_timing_long.pl b/test_regress/t/t_timing_long.pl index 031575331..5f0b728d3 100755 --- a/test_regress/t/t_timing_long.pl +++ b/test_regress/t/t_timing_long.pl @@ -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, diff --git a/test_regress/t/t_trace_complex_params.pl b/test_regress/t/t_trace_complex_params.pl index 04c792441..8f72740a0 100755 --- a/test_regress/t/t_trace_complex_params.pl +++ b/test_regress/t/t_trace_complex_params.pl @@ -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}); diff --git a/test_regress/t/t_unopt_array.pl b/test_regress/t/t_unopt_array.pl index 6361d5df0..6bef1be6c 100755 --- a/test_regress/t/t_unopt_array.pl +++ b/test_regress/t/t_unopt_array.pl @@ -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( diff --git a/test_regress/t/t_var_rsvd_port.pl b/test_regress/t/t_var_rsvd_port.pl index de2083cc5..76a08e9aa 100755 --- a/test_regress/t/t_var_rsvd_port.pl +++ b/test_regress/t/t_var_rsvd_port.pl @@ -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();