aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2016-09-04 13:14:55 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2016-09-04 13:14:55 -0700
commit6a2626f617fb55baccc40f729488f4747190bbb4 (patch)
treea77990302235764f20fd06cfb1f57f63ed3b0182
parentc9022d2f63f50388b2ab1192966f30dbe7819a59 (diff)
downloadriscv-tests-rvt-master.zip
riscv-tests-rvt-master.tar.gz
riscv-tests-rvt-master.tar.bz2
Add support for a "--with-xlen" argumentrvt-master
This is a backport from the priv-1.9 commit 7f3b666f55c9f01c2f2fd725c1686e1a509df173.
-rw-r--r--Makefile.in5
-rw-r--r--benchmarks/Makefile3
-rwxr-xr-xconfigure19
-rw-r--r--configure.ac7
-rw-r--r--isa/Makefile4
-rw-r--r--mt/Makefile3
6 files changed, 35 insertions, 6 deletions
diff --git a/Makefile.in b/Makefile.in
index 541263b..d381561 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3,6 +3,7 @@ abs_top_src_dir := @abs_top_srcdir@
instbasedir := $(DESTDIR)$(prefix)
bmarkdir := $(abs_top_src_dir)/benchmarks
isa_src_dir := $(abs_top_src_dir)/isa
+XLEN := @XLEN@
all: benchmarks isa
@@ -14,11 +15,11 @@ install: all
benchmarks:
mkdir -p benchmarks
- $(MAKE) -C benchmarks -f $(bmarkdir)/Makefile bmarkdir=$(bmarkdir)
+ $(MAKE) -C benchmarks -f $(bmarkdir)/Makefile bmarkdir=$(bmarkdir) XLEN=$(XLEN)
isa:
mkdir -p isa
- $(MAKE) -C isa -f $(isa_src_dir)/Makefile isa_src_dir=$(isa_src_dir)
+ $(MAKE) -C isa -f $(isa_src_dir)/Makefile isa_src_dir=$(isa_src_dir) XLEN=$(XLEN)
clean:
$(MAKE) -f $(isa_src_dir)/Makefile isa_src_dir=$(isa_src_dir) clean
diff --git a/benchmarks/Makefile b/benchmarks/Makefile
index 26df2a9..e4d1fef 100644
--- a/benchmarks/Makefile
+++ b/benchmarks/Makefile
@@ -46,7 +46,8 @@ bmarks_host = \
HOST_OPTS = -std=gnu99 -DPREALLOCATE=0 -DHOST_DEBUG=1
HOST_COMP = gcc $(HOST_OPTS)
-RISCV_PREFIX ?= riscv64-unknown-elf-
+XLEN ?= 64
+RISCV_PREFIX ?= riscv$(XLEN)-unknown-elf-
RISCV_GCC ?= $(RISCV_PREFIX)gcc
RISCV_GCC_OPTS ?= -static -std=gnu99 -O2 -ffast-math -fno-common -fno-builtin-printf
RISCV_LINK ?= $(RISCV_GCC) -T $(bmarkdir)/common/test.ld $(incs)
diff --git a/configure b/configure
index d0b558b..672cb0a 100755
--- a/configure
+++ b/configure
@@ -583,6 +583,7 @@ PACKAGE_URL=''
ac_subst_vars='LTLIBOBJS
LIBOBJS
+XLEN
OBJEXT
EXEEXT
ac_ct_CC
@@ -631,6 +632,7 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
+with_xlen
'
ac_precious_vars='build_alias
host_alias
@@ -1245,6 +1247,11 @@ if test -n "$ac_init_help"; then
esac
cat <<\_ACEOF
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-xlen=XLEN Set XLEN, the X-register bit width (default is 64)
+
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
@@ -2515,6 +2522,18 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+# Check whether --with-xlen was given.
+if test "${with_xlen+set}" = set; then :
+ withval=$with_xlen; XLEN=$withval
+
+else
+ XLEN=64
+
+
+fi
+
+
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
diff --git a/configure.ac b/configure.ac
index d85ddd6..9ebf832 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,13 @@ AC_INIT(riscv-tests, 1.0)
cross_compiling=yes
AC_PROG_CC
+AC_ARG_WITH(xlen,
+ [AS_HELP_STRING([--with-xlen=XLEN],
+ [Set XLEN, the X-register bit width (default is 64)])],
+ AC_SUBST(XLEN, $withval),
+ AC_SUBST(XLEN, 64)
+ )
+
AC_OUTPUT(
Makefile
)
diff --git a/isa/Makefile b/isa/Makefile
index 415778e..9c64be7 100644
--- a/isa/Makefile
+++ b/isa/Makefile
@@ -18,13 +18,13 @@ default: all
# Build rules
#--------------------------------------------------------------------
-RISCV_PREFIX ?= riscv64-unknown-elf-
+XLEN ?= 64
+RISCV_PREFIX ?= riscv$(XLEN)-unknown-elf-
RISCV_GCC ?= $(RISCV_PREFIX)gcc
ENTROPY ?= -DENTROPY=$(shell echo $$$$)
RISCV_GCC_OPTS ?= $(ENTROPY) -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles
RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.text.init --section=.data
RISCV_SIM ?= spike
-XLEN ?= 64
vpath %.S $(isa_src_dir)
diff --git a/mt/Makefile b/mt/Makefile
index e4a8bfd..8349a8b 100644
--- a/mt/Makefile
+++ b/mt/Makefile
@@ -75,7 +75,8 @@ bmarks = $(bmarks_vvadd) $(bmarks_matmul)
# Build rules
#--------------------------------------------------------------------
-RISCV_PREFIX=riscv64-unknown-elf-
+XLEN ?= 64
+RISCV_PREFIX=riscv$(XLEN)-unknown-elf-
RISCV_GCC = $(RISCV_PREFIX)gcc
RISCV_GCC_OPTS = -std=gnu99 -O2 -ffast-math
RISCV_LINK = $(RISCV_GCC) -T $(common)/test.ld $(incs)