forked from github/verilator
Add XSim support to driver.pl, bug1493.
This commit is contained in:
parent
ec620387af
commit
70cf2582d6
2
Changes
2
Changes
@ -12,6 +12,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
|
|||||||
|
|
||||||
*** Change MULTITOP to warning to help linting, see manual.
|
*** Change MULTITOP to warning to help linting, see manual.
|
||||||
|
|
||||||
|
*** Add XSim support to driver.pl, bug1493. [Todd Strader]
|
||||||
|
|
||||||
**** Show included-from filenames in warnings, bug1439. [Todd Strader]
|
**** Show included-from filenames in warnings, bug1439. [Todd Strader]
|
||||||
|
|
||||||
**** Fix elaboration time errors, bug1429. [Udi Finkelstein]
|
**** Fix elaboration time errors, bug1429. [Udi Finkelstein]
|
||||||
|
3
test_regress/.gitignore
vendored
3
test_regress/.gitignore
vendored
@ -13,3 +13,6 @@ INCA_libs
|
|||||||
logs
|
logs
|
||||||
.vcsmx_rebuild
|
.vcsmx_rebuild
|
||||||
vc_hdrs.h
|
vc_hdrs.h
|
||||||
|
xsim.*/
|
||||||
|
*.jou
|
||||||
|
*.pb
|
||||||
|
@ -35,6 +35,7 @@ our %All_Scenarios
|
|||||||
ms => ["linter", "simulator", "ms"],
|
ms => ["linter", "simulator", "ms"],
|
||||||
nc => ["linter", "simulator", "nc"],
|
nc => ["linter", "simulator", "nc"],
|
||||||
vcs => ["linter", "simulator", "vcs"],
|
vcs => ["linter", "simulator", "vcs"],
|
||||||
|
xsim => ["linter", "simulator", "xsim"],
|
||||||
vlt => ["linter", "simulator", "vlt_all", "vlt"],
|
vlt => ["linter", "simulator", "vlt_all", "vlt"],
|
||||||
vltmt => [ "simulator", "vlt_all", "vltmt"],
|
vltmt => [ "simulator", "vlt_all", "vltmt"],
|
||||||
);
|
);
|
||||||
@ -107,6 +108,7 @@ if (! GetOptions(
|
|||||||
"vlt!" => sub { $opt_scenarios{vlt} = $_[1]; },
|
"vlt!" => sub { $opt_scenarios{vlt} = $_[1]; },
|
||||||
"vltmt!" => sub { $opt_scenarios{vltmt} = $_[1]; },
|
"vltmt!" => sub { $opt_scenarios{vltmt} = $_[1]; },
|
||||||
"vcs!" => sub { $opt_scenarios{vcs} = $_[1]; },
|
"vcs!" => sub { $opt_scenarios{vcs} = $_[1]; },
|
||||||
|
"xsim!" => sub { $opt_scenarios{xsim} = $_[1]; },
|
||||||
"<>" => \¶meter,
|
"<>" => \¶meter,
|
||||||
)) {
|
)) {
|
||||||
die "%Error: Bad usage, try '$0 --help'\n";
|
die "%Error: Bad usage, try '$0 --help'\n";
|
||||||
@ -442,6 +444,11 @@ use File::Path qw(mkpath);
|
|||||||
use vars qw($Self $Self);
|
use vars qw($Self $Self);
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
sub defineOpt {
|
||||||
|
my $xsim = shift;
|
||||||
|
return $xsim ? "--define " : "+define+";
|
||||||
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $self = {@_};
|
my $self = {@_};
|
||||||
@ -458,6 +465,7 @@ sub new {
|
|||||||
$self->{scenario} ||= "nc" if $self->{nc};
|
$self->{scenario} ||= "nc" if $self->{nc};
|
||||||
$self->{scenario} ||= "ms" if $self->{ms};
|
$self->{scenario} ||= "ms" if $self->{ms};
|
||||||
$self->{scenario} ||= "iv" if $self->{iv};
|
$self->{scenario} ||= "iv" if $self->{iv};
|
||||||
|
$self->{scenario} ||= "xsim" if $self->{xsim};
|
||||||
|
|
||||||
foreach my $dir (@::Test_Dirs) {
|
foreach my $dir (@::Test_Dirs) {
|
||||||
# t_dir used both absolutely and under obj_dir
|
# t_dir used both absolutely and under obj_dir
|
||||||
@ -479,6 +487,8 @@ sub new {
|
|||||||
$self->{obj_dir} ="$scen_dir/$self->{name}";
|
$self->{obj_dir} ="$scen_dir/$self->{name}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $define_opt = defineOpt($self->{xsim});
|
||||||
|
|
||||||
$self = {
|
$self = {
|
||||||
name => undef, # Set below, name of this test
|
name => undef, # Set below, name of this test
|
||||||
pl_filename => undef, # Name of .pl file to get setup from
|
pl_filename => undef, # Name of .pl file to get setup from
|
||||||
@ -491,13 +501,14 @@ sub new {
|
|||||||
run_env => '',
|
run_env => '',
|
||||||
# All compilers
|
# All compilers
|
||||||
v_flags => [split(/\s+/,
|
v_flags => [split(/\s+/,
|
||||||
((-r 'input.vc' ? " -f input.vc " : "")
|
(($self->{xsim} ? " -f input.xsim.vc " :
|
||||||
|
(-r 'input.vc' ? " -f input.vc " : ""))
|
||||||
.($self->{t_dir} !~ m!/test_regress! # Don't include standard dir, only site's
|
.($self->{t_dir} !~ m!/test_regress! # Don't include standard dir, only site's
|
||||||
? " +incdir+$self->{t_dir} -y $self->{t_dir}" : "")
|
? " +incdir+$self->{t_dir} -y $self->{t_dir}" : "")
|
||||||
. " +define+TEST_OBJ_DIR=$self->{obj_dir}"
|
. " ".$define_opt."TEST_OBJ_DIR=$self->{obj_dir}"
|
||||||
.($opt_verbose ? " +define+TEST_VERBOSE=1":"")
|
.($opt_verbose ? " ".$define_opt."TEST_VERBOSE=1":"")
|
||||||
.($opt_benchmark ? " +define+TEST_BENCHMARK=$opt_benchmark":"")
|
.($opt_benchmark ? " ".$define_opt."TEST_BENCHMARK=$opt_benchmark":"")
|
||||||
.($opt_trace ? " +define+WAVES=1":"")
|
.($opt_trace ? " ".$define_opt."WAVES=1":"")
|
||||||
))],
|
))],
|
||||||
v_flags2 => [], # Overridden in some sim files
|
v_flags2 => [], # Overridden in some sim files
|
||||||
v_other_filenames => [], # After the filename so we can spec multiple files
|
v_other_filenames => [], # After the filename so we can spec multiple files
|
||||||
@ -542,6 +553,11 @@ sub new {
|
|||||||
ms_flags => [split(/\s+/,("-sv -work $self->{obj_dir}/work"))],
|
ms_flags => [split(/\s+/,("-sv -work $self->{obj_dir}/work"))],
|
||||||
ms_flags2 => [], # Overridden in some sim files
|
ms_flags2 => [], # Overridden in some sim files
|
||||||
ms_run_flags => [split(/\s+/,"-lib $self->{obj_dir}/work -c -do 'run -all;quit' ")],
|
ms_run_flags => [split(/\s+/,"-lib $self->{obj_dir}/work -c -do 'run -all;quit' ")],
|
||||||
|
# XSim
|
||||||
|
xsim => 0,
|
||||||
|
xsim_flags => [split(/\s+/,("--nolog --sv --define XSIM --work $self->{name}=$self->{obj_dir}/xsim"))],
|
||||||
|
xsim_flags2 => [], # Overridden in some sim files
|
||||||
|
xsim_run_flags => [split(/\s+/,"--nolog --runall --lib $self->{name}=$self->{obj_dir}/xsim ")],
|
||||||
# Verilator
|
# Verilator
|
||||||
vlt => 0,
|
vlt => 0,
|
||||||
vltmt => 0,
|
vltmt => 0,
|
||||||
@ -908,6 +924,20 @@ sub compile {
|
|||||||
fails=>$param{fails},
|
fails=>$param{fails},
|
||||||
cmd=>\@cmd);
|
cmd=>\@cmd);
|
||||||
}
|
}
|
||||||
|
elsif ($param{xsim}) {
|
||||||
|
$self->_make_top();
|
||||||
|
$self->_run(logfile=>"$self->{obj_dir}/xsim_compile.log",
|
||||||
|
fails=>$param{fails},
|
||||||
|
cmd=>[($ENV{VERILATOR_XVLOG}||"xvlog"),
|
||||||
|
@{$param{xsim_flags}},
|
||||||
|
@{$param{xsim_flags2}},
|
||||||
|
@{$param{v_flags}},
|
||||||
|
@{$param{v_flags2}},
|
||||||
|
$param{top_filename},
|
||||||
|
$param{top_shell_filename},
|
||||||
|
@{$param{v_other_filenames}}
|
||||||
|
]);
|
||||||
|
}
|
||||||
elsif ($param{vlt_all}) {
|
elsif ($param{vlt_all}) {
|
||||||
my @cmdargs = $self->compile_vlt_flags(%param);
|
my @cmdargs = $self->compile_vlt_flags(%param);
|
||||||
|
|
||||||
@ -1059,6 +1089,19 @@ sub execute {
|
|||||||
expect_filename=>$param{vcs_run_expect_filename},
|
expect_filename=>$param{vcs_run_expect_filename},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
elsif ($param{xsim}) {
|
||||||
|
$self->_run(logfile=>"$self->{obj_dir}/xsim_sim.log",
|
||||||
|
fails=>$param{fails},
|
||||||
|
cmd=>[$run_env.($ENV{VERILATOR_XELAB}||"xelab"),
|
||||||
|
@{$param{xsim_run_flags}},
|
||||||
|
@{$param{all_run_flags}},
|
||||||
|
(" $self->{name}.top")
|
||||||
|
],
|
||||||
|
%param,
|
||||||
|
expect=>$param{xsim_run_expect}, # non-verilator expect isn't the same
|
||||||
|
expect_filename=>$param{xsim_expect_filename},
|
||||||
|
);
|
||||||
|
}
|
||||||
elsif ($param{vlt_all}
|
elsif ($param{vlt_all}
|
||||||
#&& (!$param{needs_v4} || -r "$ENV{VERILATOR_ROOT}/src/V3Gate.cpp")
|
#&& (!$param{needs_v4} || -r "$ENV{VERILATOR_ROOT}/src/V3Gate.cpp")
|
||||||
) {
|
) {
|
||||||
@ -2182,6 +2225,15 @@ The equivalent of C<v_flags> and C<v_flags2>, but only for use with
|
|||||||
Verilator. If a flag is a standard flag (+incdir for example) v_flags2
|
Verilator. If a flag is a standard flag (+incdir for example) v_flags2
|
||||||
should be used instead.
|
should be used instead.
|
||||||
|
|
||||||
|
=item xsim_flags
|
||||||
|
|
||||||
|
=item xsim_flags2
|
||||||
|
|
||||||
|
=item xsim_run_flags
|
||||||
|
|
||||||
|
The equivalent of C<v_flags>, C<v_flags2> and C<all_run_flags>, but only
|
||||||
|
for use with the Xilinx XSim simulator.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head2 HINTS ON WRITING TESTS
|
=head2 HINTS ON WRITING TESTS
|
||||||
@ -2390,6 +2442,10 @@ Run Verilator tests in single-threaded mode. Default unless another scenario fl
|
|||||||
|
|
||||||
Run Verilator tests in multithreaded mode.
|
Run Verilator tests in multithreaded mode.
|
||||||
|
|
||||||
|
=item --xsim
|
||||||
|
|
||||||
|
Run Xilinx XSim simulator tests.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head1 ENVIRONMENT
|
=head1 ENVIRONMENT
|
||||||
@ -2432,6 +2488,14 @@ Used with --site, a colon-separated list of directories with tests to be added t
|
|||||||
|
|
||||||
Command to use to invoke VCS.
|
Command to use to invoke VCS.
|
||||||
|
|
||||||
|
=item VERILATOR_XELAB
|
||||||
|
|
||||||
|
Command to use to invoke XSim xelab
|
||||||
|
|
||||||
|
=item VERILATOR_XVLOG
|
||||||
|
|
||||||
|
Command to use to invoke XSim xvlog
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
7
test_regress/input.xsim.vc
Normal file
7
test_regress/input.xsim.vc
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
--sourcelibext .v
|
||||||
|
--sourcelibdir t
|
||||||
|
--sourcelibdir obj_dir/
|
||||||
|
--include t
|
||||||
|
--include ../include
|
||||||
|
--include obj_dir/
|
Loading…
Reference in New Issue
Block a user