From 10ae74e48aee7403bc3cb2540d1a7ccb7c69a211 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Sat, 2 Apr 2016 17:32:23 -0700 Subject: [PATCH] Allow configuration of default ISA with --with-isa --- config.h.in | 46 ++++++++++++++++++++++++++++++++++++++++-- configure | 19 +++++++++++++++++ riscv/riscv.ac | 6 ++++++ softfloat/softfloat.ac | 0 spike_main/spike.cc | 4 ++-- 5 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 softfloat/softfloat.ac diff --git a/config.h.in b/config.h.in index f5608c5..a4070ff 100644 --- a/config.h.in +++ b/config.h.in @@ -1,16 +1,46 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Default value for --isa switch */ +#undef DEFAULT_ISA + /* Define if subproject MCPPBS_SPROJ_NORM is enabled */ #undef DUMMY_ROCC_ENABLED +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + /* Define to 1 if you have the `fesvr' library (-lfesvr). */ #undef HAVE_LIBFESVR /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD -/* Define if subproject MCPPBS_SPROJ_NORM is enabled */ -#undef HWACHA_ENABLED +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT @@ -47,3 +77,15 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif diff --git a/configure b/configure index ca6fd5d..2c946e7 100755 --- a/configure +++ b/configure @@ -699,6 +699,7 @@ ac_user_opts=' enable_option_checking enable_stow enable_optional_subprojects +with_isa with_fesvr enable_commitlog enable_histogram @@ -1339,6 +1340,7 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-isa=RV64IMAFDC Sets the default RISC-V ISA --with-fesvr path to your fesvr installation if not in a standard location @@ -4394,6 +4396,23 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +# Check whether --with-isa was given. +if test "${with_isa+set}" = set; then : + withval=$with_isa; +cat >>confdefs.h <<_ACEOF +#define DEFAULT_ISA "$withval" +_ACEOF + +else + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_ISA "RV64IMAFDC" +_ACEOF + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } if ${ac_cv_search_dlopen+:} false; then : diff --git a/riscv/riscv.ac b/riscv/riscv.ac index 2a8ee53..7b48be6 100644 --- a/riscv/riscv.ac +++ b/riscv/riscv.ac @@ -1,5 +1,11 @@ AC_LANG_CPLUSPLUS +AC_ARG_WITH(isa, + [AS_HELP_STRING([--with-isa=RV64IMAFDC], + [Sets the default RISC-V ISA])], + AC_DEFINE_UNQUOTED([DEFAULT_ISA], "$withval", [Default value for --isa switch]), + AC_DEFINE_UNQUOTED([DEFAULT_ISA], "RV64IMAFDC", [Default value for --isa switch])) + AC_SEARCH_LIBS([dlopen], [dl dld], [], [ AC_MSG_ERROR([unable to find the dlopen() function]) ]) diff --git a/softfloat/softfloat.ac b/softfloat/softfloat.ac new file mode 100644 index 0000000..e69de29 diff --git a/spike_main/spike.cc b/spike_main/spike.cc index 950b108..4f8f42d 100644 --- a/spike_main/spike.cc +++ b/spike_main/spike.cc @@ -23,7 +23,7 @@ static void help() fprintf(stderr, " -g Track histogram of PCs\n"); fprintf(stderr, " -l Generate a log of execution\n"); fprintf(stderr, " -h Print this help message\n"); - fprintf(stderr, " --isa= RISC-V ISA string [default RV64IMAFDC]\n"); + fprintf(stderr, " --isa= RISC-V ISA string [default %s]\n", DEFAULT_ISA); fprintf(stderr, " --ic=:: Instantiate a cache model with S sets,\n"); fprintf(stderr, " --dc=:: W ways, and B-byte blocks (with S and\n"); fprintf(stderr, " --l2=:: B both powers of 2).\n"); @@ -43,7 +43,7 @@ int main(int argc, char** argv) std::unique_ptr dc; std::unique_ptr l2; std::function extension; - const char* isa = "RV64"; + const char* isa = DEFAULT_ISA; option_parser_t parser; parser.help(&help); -- 2.30.2