diff --git a/benchmarks/coremark/Makefile b/benchmarks/coremark/Makefile index 9ac905950..7c8cc9b8b 100644 --- a/benchmarks/coremark/Makefile +++ b/benchmarks/coremark/Makefile @@ -5,14 +5,13 @@ PORT_DIR = $(CURDIR)/riscv64-baremetal cmbase= $(WALLY)/addins/coremark work_dir= $(WALLY)/benchmarks/coremark/work -XLEN ?=64 +XLEN ?=32 sources=$(cmbase)/core_main.c $(cmbase)/core_list_join.c $(cmbase)/coremark.h \ $(cmbase)/core_matrix.c $(cmbase)/core_state.c $(cmbase)/core_util.c \ $(PORT_DIR)/core_portme.h $(PORT_DIR)/core_portme.c $(PORT_DIR)/core_portme.mak \ $(PORT_DIR)/crt.S $(PORT_DIR)/encoding.h $(PORT_DIR)/util.h $(PORT_DIR)/syscalls.c ABI := $(if $(findstring "64","$(XLEN)"),lp64,ilp32) -#ARCH := rv$(XLEN)gc_zba_zbb_zbc -ARCH := rv$(XLEN)im_zicsr_zba_zbb_zbc +ARCH := rv$(XLEN)im_zicsr_zba_zbb_zbs #ARCH := rv$(XLEN)gc #ARCH := rv$(XLEN)imc_zicsr #ARCH := rv$(XLEN)im_zicsr @@ -29,7 +28,6 @@ all: $(work_dir)/coremark.bare.riscv.elf.memfile run: time wsim rv$(XLEN)gc coremark 2>&1 | tee $(work_dir)/coremark.sim.log - #(cd ../../sim && (time vsim -c -do "do wally-batch.do rv$(XLEN)gc coremark" 2>&1 | tee $(work_dir)/coremark.sim.log)) $(work_dir)/coremark.bare.riscv.elf.memfile: $(work_dir)/coremark.bare.riscv riscv64-unknown-elf-objdump -D $< > $<.elf.objdump diff --git a/benchmarks/coremark/coremark_sweep.py b/benchmarks/coremark/coremark_sweep.py index 527f5f44f..555c51401 100755 --- a/benchmarks/coremark/coremark_sweep.py +++ b/benchmarks/coremark/coremark_sweep.py @@ -34,18 +34,18 @@ import re import csv # list of architectures to run. arch_list = [ - "rv32gc_zba_zbb_zbc", + "rv32i_zicsr", + "rv32im_zicsr", + "rv32imc_zicsr", "rv32im_zicsr_zba_zbb_zbc", "rv32gc", - "rv32imc_zicsr", - "rv32im_zicsr", - "rv32i_zicsr", - "rv64gc_zba_zbb_zbc", + "rv32gc_zba_zbb_zbc", + "rv64i_zicsr", + "rv64im_zicsr", + "rv64imc_zicsr", "rv64im_zicsr_zba_zbb_zbc", "rv64gc", - "rv64imc_zicsr", - "rv64im_zicsr", - "rv64i_zicsr" + "rv64gc_zba_zbb_zbc" ] str="32" # Define regular expressions to match the desired fields diff --git a/benchmarks/coremark/riscv64-baremetal/core_portme.h b/benchmarks/coremark/riscv64-baremetal/core_portme.h index 4f5efc1d8..8db43d20a 100755 --- a/benchmarks/coremark/riscv64-baremetal/core_portme.h +++ b/benchmarks/coremark/riscv64-baremetal/core_portme.h @@ -109,11 +109,11 @@ typedef unsigned short ee_u16; typedef signed int ee_s32; typedef double ee_f32; typedef unsigned char ee_u8; -//typedef unsigned int ee_u32; -typedef signed int ee_u32; // replaced with signed to improve performance per https://github.com/sifive/benchmark-coremark/blob/master/linux64/core_portme.h#L102 #if (XLEN==64) + typedef signed int ee_u32; // replaced with signed to improve performance by avoiding zero extension in RV64 per https://github.com/sifive/benchmark-coremark/blob/master/linux64/core_portme.h#L102 typedef unsigned long long ee_ptr_int; #else + typedef unsigned int ee_u32; typedef ee_u32 ee_ptr_int; #endif typedef size_t ee_size_t; diff --git a/benchmarks/coremark/riscv64-baremetal/core_portme.mak b/benchmarks/coremark/riscv64-baremetal/core_portme.mak index 27e31b859..e07196061 100755 --- a/benchmarks/coremark/riscv64-baremetal/core_portme.mak +++ b/benchmarks/coremark/riscv64-baremetal/core_portme.mak @@ -107,7 +107,7 @@ port_prebuild: $(PGO_STAGE) .PHONY: build_pgo_gcc build_pgo_gcc: - $(MAKE) PGO=gen XCFLAGS="$(XCFLAGS) -fprofile-generate -DTOTAL_DATA_SIZE=1200" ITERATIONS=10 gen_pgo_data REBUILD=1 + $(MAKE) PGO=gen XCFLAGS="$(XCFLAGS) -fprofile-generate -DTOTAL_DATA_SIZE=1200" gen_pgo_data REBUILD=1 # Target: port_postbuild # Generate any files that are needed after actual build end. diff --git a/benchmarks/embench/Makefile b/benchmarks/embench/Makefile index b4e41ca0d..e4b671c59 100644 --- a/benchmarks/embench/Makefile +++ b/benchmarks/embench/Makefile @@ -38,26 +38,27 @@ build_speedopt_size: build_sizeopt_size: $(embench_dir)/build_all.py --builddir=bd_sizeopt_size --arch riscv32 --chip generic --board rv32wallyverilog --ldflags="-nostdlib -nostartfiles ../../../config/riscv32/boards/rv32wallyverilog/startup/dummy.S -march=$(ARCH)" --cflags="-Os -msave-restore -march=$(ARCH)" --dummy-libs="libgcc libm libc crt0" -# builds dependencies, then launches modelsim and finally runs python wrapper script to present results -sim: modelsim_build_memfile modelsim_run speed +# builds dependencies, then launches sim and finally runs python wrapper script to present results +sim: sim_build_memfile sim_run speed -# launches modelsim to simulate tests on wally -modelsim_run: - mkdir -p ../../sim/wkdir - (cd ../../sim/ && wsim rv32gc embench) - cd ../../benchmarks/embench/ +# launches sim to simulate tests on wally +sim_run: + wsim rv32gc embench + #mkdir -p ../../sim/wkdir + #(cd ../../sim/ && wsim rv32gc embench) + #cd ../../benchmarks/embench/ # builds the objdump based on the compiled c elf files objdump: find $(embench_dir)/bd_*_speed/ -type f -name "*.elf" | while read f; do riscv64-unknown-elf-objdump -S -D "$$f" > "$$f.objdump"; done # build memfiles, objdump.lab and objdump.addr files -modelsim_build_memfile: objdump +sim_build_memfile: objdump find $(embench_dir)/bd_*_speed/ -type f -name "*.elf" | while read f; do riscv64-unknown-elf-elf2hex --bit-width 32 --input "$$f" --output "$$f.memfile"; done find $(embench_dir)/bd_*_speed/ -type f -name "*.elf.objdump" | while read f; do extractFunctionRadix.sh $$f; done # builds the tests for speed, runs them on spike and then launches python script to present results -# note that the speed python script benchmark_speed.py can get confused if there's both a .output file created from spike and modelsim +# note that the speed python script benchmark_speed.py can get confused if there's both a .output file created from spike and questa # you'll need to manually remove one of the two .output files, or run make clean spike: buildspeed spike_run speed diff --git a/bin/lint-wally b/bin/lint-wally index 4187b0429..08d189ec7 100755 --- a/bin/lint-wally +++ b/bin/lint-wally @@ -11,7 +11,7 @@ GREEN='\033[0;32m' NC='\033[0m' # No Color fails=0 -if [ "$1" == "-nightly" ]; then +if [ "$1" == "--nightly" ]; then configs=(rv32e rv64gc rv32gc rv32imc rv32i rv64i) # fdqh_rv64gc derivconfigs=`ls $WALLY/config/deriv` for entry in $derivconfigs diff --git a/bin/wally-tool-chain-install.sh b/bin/wally-tool-chain-install.sh index 1810747ec..336ce33e4 100755 --- a/bin/wally-tool-chain-install.sh +++ b/bin/wally-tool-chain-install.sh @@ -176,6 +176,10 @@ git clone https://github.com/riscv/sail-riscv.git cd sail-riscv # For now, use checkout that is stable for Wally #git checkout 72b2516d10d472ac77482fd959a9401ce3487f60 # not new enough for Zicboz? +export OPAMCLI=2.0 # Sail is not compatible with opam 2.1 as of 4/16/24 +# It is faster to just build c_emulator/riscv_sim_RV* than to build all of Sail +#make -j ${NUM_THREADS} +#ARCH=RV32 make -j ${NUM_THREADS} make -j ${NUM_THREADS} c_emulator/riscv_sim_RV64 ARCH=RV32 make -j ${NUM_THREADS} c_emulator/riscv_sim_RV32 sudo ln -sf $RISCV/sail-riscv/c_emulator/riscv_sim_RV64 /usr/bin/riscv_sim_RV64 diff --git a/config/shared/config-shared.vh b/config/shared/config-shared.vh index 481247eae..25d0d8c65 100644 --- a/config/shared/config-shared.vh +++ b/config/shared/config-shared.vh @@ -99,7 +99,6 @@ localparam RK = LOGR*DIVCOPIES; // r*k bits // intermediate division parameters not directly used in fdivsqrt hardware localparam FPDIVMINb = NF + 2; // minimum length of fractional part: Nf result bits + guard and round bits + 1 extra bit to allow sqrt being shifted right -//localparam FPDIVMINb = NF + 2 + (RADIX == 2); // minimum length of fractional part: Nf result bits + guard and round bits + 1 extra bit for preshifting radix2 square root right, if radix4 doesn't use a right shift. This version saves one cycle on double-precision with R=4,k=4. However, it doesn't work yet because C is too short, so k is incorrectly calculated as a 1 in the lsb after the last step. localparam DIVMINb = ((FPDIVMINb