Repository navigation
Expand file tree
/
Copy pathsetup_macos.sh
More file actions
125 lines (107 loc) · 4.61 KB
/
Copy pathsetup_macos.sh
File metadata and controls
125 lines (107 loc) · 4.61 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
#!/bin/bash
# =============================================================================
# Open-Source EDA Flow — macOS Setup Script
# =============================================================================
# Installs: Yosys, Verilator, sv2v, GTKWave, and OpenSTA (built from source)
# Requires: Homebrew (https://brew.sh)
# =============================================================================
set -e
BOLD='\033[1m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
info() { echo -e "${BOLD}[INFO]${NC} $1"; }
success() { echo -e "${GREEN}[OK]${NC} $1"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
error() { echo -e "${RED}[ERR]${NC} $1"; exit 1; }
# -----------------------------------------------------------------------------
# 1. Preflight checks
# -----------------------------------------------------------------------------
info "Checking for Homebrew..."
if ! command -v brew &> /dev/null; then
error "Homebrew not found. Install it first: https://brew.sh"
fi
success "Homebrew found at $(which brew)"
# -----------------------------------------------------------------------------
# 2. Homebrew dependencies
# -----------------------------------------------------------------------------
info "Installing Homebrew dependencies from Brewfile..."
brew bundle --file=Brewfile
success "Homebrew dependencies installed."
# -----------------------------------------------------------------------------
# 3. Sky130 standard cell liberty library
# -----------------------------------------------------------------------------
LIB_FILE="sky130_fd_sc_hd__tt_025C_1v80.lib"
info "Checking for Sky130 liberty library..."
if [ ! -f "$LIB_FILE" ]; then
info "Downloading Sky130 liberty library..."
wget -q --show-progress \
https://raw.githubusercontent.com/shariethernet/RTL-design-using-Verilog-with-SKY130-Technology/main/my_lib/lib/sky130_fd_sc_hd__tt_025C_1v80.lib
success "Sky130 library downloaded."
else
success "Sky130 library already present."
fi
# -----------------------------------------------------------------------------
# 4. OpenSTA (built from source — no Homebrew formula exists)
# -----------------------------------------------------------------------------
info "Checking for OpenSTA..."
if command -v sta &> /dev/null; then
success "OpenSTA already installed at $(which sta)."
else
info "Building OpenSTA from source (this takes a few minutes)..."
rm -rf /tmp/OpenSTA_build
git clone --recursive https://github.com/The-OpenROAD-Project/OpenSTA.git /tmp/OpenSTA_build
mkdir -p /tmp/OpenSTA_build/build
cd /tmp/OpenSTA_build/build
# Auto-detect TCL paths from Homebrew
TCL_PREFIX="$(brew --prefix tcl-tk)"
TCL_INC="$(find "${TCL_PREFIX}/include" -name "tcl.h" | head -n 1 | xargs dirname)"
TCL_LIB="$(ls "${TCL_PREFIX}/lib/libtcl"*.dylib | head -n 1)"
if [ -z "$TCL_INC" ] || [ -z "$TCL_LIB" ]; then
error "Could not locate TCL headers/libs under $(brew --prefix tcl-tk). Try: brew reinstall tcl-tk"
fi
cmake .. \
-DCMAKE_PREFIX_PATH="$(brew --prefix tcl-tk);$(brew --prefix eigen);$(brew --prefix googletest);$(brew --prefix cudd)" \
-DFLEX_EXECUTABLE="$(brew --prefix flex)/bin/flex" \
-DFLEX_INCLUDE_DIR="$(brew --prefix flex)/include" \
-DBISON_EXECUTABLE="$(brew --prefix bison)/bin/bison" \
-DTCL_LIBRARY="${TCL_LIB}" \
-DTCL_HEADER="${TCL_INC}/tcl.h"
make -j"$(sysctl -n hw.ncpu)"
sudo make install
cd -
rm -rf /tmp/OpenSTA_build
success "OpenSTA built and installed."
fi
# -----------------------------------------------------------------------------
# 5. Verification
# -----------------------------------------------------------------------------
info "Verifying installation..."
MISSING=()
for cmd in yosys verilator sv2v sta python3; do
if command -v "$cmd" &> /dev/null; then
success "$cmd → $(which $cmd)"
else
MISSING+=("$cmd")
warn "$cmd not found."
fi
done
# GTKWave is a .app bundle on macOS — check the app, not a CLI command
if [ -d "/Applications/GTKWave.app" ]; then
success "GTKWave → /Applications/GTKWave.app"
else
MISSING+=("gtkwave")
warn "GTKWave.app not found in /Applications."
fi
if [ ${#MISSING[@]} -ne 0 ]; then
echo ""
warn "The following tools were not found: ${MISSING[*]}"
warn "Review the output above for errors and re-run, or open an issue."
exit 1
fi
echo ""
echo -e "${GREEN}${BOLD}Setup complete!${NC}"
echo " Simulate: make <program>"
echo " Synthesize: make yosys_synth"
echo " Waveforms: open output/<program>.vcd -a /Applications/GTKWave.app"