Skip to content

Commit

Permalink
Revert "Merge pull request openhwgroup#1889 from MarioOpenHWGroup/cva…
Browse files Browse the repository at this point in the history
…6/dev"

This reverts commit 3b08de5, reversing
changes made to 69a6372.
  • Loading branch information
MarioOpenHWGroup committed May 26, 2023
1 parent 59249c5 commit 8604bab
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 29 deletions.
37 changes: 23 additions & 14 deletions cva6/regress/install-cva6.sh
Expand Up @@ -8,13 +8,25 @@
# Original Author: Jean-Roch COULON - Thales

# Customise this to a fast local disk
export ROOT_PROJECT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../" && pwd)
export ROOT_PROJECT=$(readlink -f $(dirname "${BASH_SOURCE[0]}")/../../)
export TOP="$ROOT_PROJECT/tools"

# where to install the tools
if ! [ -n "$RISCV" ]; then
if [ -z "$RISCV" ]; then
echo "Error: RISCV variable undefined."
return
exit
fi

if [ -z "$CV_SW_PREFIX" ]; then
export CV_SW_PREFIX="$(ls -1 -r $RISCV/bin/riscv*-gcc | head -n 1| grep gcc | rev | cut -d '/' -f 1 | cut -d '-' -f 2- | rev)-"
fi

if [ -z "$RISCV_GCC" ]; then
export RISCV_GCC=$RISCV/bin/${CV_SW_PREFIX}gcc
fi

if [ -z "$RISCV_OBJCOPY" ]; then
export RISCV_OBJCOPY=$RISCV/bin/${CV_SW_PREFIX}objcopy
fi

# Set up tool-related variables.
Expand All @@ -28,22 +40,20 @@ export CPLUS_INCLUDE_PATH="$RISCV/include"
# Set VERILATOR_INSTALL_DIR to 'NO' to skip installation and checks
# of Verilator (useful for CI jobs not depending on Verilator in any way).
if [ "$VERILATOR_INSTALL_DIR" != "NO" ]; then
cva6/regress/install-verilator.sh
source cva6/regress/install-verilator.sh

# Complain if the installation directory of Verilator still is not set
# after running the installer.
if [ -z "$VERILATOR_INSTALL_DIR" ]; then
echo "Error: VERILATOR_INSTALL_DIR variable still undefined after running Verilator installer."
return
exit
fi

# Verilator was set up: add Verilator paths to appropriate variables.
export PATH="$VERILATOR_INSTALL_DIR/bin:$PATH"
export C_INCLUDE_PATH="$VERILATOR_INSTALL_DIR/share/verilator/include:$C_INCLUDE_PATH"
export CPLUS_INCLUDE_PATH="$VERILATOR_INSTALL_DIR/share/verilator/include:$CPLUS_INCLUDE_PATH"

# Check proper Verilator installation given current $PATH.
echo PATH=\"$PATH\"
echo "Verilator version:"
verilator --version || { echo "Error: Verilator not in \$PATH." ; return ; }
else
Expand All @@ -54,7 +64,7 @@ fi
export NUM_JOBS=24

# install the required tools for cva6
if ! [ -n "$CVA6_REPO" ]; then
if [ -z "$CVA6_REPO" ]; then
CVA6_REPO="https://github.com/openhwgroup/cva6.git"
CVA6_BRANCH="master"
CVA6_HASH="4f06aa620f75bcae369f05d0652283d45ef76a24"
Expand All @@ -67,16 +77,15 @@ echo $CVA6_PATCH

if ! [ -d core-v-cores/cva6 ]; then
git clone --recursive $CVA6_REPO -b $CVA6_BRANCH core-v-cores/cva6
cd core-v-cores/cva6; git checkout $CVA6_HASH;
git -C core-v-cores/cva6 checkout $CVA6_HASH
echo -n "Using CVA6 commit "; git describe --always HEAD
if [ -f ../$CVA6_PATCH ]; then
git apply ../$CVA6_PATCH
if [[ -n "$CVA6_PATCH" && -f "$CVA6_PATCH" ]]; then
git -C core-v-cores/cva6 apply "$CVA6_PATCH"
fi
cd -
fi

# install Spike
if ! [ -n "$SPIKE_ROOT" ]; then
if [ -z "$SPIKE_ROOT" ]; then
export SPIKE_ROOT=$TOP/spike/
fi
cva6/regress/install-spike.sh
source cva6/regress/install-spike.sh
4 changes: 2 additions & 2 deletions cva6/regress/install-riscv-compliance.sh
Expand Up @@ -22,9 +22,9 @@ mkdir -p cva6/tests
if ! [ -d cva6/tests/riscv-compliance ]; then
git clone $COMPLIANCE_REPO -b $COMPLIANCE_BRANCH cva6/tests/riscv-compliance
cd cva6/tests/riscv-compliance; git checkout $COMPLIANCE_HASH;
if [ -f "$COMPLIANCE_PATCH" ]; then
if [[ -n "$COMPLIANCE_PATCH" && -f "$COMPLIANCE_PATCH" ]]; then
echo "Applying patch $COMPLIANCE_PATCH in $PWD..."
git apply $COMPLIANCE_PATCH
git apply "$COMPLIANCE_PATCH"
fi
cd -
fi
14 changes: 7 additions & 7 deletions cva6/regress/install-riscv-dv.sh
Expand Up @@ -9,21 +9,21 @@

