-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathsourceme
66 lines (53 loc) · 2.12 KB
/
sourceme
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
echo "========================================================"
echo " RISC-V Atom Environment Setup"
echo "========================================================"
VERILATOR_REQUIRED_VERSION="5.034"
RVPREFIX="riscv64-unknown-elf"
# Uncomment if using environment modules
# module load verilator
# module load riscv64-multilib
# module load openfpgaloader
# RVATOM variable: points to root of riscv-atom directory (get dir containing this sourceme file)
export RVATOM=$(dirname -- "$(readlink -f "${BASH_SOURCE}")")
n_errors=0
# VERILATOR_PATH: points to verilator installation
if command -v "verilator" &>/dev/null; then
# get verilator path
VLP=$(dirname $(dirname `which verilator`))
echo " - Found Verilator at: $VLP"
export VERILATOR_PATH=$VLP
else
echo " ERROR: Verilator not found; please install verilator"
n_errors=$((n_errors + 1))
fi
# Check verilator version is >= 5.034
if [[ $(verilator --version | awk '{print $2}') < "$VERILATOR_REQUIRED_VERSION" ]]; then
echo " ERROR: Verilator version >= $VERILATOR_REQUIRED_VERSION is required"
echo " Please update your verilator installation"
n_errors=$((n_errors + 1))
fi
# Check if riscv64-unknown-elf-gcc is in path
if command -v "$RVPREFIX-gcc" &>/dev/null; then
RVP=$(dirname $(dirname `which $RVPREFIX-gcc`))
echo " - Found RISCV toolchain at: $RVP"
else
echo " ERROR: $RVPREFIX-gcc not found; please install riscv toolchain"
n_errors=$((n_errors + 1))
fi
# export RVATOM_LIB variable
export RVATOM_LIB="$RVATOM/sw/lib"
# add atomsim to PATH ($RVATOM/sim/build/bin)
export PATH="$RVATOM/sim/build/bin:$PATH"
# add elfdump to path ($RVATOM/tools/elfdump/bin)
export PATH="$RVATOM/tools/elfdump/bin:$PATH"
# add $RVATOM/scripts to path
export PATH="$RVATOM/scripts:$PATH"
echo " RVATOM_PATH: $RVATOM"
echo " VERILATOR_PATH: $VERILATOR_PATH"
echo " RISCV_TOOLCHAIN_PATH: $(dirname $(dirname `which riscv64-unknown-elf-gcc`))"
echo "========================================================"
if [[ $n_errors -eq 0 ]]; then
echo " Environment setup complete!"
else
echo " Environment setup failed with $n_errors errors"
fi