From d6644a743c8d522fd0437231ea20707badf9ce15 Mon Sep 17 00:00:00 2001 From: Jordan Carlin Date: Fri, 28 Jun 2024 15:02:16 -0700 Subject: [PATCH] Update setup scripts and automatically copy site-setup to $RISCV --- bin/wally-tool-chain-install-unified.sh | 19 +++++++++++++++++-- setup.sh | 25 ++++++++++++++----------- site-setup.sh | 21 +++++++++++---------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/bin/wally-tool-chain-install-unified.sh b/bin/wally-tool-chain-install-unified.sh index bbaa39a73..9a41af59a 100755 --- a/bin/wally-tool-chain-install-unified.sh +++ b/bin/wally-tool-chain-install-unified.sh @@ -70,7 +70,7 @@ is $PRETTY_NAME. The regular Ubuntu install will be attempted, but there may be fi else echo "The Wally install script is currently only compatible with Ubuntu and Red Hat family \ -(RHEL or Rocky Linux) distros. Your detected distro is $ID. You may try manually running the \ +(RHEL or Rocky Linux) distros. Your detected distro is $PRETTY_NAME. You may try manually running the \ commands in this script, but it is likely that some will need to be altered." exit 1 fi @@ -371,7 +371,7 @@ fi # riscof echo -e "\n*************************************************************************" echo -e "*************************************************************************" -echo -e "Installing riscof" +echo -e "Installing Riscof" echo -e "*************************************************************************" echo -e "*************************************************************************\n" pip3 install git+https://github.com/riscv/riscof.git @@ -388,3 +388,18 @@ if [[ ((! -e sky130_osu_sc_t12) && ($(git clone https://foss-eda-tools.googlesou cd sky130_osu_sc_t12 git reset --hard && git clean -f && git checkout main && git pull fi + +# site-setup script +echo -e "\n*************************************************************************" +echo -e "*************************************************************************" +echo -e "Downloading Site Setup Script" +echo -e "*************************************************************************" +echo -e "*************************************************************************\n" +cd "$RISCV" +if [ ! -e "${RISCV}"/site-setup.sh ]; then + wget https://raw.githubusercontent.com/openhwgroup/cvw/main/site-setup.sh + wget https://raw.githubusercontent.com/openhwgroup/cvw/main/site-setup.csh + if [ "$FAMILY" = rhel ]; then + echo "source /opt/rh/gcc-toolset-13/enable" >> site-setup.sh + fi +fi \ No newline at end of file diff --git a/setup.sh b/setup.sh index 656fed5a6..3531b2bce 100644 --- a/setup.sh +++ b/setup.sh @@ -14,23 +14,26 @@ echo "Executing Wally setup.sh" # Path to RISC-V Tools -export RISCV=/opt/riscv # change this if you installed the tools in a different location +if [ -e /opt/riscv ]; then + export RISCV=/opt/riscv +elif [ -e ~/riscv ]; then + export RISCV=~/riscv +else + # set the $RISCV directory here and remove the subsequent two lines + # export RISCV= + echo "\$RISCV directory not found. Checked /opt/riscv and ~/riscv. Edit setup.sh to point to your custom \$RISCV directory." + exit 1; +fi +echo \$RISCV set to "${RISCV}" # Path to Wally repository -WALLY=$(dirname ${BASH_SOURCE[0]:-$0}) +WALLY=$(dirname "${BASH_SOURCE[0]:-$0}") export WALLY=$(cd "$WALLY" && pwd) -echo \$WALLY set to ${WALLY} +echo \$WALLY set to "${WALLY}" # utility functions in Wally repository export PATH=$WALLY/bin:$PATH -# Verilator needs a larger stack to simulate CORE-V Wally -ulimit -c 234613 - # load site licenses and tool locations -if [ -f ${RISCV}/site-setup.sh ]; then - source ${RISCV}/site-setup.sh -else - source ${WALLY}/site-setup.sh -fi +source "${RISCV}"/site-setup.sh echo "setup done" diff --git a/site-setup.sh b/site-setup.sh index acda541aa..dbbd2775c 100755 --- a/site-setup.sh +++ b/site-setup.sh @@ -20,19 +20,22 @@ export VCS_HOME=/cad/synopsys/vcs/U-2023.03-SP2-4 # Change thi export PATH=$QUESTA_HOME/bin:$DC_HOME/bin:$VCS_HOME/bin:$PATH # GCC -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RISCV/riscv-gnu-toolchain/lib:$RISCV/riscv-gnu-toolchain/riscv64-unknown-elf/lib +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RISCV/riscv64-unknown-elf/lib -# Spike -export LD_LIBRARY_PATH=$RISCV/lib:$LD_LIBRARY_PATH +# RISC-V Tools +export LD_LIBRARY_PATH=$RISCV/lib:$RISCV/lib64:$LD_LIBRARY_PATH export PATH=$PATH:$RISCV/bin -# Verilator -export PATH=/usr/local/bin/verilator:$PATH # Change this for your path to Verilator +# Activate riscv-python Virtual Environment +source "$RISCV"/riscv-python/bin/activate # environment variables needed for RISCV-DV -export RISCV_GCC=`which riscv64-unknown-elf-gcc` # Copy this as it is -export RISCV_OBJCOPY=`which riscv64-unknown-elf-objcopy` # Copy this as it is -export SPIKE_PATH=/usr/bin # Change this for your path to riscv-isa-sim (spike) +export RISCV_GCC=$(which riscv64-unknown-elf-gcc) # Copy this as it is +export RISCV_OBJCOPY=$(which riscv64-unknown-elf-objcopy) # Copy this as it is +export SPIKE_PATH=$RISCV/bin # Change this for your path to riscv-isa-sim (spike) + +# Verilator needs a larger stack to simulate CORE-V Wally +ulimit -c 234613 # Imperas OVPsim; put this in if you are using it #export PATH=$RISCV/imperas-riscv-tests/riscv-ovpsim-plus/bin/Linux64:$PATH @@ -48,5 +51,3 @@ if [ -e "$IDV" ]; then setupImperas ${IMPERAS_HOME} export PATH=$IDV/scripts/cvw:$PATH fi - -