# riscv-dv env variables
export RISCV_TOOLCHAIN=$RISCV
if ! [ -n "$RISCV_GCC" ]; then
if [ -z "$RISCV_GCC" ]; then
export RISCV_GCC="$RISCV_TOOLCHAIN/bin/riscv-none-elf-gcc"
fi
if ! [ -n "$RISCV_OBJCOPY" ]; then
if [ -z "$RISCV_OBJCOPY" ]; then
export RISCV_OBJCOPY="$RISCV_TOOLCHAIN/bin/riscv-none-elf-objcopy"
fi
export SPIKE_PATH=$SPIKE_ROOT/bin
export RTL_PATH=$ROOT_PROJECT/core-v-cores/cva6
export TB_PATH=$ROOT_PROJECT/cva6/tb/core
export TESTS_PATH=$ROOT_PROJECT/cva6/tests

if ! [ -n "$DV_REPO" ]; then
if [ -z "$DV_REPO" ]; then
export DV_REPO="https://github.com/google/riscv-dv.git"
export DV_BRANCH=master
export DV_HASH=96c1ee6f371f2754c45b4831fcab95f6671689d9
export DV_BRANCH="master"
export DV_HASH="96c1ee6f371f2754c45b4831fcab95f6671689d9"
export DV_PATCH=
fi
echo "Repo: " $DV_REPO
Expand All @@ -35,8 +35,8 @@ mkdir -p cva6/sim
if ! [ -d cva6/sim/dv ]; then
git clone $DV_REPO -b $DV_BRANCH cva6/sim/dv
cd cva6/sim/dv; git checkout $DV_HASH;
if [ -f "$DV_PATCH" ]; then
git apply $DV_PATCH
if [[ -n "$DV_PATCH" && -f "$DV_PATCH" ]]; then
git apply "$DV_PATCH"
fi
cd -
# install riscv-dv dependencies
Expand Down
6 changes: 3 additions & 3 deletions cva6/regress/install-verilator.sh
Expand Up @@ -7,7 +7,7 @@
#
# Original Author: Jean-Roch COULON - Thales

if [ -z ${NUM_JOBS} ]; then
if [ -z "$NUM_JOBS" ]; then
NUM_JOBS=1
fi

Expand Down Expand Up @@ -39,7 +39,7 @@ fi
# Continuous Integration may need to override this particular variable
# to use a preinstalled build of Verilator.
if [ -z "$VERILATOR_INSTALL_DIR" ]; then
export VERILATOR_INSTALL_DIR=$(dirname ${VERILATOR_BUILD_DIR})
export VERILATOR_INSTALL_DIR="$(dirname $VERILATOR_BUILD_DIR)"
fi

# Build and install Verilator only if not already installed at the expected
Expand All @@ -58,7 +58,7 @@ if [ ! -f "$VERILATOR_INSTALL_DIR/bin/verilator" ]; then
# to preserve user content - let git fail instead.
[ -d .git ] || git clone $VERILATOR_REPO -b $VERILATOR_BRANCH .
git checkout $VERILATOR_HASH
if [ ! -z "$VERILATOR_PATCH" ] ; then
if [[ -n "$VERILATOR_PATCH" && -f "$VERILATOR_PATCH" ]] ; then
git apply $VERILATOR_PATCH || true
fi
# Generate the config script and configure Verilator.
Expand Down
2 changes: 1 addition & 1 deletion cva6/regress/smoke-tests.sh
Expand Up @@ -10,7 +10,7 @@
# where are the tools
if ! [ -n "$RISCV" ]; then
echo "Error: RISCV variable undefined"
return
exit
fi

# install the required tools
Expand Down
4 changes: 2 additions & 2 deletions cva6/sim/Makefile
Expand Up @@ -110,15 +110,15 @@ spike:
vcs-testharness:
make -C $(path_var) vcs_build target=$(target) defines=$(subst +define+,,$(isscomp_opts))
$(path_var)/work-vcs/simv $(if $(VERDI), -verdi -do $(path_var)/init_testharness.do,) +permissive -sv_lib $(path_var)/work-dpi/ariane_dpi \
+tohost_addr=$(shell $$RISCV/bin/riscv-none-elf-nm -B $(elf) | grep -w tohost | cut -d' ' -f1) \
+tohost_addr=$(shell $$RISCV/bin/${CV_SW_PREFIX}nm -B $(elf) | grep -w tohost | cut -d' ' -f1) \
+PRELOAD=$(elf) +permissive-off ++$(elf) $(issrun_opts)
$(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) +PRELOAD=$(elf) \
+tohost_addr=$(shell $$RISCV/bin/riscv-none-elf-nm -B $(elf) | grep -w tohost | cut -d' ' -f1)
+tohost_addr=$(shell $$RISCV/bin/${CV_SW_PREFIX}nm -B $(elf) | grep -w tohost | cut -d' ' -f1)
$(tool_path)/spike-dasm --isa=$(variant) < ./trace_rvfi_hart_00.dasm > $(log)
# If present, move default trace files to per-test directory.
[ ! -f verilator.fst ] || mv verilator.fst `dirname $(log)`/`basename $(log) .log`.$(target).fst
Expand Down

0 comments on commit 8604bab

Please sign in to comment.