forked from openhwgroup/cvw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
68 lines (56 loc) · 1.89 KB
/
setup.sh
File metadata and controls
68 lines (56 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# setup.sh
# David_Harris@hmc.edu and kekim@hmc.edu 1 December 2021
# jcarlin@hmc.edu 2025
# Set up tools for cvw
# optionally have .bashrc or .bash_profile source this file with
#if [ -f ~/cvw/setup.sh ]; then
# source ~/cvw/setup.sh
#fi
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
# Colors for terminal output
WARNING_COLOR='\033[93m'
FAIL_COLOR='\033[91m'
ENDC='\033[0m' # Reset to default color
echo "Executing Wally setup.sh"
# Path to RISC-V Tools
if [ -d /opt/riscv ]; then
export RISCV=/opt/riscv
elif [ -d ~/riscv ]; then
export RISCV=~/riscv
else
# set the $RISCV directory here and remove the subsequent two lines
# export RISCV=
echo -e "${FAIL_COLOR}\$RISCV directory not found. Checked /opt/riscv and ~/riscv. Edit setup.sh to point to your custom \$RISCV directory.${ENDC}"
return 1
fi
echo \$RISCV set to "${RISCV}"
# Path to Wally repository
WALLY=$(dirname "${BASH_SOURCE[0]:-$0}")
WALLY=$(cd "$WALLY" && pwd)
export WALLY
echo \$WALLY set to "${WALLY}"
# utility functions in Wally repository
export PATH=$WALLY/bin:$PATH
# Setup cvw-arch-verif paths
if [ -e "${WALLY}"/addins/cvw-arch-verif/setup.sh ]; then
source "${WALLY}"/addins/cvw-arch-verif/setup.sh
else
echo -e "${WARNING_COLOR}setup.sh not found in \$WALLY/addins/cvw-arch-verif directory. Make sure you cloned the submodules.${ENDC}"
fi
# Verilator needs a larger core file size to simulate CORE-V Wally
ulimit -c 300000
# load site licenses and tool locations
if [ -e "${RISCV}"/site-setup.sh ]; then
source "${RISCV}"/site-setup.sh
else
echo -e "${FAIL_COLOR}site-setup.sh not found in \$RISCV directory. Rerun wally-toolchain-install.sh to automatically download it.${ENDC}"
return 1
fi
if [ ! -e "${WALLY}/.git/hooks/pre-commit" ]; then
pushd "${WALLY}" || return 1
echo "Installing pre-commit hooks"
pre-commit install
popd || return
fi
echo "setup done"