diff --git a/Makefile.in b/Makefile.in index 09cde0262..e3768580c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -92,6 +92,7 @@ datarootdir = @datarootdir@ CFG_WITH_CCWARN = @CFG_WITH_CCWARN@ CFG_WITH_DEFENV = @CFG_WITH_DEFENV@ CFG_WITH_LONGTESTS = @CFG_WITH_LONGTESTS@ +CFG_WITH_THREADED = @CFG_WITH_THREADED@ PACKAGE_VERSION = @PACKAGE_VERSION@ #### End of system configuration section. #### @@ -505,6 +506,9 @@ dist-file-list: @echo $(wildcard $(DISTFILES)) @echo "end-dist-file-list:"; # Scripts look for this +print-cfg-with-threaded: + @echo $(CFG_WITH_THREADED) + ###################################################################### # Distributions diff --git a/configure.ac b/configure.ac index e5dfc5327..678f5b774 100644 --- a/configure.ac +++ b/configure.ac @@ -227,6 +227,23 @@ _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-Wno-unused-variable) _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-Wno-shadow) AC_SUBST(CFG_CXXFLAGS_NO_UNUSED) +# Set CFG_WITH_THREADED if can support threading +AC_MSG_CHECKING(whether $CXX supports Verilated threads) +ACO_SAVE_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $CFG_CXXFLAGS_STD_NEWEST $CFG_CXXFLAGS_NO_UNUSED" +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include ], [[ ]])], + [_my_result=yes + if test -s conftest.err; then + if grep -e "$1" conftest.err >/dev/null; then + _my_result=no + fi + fi], + [_my_result=no]) +CFG_WITH_THREADED=$_my_result +AC_SUBST(CFG_WITH_THREADED) +AC_MSG_RESULT($CFG_WITH_THREADED) + # Checks for library functions. AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec], [AC_DEFINE([HAVE_STAT_NSEC],[1],[Defined if struct stat has st_mtim.tv_nsec])], diff --git a/test_regress/driver.pl b/test_regress/driver.pl index 820838d63..26df45d45 100755 --- a/test_regress/driver.pl +++ b/test_regress/driver.pl @@ -1512,6 +1512,12 @@ sub cxx_version { return $_Cxx_Version; } +our $_Cfg_With_Threaded; +sub cfg_with_threaded { + my $out = `make -f ../Makefile print-cfg-with-threaded`; + return ($out =~ /yes/i) ? 1:0; +} + sub file_grep_not { my $self = (ref $_[0]? shift : $Self); my $filename = shift; diff --git a/test_regress/t/t_threads_counter_1.pl b/test_regress/t/t_threads_counter_1.pl index 8cf80808b..186cc575e 100755 --- a/test_regress/t/t_threads_counter_1.pl +++ b/test_regress/t/t_threads_counter_1.pl @@ -7,6 +7,8 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Lesser General Public License Version 3 or the Perl Artistic License # Version 2.0. +$Self->skip("No thread support") if !$Self->cfg_with_threaded; + top_filename("t/t_threads_counter.v"); compile ( diff --git a/test_regress/t/t_threads_counter_2.pl b/test_regress/t/t_threads_counter_2.pl index c1519604c..3a7c975fb 100755 --- a/test_regress/t/t_threads_counter_2.pl +++ b/test_regress/t/t_threads_counter_2.pl @@ -7,6 +7,8 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Lesser General Public License Version 3 or the Perl Artistic License # Version 2.0. +$Self->skip("No thread support") if !$Self->cfg_with_threaded; + top_filename("t/t_threads_counter.v"); compile ( diff --git a/test_regress/t/t_verilated_all_newest.pl b/test_regress/t/t_verilated_all_newest.pl index 183c15808..7bb138b9a 100755 --- a/test_regress/t/t_verilated_all_newest.pl +++ b/test_regress/t/t_verilated_all_newest.pl @@ -13,7 +13,7 @@ my $root = ".."; compile ( # Can't use --coverage and --savable together, so cheat and compile inline - verilator_flags2 => ['--cc --coverage-toggle --coverage-line --coverage-user --trace --threads 1 --vpi $root/include/verilated_save.cpp'], + verilator_flags2 => ['--cc --coverage-toggle --coverage-line --coverage-user --trace --vpi $root/include/verilated_save.cpp'], ); execute ( diff --git a/test_regress/t/t_verilated_threaded.pl b/test_regress/t/t_verilated_threaded.pl new file mode 100755 index 000000000..c6585d885 --- /dev/null +++ b/test_regress/t/t_verilated_threaded.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003-2009 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +$Self->skip("No thread support") if !$Self->cfg_with_threaded; + +top_filename("t/t_verilated_all.v"); + +my $root = ".."; + +compile ( + # Can't use --coverage and --savable together, so cheat and compile inline + verilator_flags2 => ['--cc --coverage-toggle --coverage-line --coverage-user --trace --threads 1 --vpi $root/include/verilated_save.cpp'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_vpi_get.pl b/test_regress/t/t_vpi_get.pl index 3de835d11..195facc86 100755 --- a/test_regress/t/t_vpi_get.pl +++ b/test_regress/t/t_vpi_get.pl @@ -7,6 +7,9 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Lesser General Public License Version 3 or the Perl Artistic License # Version 2.0. +$Self->skip("Known compiler limitation") + if $Self->cxx_version =~ /\(GCC\) 4.4/; + compile ( make_top_shell => 0, make_main => 0, diff --git a/test_regress/t/t_vpi_memory.pl b/test_regress/t/t_vpi_memory.pl index d071f4c98..6042b3b7d 100755 --- a/test_regress/t/t_vpi_memory.pl +++ b/test_regress/t/t_vpi_memory.pl @@ -7,6 +7,9 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Lesser General Public License Version 3 or the Perl Artistic License # Version 2.0. +$Self->skip("Known compiler limitation") + if $Self->cxx_version =~ /\(GCC\) 4.4/; + compile ( make_top_shell => 0, make_main => 0,