# Yunsup Lee (yunsup@cs.berkeley.edu)
#
+XLEN ?= 64
+
default: all
src_dir = .
mt-vvadd \
mt-matmul \
-bmarks_host = \
- median \
- qsort \
- towers \
- vvadd \
- multiply \
- spmv \
- vec-vvadd \
- vec-cmplxmult \
- vec-matmul \
-
#--------------------------------------------------------------------
# Build rules
#--------------------------------------------------------------------
-HOST_OPTS = -std=gnu99 -DPREALLOCATE=0 -DHOST_DEBUG=1
-HOST_COMP = gcc $(HOST_OPTS)
-
-RISCV_PREFIX ?= riscv64-unknown-elf-
+RISCV_PREFIX ?= riscv$(XLEN)-unknown-elf-
RISCV_GCC ?= $(RISCV_PREFIX)gcc
-RISCV_GCC_OPTS ?= -fpie -static -std=gnu99 -O2 -ffast-math -fno-common -fno-builtin-printf
+RISCV_GCC_OPTS ?= -mcmodel=medany -static -std=gnu99 -O2 -ffast-math -fno-common -fno-builtin-printf
RISCV_LINK ?= $(RISCV_GCC) -T $(src_dir)/common/test.ld $(incs)
RISCV_LINK_MT ?= $(RISCV_GCC) -T $(src_dir)/common/test-mt.ld
-RISCV_LINK_OPTS ?= -nostdlib -nostartfiles -ffast-math -lgcc
+RISCV_LINK_OPTS ?= -static -nostdlib -nostartfiles -lgcc
RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data
-RISCV_SIM ?= spike
+RISCV_SIM ?= spike --isa=rv$(XLEN)gc
VPATH += $(addprefix $(src_dir)/, $(bmarks))
VPATH += $(src_dir)/common
bmarks_riscv_dump = $(addsuffix .riscv.dump, $(bmarks))
bmarks_riscv_out = $(addsuffix .riscv.out, $(bmarks))
-bmarks_defs = -DPREALLOCATE=1 -DHOST_DEBUG=0
+bmarks_defs = -DPREALLOCATE=1
bmarks_cycles = 80000
$(bmarks_riscv_dump): %.riscv.dump: %.riscv
junk += $(bmarks_riscv_bin) $(bmarks_riscv_dump) $(bmarks_riscv_hex) $(bmarks_riscv_out)
-#------------------------------------------------------------
-# Build and run benchmarks on host machine
-
-bmarks_host_bin = $(addsuffix .host, $(bmarks_host))
-bmarks_host_out = $(addsuffix .host.out, $(bmarks_host))
-
-$(bmarks_host_out): %.host.out: %.host
- ./$< > $@
-
-host: $(bmarks_host_bin)
-run-host: $(bmarks_host_out)
- echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
- $(bmarks_host_out); echo;
-
-junk += $(bmarks_host_bin) $(bmarks_host_out)
-
#------------------------------------------------------------
# Default