mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-04-22 21:27:10 -04:00
Merge 0de266db5b
into 733743da0f
This commit is contained in:
commit
e6f3c5f3ff
6 changed files with 171 additions and 5 deletions
|
@ -208,6 +208,19 @@ smoke-hwconfig:
|
|||
- source verif/regress/hwconfig_tests.sh
|
||||
- python3 .gitlab-ci/scripts/report_pass.py
|
||||
|
||||
hello-pk:
|
||||
extends:
|
||||
- .fe_smoke_test
|
||||
variables:
|
||||
DASHBOARD_JOB_TITLE: "Hello world with riscv-pk on cv64a6_imafdc_sv39"
|
||||
DASHBOARD_JOB_DESCRIPTION: "Short tests to challenge target configurations"
|
||||
DASHBOARD_SORT_INDEX: 1
|
||||
DASHBOARD_JOB_CATEGORY: "Basic"
|
||||
COLLECT_SIMU_LOGS: 1
|
||||
script:
|
||||
- bash verif/regress/hello-veri-testharness-pk-cv64a6_imafdc_sv39.sh
|
||||
- !reference [.simu_after_script]
|
||||
|
||||
.synthesis_test:
|
||||
stage: heavy tests
|
||||
timeout: 2 hours
|
||||
|
|
39
verif/regress/hello-verilator-pk-cv64a6_imafdc_sv39.sh
Normal file
39
verif/regress/hello-verilator-pk-cv64a6_imafdc_sv39.sh
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Make sure to source this script from the root directory
|
||||
# to correctly set the environment variables related to the tools
|
||||
|
||||
# Set the NUM_JOBS variable to increase the number of parallel make jobs
|
||||
# export NUM_JOBS=
|
||||
# where are the tools
|
||||
if ! [ -n "$RISCV" ]; then
|
||||
echo "Error: RISCV variable undefined"
|
||||
return
|
||||
fi
|
||||
|
||||
TIMEOUT_WALLCLOCK="600"
|
||||
TIMEOUT_TICKS="2100000"
|
||||
export DV_SIMULATORS="veri-testharness-pk"
|
||||
export DV_TARGET="cv64a6_imafdc_sv39"
|
||||
export PK_ARCH="rv64gc_zba_zbb_zbs_zbc"
|
||||
export PK_MABI="ilp64d"
|
||||
|
||||
if [[ "$DV_SIMULATORS" == *"veri-testharness"* ]]; then
|
||||
source ./verif/regress/install-verilator.sh
|
||||
fi
|
||||
|
||||
if [[ "$DV_SIMULATORS" == *"veri-testharness-pk"* ]]; then
|
||||
|
||||
echo "[ riscv-pk ] veri-testharness-pk simulation detected. Installing RISC-V proxy kernel..."
|
||||
source ./verif/regress/install-pk.sh ${PK_ARCH} ${PK_MABI} > ./verif/sim/pk-install.log 2>&1
|
||||
echo "[ riscv-pk ] RISC-V proxy kernel installation logs at $(pwd)/verif/sim/pk-install.log"
|
||||
echo "[ riscv-pk ] PK_INSTALL_DIR is ${PK_INSTALL_DIR}"
|
||||
fi
|
||||
|
||||
source ./verif/sim/setup-env.sh
|
||||
cd ./verif/sim
|
||||
|
||||
CC_OPTS=""
|
||||
|
||||
python3 cva6.py --target $DV_TARGET --iss=$DV_SIMULATORS --iss_yaml=cva6.yaml --iss_timeout=$TIMEOUT_WALLCLOCK \
|
||||
--c_tests ../tests/custom/hello_world/hello_world.c \
|
||||
--gcc_opts="$CC_OPTS" \
|
||||
--issrun_opts="+time_out=$TIMEOUT_TICKS"
|
83
verif/regress/install-pk.sh
Executable file
83
verif/regress/install-pk.sh
Executable file
|
@ -0,0 +1,83 @@
|
|||
# This script installs RISCV proxy kernel at ${ROOT_PROJECT}/tools/pk,
|
||||
# where ROOT_PROJECT is base of the CVA6 repository.
|
||||
#!/bin/bash
|
||||
PK_ARCH=$1
|
||||
PK_MABI=$2
|
||||
PK_REPO="https://github.com/riscv-software-src/riscv-pk.git"
|
||||
PK_BRANCH="master"
|
||||
PK_COMMIT_HASH="e5563d1044bd6790325c4602c49f89e1182fa91a"
|
||||
|
||||
if ! [ -n "$RISCV" ]; then
|
||||
echo "Error: RISCV variable undefined"
|
||||
return
|
||||
fi
|
||||
PATH=$RISCV/bin:$PATH
|
||||
CLEAN_INSTALL="1"
|
||||
# Customise this to a fast local disk
|
||||
ROOT_PROJECT=$(readlink -f $(dirname "${BASH_SOURCE[0]}")/../../)
|
||||
|
||||
if [ -z "$NUM_JOBS" ]; then
|
||||
NUM_JOBS=1
|
||||
fi
|
||||
|
||||
#PK_PATCH="$ROOT_PROJECT/verif/regress/pk.patch"
|
||||
|
||||
# Unset historical variable PK_ROOT as it collides with the build process.
|
||||
if [ -n "$PK_ROOT" ]; then
|
||||
unset PK_ROOT
|
||||
fi
|
||||
|
||||
echo "[install-pk.sh] Entry values:"
|
||||
echo " PK_BUILD_DIR='$PK_BUILD_DIR'"
|
||||
echo " PK_INSTALL_DIR='$PK_INSTALL_DIR'"
|
||||
|
||||
# If not set, define the installation location of pk to the local path
|
||||
#
|
||||
# <top>/tools/pk
|
||||
#
|
||||
# Continuous Integration may need to override this particular variable
|
||||
# to use a preinstalled build of Verilator.
|
||||
if [ -z "$PK_INSTALL_DIR" ]; then
|
||||
export PK_INSTALL_DIR="$ROOT_PROJECT/tools/pk"
|
||||
echo "Setting PK_INSTALL_DIR to '$PK_INSTALL_DIR'..."
|
||||
fi
|
||||
|
||||
# Define the default src+build location of pk in case it needs to be (re)built.
|
||||
# No need to force this location in Continuous Integration scripts.
|
||||
if [ -z "$PK_BUILD_DIR" ]; then
|
||||
export PK_BUILD_DIR="$PK_INSTALL_DIR/build-pk"
|
||||
echo "Setting PK_BUILD_DIR to '$PK_BUILD_DIR'..."
|
||||
fi
|
||||
|
||||
echo "Cleaning $PK_INSTALL_DIR"
|
||||
rm -rf $PK_INSTALL_DIR
|
||||
|
||||
# Build and install pk only if not already installed at the expected
|
||||
# location $PK_INSTALL_DIR.
|
||||
if [ ! -f "$PK_INSTALL_DIR/riscv-none-elf/bin/pk" ]; then
|
||||
echo "Building pk in '$PK_BUILD_DIR'..."
|
||||
echo "pk will be installed in '$PK_INSTALL_DIR'"
|
||||
echo "PK_REPO=$PK_REPO"
|
||||
echo "PK_BRANCH=$PK_BRANCH"
|
||||
echo "NUM_JOBS=$NUM_JOBS"
|
||||
mkdir -p $PK_BUILD_DIR
|
||||
pushd $PK_BUILD_DIR
|
||||
# Fetch repository only if the ".git" directory does not exist.
|
||||
# Do not remove the content arbitrarily if ".git" does not exist in order
|
||||
# to preserve user content - let git fail instead.
|
||||
[ -d .git ] || git clone --depth=1 --branch ${PK_BRANCH} ${PK_REPO} . && git checkout ${PK_COMMIT_HASH}
|
||||
# [ -d .git ] || git init && git remote add origin ${PK_REPO} && git fetch --depth=1 origin ${PK_COMMIT_HASH} && git reset --hard FETCH_HEAD
|
||||
mkdir -p build
|
||||
pushd build
|
||||
../configure --prefix="$PK_INSTALL_DIR" --host=riscv-none-elf --with-arch=$PK_ARCH
|
||||
make
|
||||
make install
|
||||
popd
|
||||
popd
|
||||
else
|
||||
echo "pk already installed in '$PK_INSTALL_DIR'."
|
||||
fi
|
||||
|
||||
# Add pk bin directory to PATH if not already present.
|
||||
echo $PATH | grep -q "$PK_INSTALL_DIR/bin:" || \
|
||||
export PATH="$PK_INSTALL_DIR/bin:$PATH"
|
|
@ -411,6 +411,22 @@ vcs-testharness:
|
|||
$(tool_path)/spike-dasm --isa=$(variant) < ./trace_rvfi_hart_00.dasm > $(log)
|
||||
grep $(isspostrun_opts) ./trace_rvfi_hart_00.dasm
|
||||
|
||||
veri-testharness-pk:
|
||||
rm -rf $(path_var)/work-ver
|
||||
@echo "Trace compact value $(TRACE_COMPACT)"
|
||||
make -C $(path_var) verilate verilator="verilator --no-timing" target=$(target) defines=$(subst +define+,,$(isscomp_opts))
|
||||
$(path_var)/work-ver/Variane_testharness $(if $(TRACE_COMPACT), -f verilator.fst) $(if $(TRACE_FAST), -v verilator.vcd) \
|
||||
$(PK_INSTALL_DIR)/riscv-none-elf/bin/pk $(elf) \
|
||||
+tohost_addr=$(shell $$RISCV/bin/$(CV_SW_PREFIX)nm -B $(PK_INSTALL_DIR)/riscv-none-elf/bin/pk | grep -w tohost | cut -d' ' -f1) \
|
||||
$(issrun_opts)
|
||||
# If present, move default waveform files to log directory.
|
||||
# Keep track of target in waveform file name.
|
||||
[ ! -f verilator.fst ] || mv verilator.fst `dirname $(log)`/`basename $(log) .log`.fst
|
||||
[ ! -f verilator.vcd ] || mv verilator.vcd `dirname $(log)`/`basename $(log) .log`.vcd
|
||||
# Generate disassembled log.
|
||||
$(tool_path)/spike-dasm --isa=$(variant) < ./trace_rvfi_hart_00.dasm > $(log)
|
||||
grep $(isspostrun_opts) ./trace_rvfi_hart_00.dasm
|
||||
|
||||
veri-testharness:
|
||||
make -C $(path_var) verilate verilator="verilator --no-timing" target=$(target) defines=$(subst +define+,,$(isscomp_opts))
|
||||
$(path_var)/work-ver/Variane_testharness $(if $(TRACE_COMPACT), -f verilator.fst) $(if $(TRACE_FAST), -v verilator.vcd) $(elf) $(issrun_opts) \
|
||||
|
|
|
@ -508,13 +508,18 @@ def run_test(test, iss_yaml, isa, target, mabi, gcc_opts, iss_opts, output_dir,
|
|||
if test_type != "o":
|
||||
# gcc compilation
|
||||
logging.info("Compiling test: %s" % test_path)
|
||||
cmd = ("%s %s \
|
||||
-I%s/dv/user_extension \
|
||||
-T%s %s -o %s " % \
|
||||
(get_env_var("RISCV_CC", debug_cmd = debug_cmd), test_path, cwd,
|
||||
linker, gcc_opts, elf))
|
||||
if "veri-testharness-pk" not in iss_list:
|
||||
|
||||
cmd = ("%s %s \
|
||||
-I%s/dv/user_extension \
|
||||
-T%s %s -o %s " % \
|
||||
(get_env_var("RISCV_CC", debug_cmd = debug_cmd), test_path, cwd,
|
||||
linker, gcc_opts, elf))
|
||||
else: # veri-testharness with proxy kernel enabled.
|
||||
cmd= ("%s %s %s -o %s " % (get_env_var("RISCV_CC", debug_cmd = debug_cmd), test_path, gcc_opts, elf))
|
||||
cmd += (" -march=%s" % isa)
|
||||
cmd += (" -mabi=%s" % mabi)
|
||||
logging.info("Compilation cmd: %s" % cmd)
|
||||
run_cmd(cmd, debug_cmd = debug_cmd)
|
||||
log_list = []
|
||||
# ISS simulation
|
||||
|
|
|
@ -30,6 +30,16 @@
|
|||
cmd: >
|
||||
make veri-testharness target=<target> variant=<variant> elf=<elf> path_var=<path_var> tool_path=<tool_path> isscomp_opts=<isscomp_opts> issrun_opts=<issrun_opts> isspostrun_opts=<isspostrun_opts> log=<log>
|
||||
|
||||
###############################################################################
|
||||
# Verilator with RISCV proxy kernel support
|
||||
###############################################################################
|
||||
- iss: veri-testharness-pk
|
||||
path_var: RTL_PATH
|
||||
tool_path: SPIKE_PATH
|
||||
tb_path: TB_PATH
|
||||
cmd: >
|
||||
make veri-testharness-pk target=<target> variant=<variant> elf=<elf> path_var=<path_var> tool_path=<tool_path> isscomp_opts=<isscomp_opts> issrun_opts=<issrun_opts> isspostrun_opts=<isspostrun_opts> log=<log>
|
||||
|
||||
###############################################################################
|
||||
# Synopsys VCS specific commands, variables
|
||||
###############################################################################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue