Skip to content
This repository was archived by the owner on Aug 23, 2024. It is now read-only.

Commit cb36af1

Browse files
committed
Update build script to install tools
build_openroad.sh would previously just copy the build folder. Installing the tool to a local folder is cleaner.
1 parent e5dfdc7 commit cb36af1

10 files changed

+93
-94
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build working directories
2-
tools/build/
2+
tools/install/
33

44
# Test working directories
55
flow/results

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ RUN yum update -y \
88

99
WORKDIR /OpenROAD-flow-scripts
1010

11-
COPY --from=openroad/yosys /build ./tools/build/yosys
12-
COPY --from=openroad/centos7-builder-gcc /OpenROAD/build ./tools/build/OpenROAD
11+
COPY --from=openroad/yosys /install ./tools/install/yosys
12+
COPY --from=openroad/centos7-builder-gcc /OpenROAD/build/src/openroad ./tools/install/OpenROAD/bin/openroad
1313
COPY --from=openroad/centos7-builder-gcc /OpenROAD/etc/DependencyInstaller.sh /etc/DependencyInstaller.sh
1414
RUN /etc/DependencyInstaller.sh -runtime
1515
COPY --from=openroad/lsoracle /LSOracle/build/core/lsoracle ./tools/build/LSOracle/bin/lsoracle

build_openroad.sh

+17-17
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function usage() {
1414
echo " --or_branch BRANCH build using the head of branch BRANCH for OpenROAD"
1515
echo " --or_repo REPO-URL build using a fork at REPO-URL(https/ssh) for OpenROAD"
1616
echo " -n, --nice build using all cpus but nice the jobs"
17+
echo " --no_init Skip initializing submodules"
1718
echo " -c, --copy-platforms" copy platforms to inside docker image
1819

1920
echo "This script builds the openroad tools (OpenROAD, yosys)"
@@ -64,16 +65,16 @@ while (( "$#" )); do
6465
UPDATE_PLATFORM=1
6566
shift
6667
;;
67-
-n|--no_init)
68-
NO_INIT=1
68+
--no_init)
69+
OPENROAD_FLOW_NO_INIT=1
6970
shift
7071
;;
7172
-c|--copy-platforms)
7273
COPY_PLATFORMS="YES"
7374
shift
7475
;;
7576
-*|--*=) # unsupported flags
76-
echo "[ERROR][FLOW-1000] Unsupported flag $1" >&2
77+
echo "[ERROR][FLOW-0004] Unsupported flag $1" >&2
7778
exit 1
7879
;;
7980
*) # preserve positional arguments
@@ -85,10 +86,10 @@ done
8586

8687
# Choose install method
8788
if [ -z ${BUILD_METHOD+x} ] && which docker &> /dev/null; then
88-
echo "[INFO][FLOW-0000] using docker build method. This will create a docker image tagged '${DOCKER_TAG}'"
89+
echo "[INFO FLOW-0000] Using docker build method. This will create a docker image tagged '${DOCKER_TAG}'"
8990
build_method="DOCKER"
9091
else
91-
echo "[INFO][FLOW-0000] using local build method. This will create binaries at tools/build/"
92+
echo "[INFO FLOW-0000] Using local build method. This will create binaries at tools/install/"
9293
build_method="LOCAL"
9394
fi
9495

@@ -113,7 +114,7 @@ fi
113114

114115

115116
if [ ! -z ${UPDATE_OR+x} ]; then
116-
echo "updating OpenROAD tool to the latest"
117+
echo "[INFO FLOW-0005] Updating OpenROAD tool to the latest"
117118
(cd tools/OpenROAD && git fetch $CURRENT_REMOTE $OR_BRANCH \
118119
&& git checkout $CURRENT_REMOTE/$OR_BRANCH \
119120
&& git pull $CURRENT_REMOTE $OR_BRANCH \
@@ -124,21 +125,21 @@ fi
124125
if [ ! -z ${UPDATE_PLATFORM+x} ]; then
125126
for dir in flow/platforms/*/ ; do
126127
if [ -d $dir/.git ]; then
127-
echo "[INFO][FLOW-0001] updating git repository '$dir'"
128+
echo "[INFO FLOW-0001] Updating git repository '$dir'"
128129
(cd $dir && git pull)
129130
else
130-
echo "[INFO][FLOW-0002] directory '$dir' is not a git repository. Skipping update."
131+
echo "[INFO FLOW-0002] Directory '$dir' is not a git repository. Skipping update."
131132
fi
132133
done
133134
fi
134135

135136
# Update developer repos
136137
if [ ! -z ${UPDATE_PRIVATE+x} ]; then
137138
if [ -d flow/private ]; then
138-
echo "[INFO][FLOW-0001] updating git repository 'private'"
139+
echo "[INFO FLOW-0001] Updating git repository 'private'"
139140
(cd flow/private && git pull)
140141
else
141-
echo "[INFO][FLOW-0002] directory 'flow/private' is not a git repository. Skipping update."
142+
echo "[INFO FLOW-0002] Directory 'flow/private' is not a git repository. Skipping update."
142143
fi
143144
fi
144145

@@ -158,20 +159,19 @@ if [ "$build_method" == "DOCKER" ]; then
158159

159160
# Local build
160161
elif [ "$build_method" == "LOCAL" ]; then
161-
mkdir -p tools/build/yosys
162-
(cd tools/yosys && $NICE make install -j$PROC PREFIX=../build/yosys CONFIG=gcc)
162+
$NICE make install -C tools/yosys -j$PROC PREFIX=$(pwd)/tools/install/yosys CONFIG=gcc
163163

164-
mkdir -p tools/build/OpenROAD
165-
(cd tools/build/OpenROAD && cmake ../../OpenROAD && $NICE make -j$PROC)
164+
cmake -B tools/OpenROAD/build tools/OpenROAD -DCMAKE_INSTALL_PREFIX=tools/install/OpenROAD
165+
$NICE cmake --build tools/OpenROAD/build --target install -j$PROC
166166

167167
cmake -B tools/LSOracle/build tools/LSOracle \
168168
-D CMAKE_BUILD_TYPE=RELEASE \
169169
-D YOSYS_INCLUDE_DIR=$(pwd)/tools/yosys \
170170
-D YOSYS_PLUGIN=ON \
171-
-D YOSYS_SHARE_DIR=$(pwd)/tools/build/yosys/share/yosys \
172-
-D CMAKE_INSTALL_PREFIX=$(pwd)/tools/build/LSOracle
171+
-D YOSYS_SHARE_DIR=$(pwd)/tools/install/yosys/share/yosys \
172+
-D CMAKE_INSTALL_PREFIX=$(pwd)/tools/install/LSOracle
173173
$NICE cmake --build tools/LSOracle/build -j$PROC --target install
174174
else
175-
echo "ERROR: No valid build method found"
175+
echo "[ERROR FLOW-0003] No valid build method found"
176176
exit 1
177177
fi

flow/Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ export NUM_CORES := $(NPROC)
200200

201201
export LSORACLE_CMD ?= $(shell command -v lsoracle)
202202
ifeq ($(LSORACLE_CMD),)
203-
LSORACLE_CMD = $(abspath $(FLOW_HOME)/../tools/build/LSOracle/bin/lsoracle)
203+
LSORACLE_CMD = $(abspath $(FLOW_HOME)/../tools/install/LSOracle/bin/lsoracle)
204204
endif
205205

206-
LSORACLE_PLUGIN ?= $(abspath $(FLOW_HOME)/../tools/build/yosys/share/yosys/plugin/oracle.so)
207-
export LSORACLE_KAHYPAR_CONFIG ?= $(abspath $(FLOW_HOME)/../tools/build/LSOracle/share/lsoracle/test.ini)
206+
LSORACLE_PLUGIN ?= $(abspath $(FLOW_HOME)/../tools/install/yosys/share/yosys/plugin/oracle.so)
207+
export LSORACLE_KAHYPAR_CONFIG ?= $(abspath $(FLOW_HOME)/../tools/install/LSOracle/share/lsoracle/test.ini)
208208
ifneq ($(USE_LSORACLE),)
209209
YOSYS_FLAGS ?= -m $(LSORACLE_PLUGIN)
210210
endif
@@ -223,15 +223,15 @@ endif
223223
# 2 user explicity set with variable in Makefile or command line
224224
OPENROAD_EXE ?= $(shell command -v openroad)
225225
ifeq ($(OPENROAD_EXE),)
226-
OPENROAD_EXE = $(abspath $(FLOW_HOME)/../tools/build/OpenROAD/src/openroad)
226+
OPENROAD_EXE = $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/openroad)
227227
endif
228228
OPENROAD_ARGS = -no_init $(OR_ARGS)
229229
OPENROAD_CMD = $(OPENROAD_EXE) -exit $(OPENROAD_ARGS)
230230
OPENROAD_NO_EXIT_CMD = $(OPENROAD_EXE) $(OPENROAD_ARGS)
231231

232232
YOSYS_CMD ?= $(shell command -v yosys)
233233
ifeq ($(YOSYS_CMD),)
234-
YOSYS_CMD = $(abspath $(FLOW_HOME)/../tools/build/yosys/bin/yosys)
234+
YOSYS_CMD = $(abspath $(FLOW_HOME)/../tools/install/yosys/bin/yosys)
235235
endif
236236

237237
KLAYOUT_CMD ?= $(shell command -v klayout)

flow/scripts/write_ref_sdc.tcl

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ set margin 5
55

66
set clks [all_clocks]
77
if { [llength $clks] == 0 } {
8-
utl::warn "FLW" 1 "No clocks found."
8+
utl::warn "FLW" 6 "No clocks found."
99
} else {
1010
set clk [lindex $clks 0]
1111
set clk_name [get_name $clk]
1212
set period [get_property $clk "period"]
1313
# Period is in sdc/liberty units.
14-
utl::info "FLW" 2 "clock $clk_name period $period"
14+
utl::info "FLW" 7 "clock $clk_name period $period"
1515

1616
if { [llength $clks] == 1 } {
1717
set slack [sta::time_sta_ui [sta::worst_slack_cmd "max"]]
1818
set ref_period [expr ($period - $slack) * (1.0 - $margin/100.0)]
19-
utl::info "FLW" 3 "Clock $clk_name period [format %.3f $ref_period]"
20-
utl::info "FLW" 4 "Clock $clk_name slack [format %.3f $slack]"
19+
utl::info "FLW" 8 "Clock $clk_name period [format %.3f $ref_period]"
20+
utl::info "FLW" 9 "Clock $clk_name slack [format %.3f $slack]"
2121

2222
set sources [$clk sources]
2323
# Redefine clock with updated period.
@@ -26,8 +26,8 @@ if { [llength $clks] == 0 } {
2626
unset_propagated_clock [all_clocks]
2727
write_sdc [file join $env(RESULTS_DIR) "updated_clks.sdc"]
2828
} else {
29-
utl::warn "FLW" 5 "more than one clock found. Skipping sdc update."
29+
utl::warn "FLW" 10 "more than one clock found. Skipping sdc update."
3030
}
3131
}
3232

33-
utl::info "FLW" 6 "Path endpoint count [sta::endpoint_count]"
33+
utl::info "FLW" 11 "Path endpoint count [sta::endpoint_count]"

0 commit comments

Comments
 (0)