Compare commits

...

4 Commits

6 changed files with 104 additions and 5 deletions

4
.gitignore vendored
View File

@ -1,7 +1,7 @@
/build/
/Debug/
.settings
/.venv
/.venv*
/Debug-PA/
/_build/
/install/
@ -12,3 +12,5 @@
*.disass
*.trc
/*.core_desc
/fasterDecoding/
*.ll

View File

@ -10,6 +10,7 @@ if(CMAKE_PROJECT_NAME STREQUAL "TGFS-ISS")
###########################################################################
set(CORE_NAME TGC5C CACHE STRING "The core to build the ISS for" )
option(FW_BUILD "Enable the automatic download and build of some firmware to run on the ISS" OFF)
option(ENABLE_SANITIZER "Enable address sanitizer" OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -34,7 +35,12 @@ if(CMAKE_PROJECT_NAME STREQUAL "TGFS-ISS")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(warnings "/W4 /WX /EHsc")
endif()
if(ENABLE_SANITIZER)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
endif()
include(GNUInstallDirs)
include(ConanInline)
if(BUILD_SHARED_LIBS)

@ -1 +1 @@
Subproject commit 13719603891b65cfc455e244f28fc06160c6d5f9
Subproject commit 58cacfb8c4f8007379ec4c9a2bac0aa1385a8f4a

@ -1 +1 @@
Subproject commit c7038cafa5f1df1ab5a435308e8b34a95d7da793
Subproject commit 212fb1c8fff472723295a561dde59ab75ae069d2

91
run_riscv_tests.sh Executable file
View File

@ -0,0 +1,91 @@
#!/bin/bash
##
# Absolute path to this script, e.g. /home/user/bin/foo.sh
SCRIPT=`readlink -f "$0"`
# Absolute path this script is in, thus /home/user/bin
SCRIPTDIR=`dirname "$SCRIPT"`
SCRIPTNAME=`basename "$SCRIPT"`
function print_help {
echo "Usage: $SCRIPTNAME [-b <backend>] [-s <sim args>]}"
echo "Run UCB risc-v compliance test suite on backends"
echo "Optional cli arguments:"
echo " -b backend type, default all"
echo " -s <args> simulator arguments"
echo " -h print help"
echo " -v increase verbosity"
echo " -t set build type"
}
SIM_ARGS="-v1"
BACKENDS=("interp" "tcc" "llvm")
DEBUG=0
BUILD_TYPE=Debug
while getopts 'b:s:hvt:' c
do
case $c in
b) BACKENDS=($OPTARG);;
s) SIM_ARGS=$OPTARG ;;
h) print_help; exit 0 ;;
v) DEBUG=1 ;;
t) BUILD_TYPE = $OPTARG;;
?)
print_help >&2
exit 1
;;
esac
done
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
ROOT_DIR=$DIR
RISCV_TEST=$ROOT_DIR/build/riscv-tests
# prepare riscv-test binaries
if [ ! -d $RISCV_TEST ]; then
mkdir -p $ROOT_DIR/build; cd $ROOT_DIR/build
git clone --recursive https://github.com/riscv/riscv-tests.git
cd $RISCV_TEST
autoconf
./configure --with-xlen=32
cd $ROOT_DIR
make -C $RISCV_TEST -j -k
fi
# check that we have an executable
RISCV_EXE=$ROOT_DIR/build/${BUILD_TYPE}/dbt-rise-tgc/tgc-sim
if [ ! -x $RISCV_EXE ]; then
mkdir -p build/${BUILD_TYPE}
echo "running cmake -B build/${BUILD_TYPE} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DWITH_TCC=ON -DWITH_LLVM=ON "
cmake -S . -B build/${BUILD_TYPE} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DWITH_TCC=ON -DWITH_LLVM=ON ../.. || exit 1
cmake --build build/${BUILD_TYPE} -j 20 || exit 1
fi
test_ui_list=`find ${RISCV_TEST}/isa -type f -name rv32ui-p-\* -executable | grep -v fence | grep -v ma_data |sort`
test_uc_list=`find ${RISCV_TEST}/isa -type f -name rv32uc-p-\* -executable | grep -v fence | sort`
test_um_list=`find ${RISCV_TEST}/isa -type f -name rv32um-p-\* -executable | grep -v fence | sort`
test_list="$test_ui_list $test_uc_list $test_um_list $test_mmode_list"
for backend in "${BACKENDS[@]}"; do
failed_list=()
for elf in $test_list; do
[ $DEBUG -eq 0 ] || echo Running "${RISCV_EXE} $SIM_ARGS -f $elf --backend $backend"
${RISCV_EXE} $SIM_ARGS -f $elf --backend $backend
if [ $? != 0 ]; then
failed_list+="$backend:$elf "
fi
done
tcount=`echo $test_list | wc -w`
if [ ! -z "$failed_list" ]; then
fcount=`echo $failed_list | wc -w`
echo "($backend) $fcount of $tcount test(s) failed:"
echo $failed_list | tr ' ' '\n'
else
echo
echo "($backend) All $tcount tests passed."
if [ $DEBUG -eq 1 ];then
echo "List of executed tests:"
for t in $test_list; do
name=`basename $t`
echo " $name"
done
fi
fi
done

2
scc

@ -1 +1 @@
Subproject commit 88363047043fd0f0bd39ee0dd1b95cf77c51a461
Subproject commit baba1214d358ee8ced775de9df6a01b454018f96