-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathopensource_eda_tool_install.sh
More file actions
executable file
·201 lines (168 loc) · 5.53 KB
/
opensource_eda_tool_install.sh
File metadata and controls
executable file
·201 lines (168 loc) · 5.53 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/usr/bin/env bash
set -euo pipefail
PREFIX="${PREFIX:-/usr/local}"
WORKDIR="${HOME}/work/tools"
MIN_FREE_MEM_MB=1200
MIN_SWAP_MB=2048
mkdir -p "$WORKDIR"
cd "$WORKDIR"
echo "========================================"
echo "System check"
echo "========================================"
source /etc/os-release || true
echo "OS: ${PRETTY_NAME:-Unknown}"
FREE_MEM_MB=$(free -m | awk '/^Mem:/ {print $7}')
TOTAL_MEM_MB=$(free -m | awk '/^Mem:/ {print $2}')
SWAP_MB=$(free -m | awk '/^Swap:/ {print $2}')
echo "Total RAM : ${TOTAL_MEM_MB} MB"
echo "Free RAM : ${FREE_MEM_MB} MB"
echo "Swap : ${SWAP_MB} MB"
if [ "$SWAP_MB" -lt "$MIN_SWAP_MB" ]; then
echo "Low swap detected. Creating 4G swapfile..."
if [ ! -f /swapfile ]; then
sudo fallocate -l 4G /swapfile || sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
if ! grep -q '^/swapfile ' /etc/fstab; then
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab >/dev/null
fi
else
sudo swapon /swapfile || true
fi
fi
FREE_MEM_MB=$(free -m | awk '/^Mem:/ {print $7}')
SWAP_MB=$(free -m | awk '/^Swap:/ {print $2}')
echo "After swap setup:"
echo "Free RAM : ${FREE_MEM_MB} MB"
echo "Swap : ${SWAP_MB} MB"
if [ "$TOTAL_MEM_MB" -le 4096 ]; then
JOBS=1
elif [ "$TOTAL_MEM_MB" -le 8192 ]; then
JOBS=2
else
JOBS=4
fi
echo "Build jobs set to: $JOBS"
if [ "$FREE_MEM_MB" -lt "$MIN_FREE_MEM_MB" ]; then
echo "ERROR: Free RAM is too low (${FREE_MEM_MB} MB)."
echo "Close host applications or increase VM memory before continuing."
exit 1
fi
echo "========================================"
echo "Installing packages"
echo "========================================"
sudo apt-get update
sudo apt-get install -y \
build-essential \
autoconf automake libtool cmake pkg-config \
bison flex gawk m4 \
git wget curl ca-certificates \
tcl tcl-dev tk tk-dev tcllib tclsh tcsh \
libx11-dev libxaw7-dev libreadline-dev \
libglu1-mesa-dev freeglut3-dev \
libffi-dev graphviz xdot \
python3 python3-pip python3-tk \
gsl-bin libgsl-dev \
swig \
yosys \
iverilog \
gtkwave
echo "========================================"
echo "Building GrayWolf"
echo "========================================"
rm -rf graywolf
git clone https://github.com/rubund/graywolf.git
cmake -S graywolf -B graywolf/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PREFIX"
cmake --build graywolf/build -j"$JOBS"
sudo cmake --install graywolf/build
echo "========================================"
echo "Building qrouter"
echo "========================================"
rm -rf qrouter
git clone https://github.com/RTimothyEdwards/qrouter.git
cd qrouter
./configure --prefix="$PREFIX"
make -j"$JOBS"
sudo make install
cd "$WORKDIR"
echo "========================================"
echo "Building Magic"
echo "========================================"
rm -rf magic
git clone https://github.com/RTimothyEdwards/magic.git
cd magic
./configure --prefix="$PREFIX"
make -j"$JOBS"
sudo make install
cd "$WORKDIR"
echo "========================================"
echo "Building Netgen"
echo "========================================"
rm -rf netgen
git clone https://github.com/RTimothyEdwards/netgen.git
cd netgen
./configure --prefix="$PREFIX"
make -j"$JOBS"
sudo make install
cd "$WORKDIR"
echo "========================================"
echo "Building qflow"
echo "========================================"
rm -rf qflow
git clone https://github.com/RTimothyEdwards/qflow.git
cd qflow
./configure --prefix="$PREFIX"
make -j"$JOBS"
sudo make install
cd "$WORKDIR"
echo "========================================"
echo "Building OpenSTA"
echo "========================================"
rm -rf OpenSTA
git clone https://github.com/The-OpenROAD-Project/OpenSTA.git
# Optional dependency for OpenSTA
if [ ! -d "$WORKDIR/cudd-3.0.0" ]; then
cd "$WORKDIR"
wget -O cudd-3.0.0.tar.gz https://github.com/ivmai/cudd/archive/refs/tags/cudd-3.0.0.tar.gz
tar -xzf cudd-3.0.0.tar.gz
mv cudd-cudd-3.0.0 cudd-3.0.0 2>/dev/null || true
cd cudd-3.0.0
./configure --prefix="$PREFIX"
make -j"$JOBS"
sudo make install
fi
cd "$WORKDIR/OpenSTA"
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DCUDD_DIR="$PREFIX"
cmake --build build -j"$JOBS"
sudo cmake --install build
cd "$WORKDIR"
echo "========================================"
echo "Building OpenTimer"
echo "========================================"
rm -rf OpenTimer
git clone https://github.com/OpenTimer/OpenTimer.git
cmake -S OpenTimer -B OpenTimer/build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_INSTALL_PREFIX="$PREFIX"
cmake --build OpenTimer/build -j"$JOBS"
sudo cmake --install OpenTimer/build
echo "========================================"
echo "Installed versions"
echo "========================================"
command -v yosys >/dev/null 2>&1 && yosys -V || true
command -v qrouter >/dev/null 2>&1 && qrouter -v 2>/dev/null || true
command -v magic >/dev/null 2>&1 && magic -version 2>/dev/null || true
command -v netgen >/dev/null 2>&1 && netgen -batch 2>/dev/null || true
command -v qflow >/dev/null 2>&1 && qflow -v 2>/dev/null || true
command -v sta >/dev/null 2>&1 && echo "OpenSTA installed" || true
command -v ot-shell >/dev/null 2>&1 && echo "OpenTimer installed" || true
command -v iverilog >/dev/null 2>&1 && iverilog -V | head -n 1 || true
command -v gtkwave >/dev/null 2>&1 && gtkwave --version | head -n 1 || true
echo "========================================"
echo "Done"
echo "========================================"