-
Notifications
You must be signed in to change notification settings - Fork 374
/
Makefile
221 lines (180 loc) · 6.49 KB
/
Makefile
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# Copyright 2020-2022 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
PYTHON_BIN ?= python3
OPENLANE_DIR ?= $(shell pwd)
DOCKER_OPTIONS = $(shell $(PYTHON_BIN) ./env.py docker-config)
DOCKER_ARCH ?= $(shell $(PYTHON_BIN) ./docker/current_platform.py)
# Allow Configuring Memory Limits
ifneq (,$(DOCKER_SWAP)) # Set to -1 for unlimited
DOCKER_OPTIONS += --memory-swap=$(DOCKER_SWAP)
endif
ifneq (,$(DOCKER_MEMORY))
DOCKER_OPTIONS += --memory=$(DOCKER_MEMORY)
# To verify: cat /sys/fs/cgroup/memory/memory.limit_in_bytes inside the container
endif
# Allow using GUIs
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),Linux)
DOCKER_OPTIONS += -e DISPLAY=$(DISPLAY) -v /tmp/.X11-unix:/tmp/.X11-unix -v $(HOME)/.Xauthority:/.Xauthority --network host --security-opt seccomp=unconfined
ifneq ("$(wildcard $(HOME)/.openroad)","")
DOCKER_OPTIONS += -v $(HOME)/.openroad:/.openroad
endif
endif
THREADS ?= 1
ifneq (,$(ROUTING_CORES))
DOCKER_OPTIONS += -e ROUTING_CORES=$(ROUTING_CORES)
endif
include ./dependencies/image_name.mk
TEST_DESIGN ?= spm
DESIGN_LIST ?= spm
QUICK_RUN_DESIGN ?= spm
BENCHMARK ?= regression_results/benchmark_results/sky130A/sky130_fd_sc_hd.csv
REGRESSION_TAG ?= TEST_SW_HD
FASTEST_TEST_SET_TAG ?= FASTEST_TEST_SET
EXTENDED_TEST_SET_TAG ?= EXTENDED_TEST_SET
PRINT_REM_DESIGNS_TIME ?= 0
OPEN_PDKS_COMMIT ?= $(shell $(PYTHON_BIN) ./dependencies/tool.py open_pdks -f commit)
export PDK_ROOT ?= $(HOME)/.volare
export PDK_ROOT := $(shell $(PYTHON_BIN) -c "import os; print(os.path.realpath('$(PDK_ROOT)'), end='')")
PDK_OPTS = -v $(PDK_ROOT):$(PDK_ROOT) -e PDK_ROOT=$(PDK_ROOT)
export PDK ?= sky130A
ifeq ($(PDK),sky130A)
PDK_FAMILY = sky130
endif
ifeq ($(PDK),sky130B)
PDK_FAMILY = sky130
endif
ifeq ($(PDK),gf180mcuA)
PDK_FAMILY = gf180mcu
endif
ifeq ($(PDK),gf180mcuB)
PDK_FAMILY = gf180mcu
endif
ifeq ($(PDK),gf180mcuC)
PDK_FAMILY = gf180mcu
endif
PDK_OPTS += -e PDK=$(PDK)
ifneq ($(STD_CELL_LIBRARY),)
export STD_CELL_LIBRARY ?= sky130_fd_sc_hd
PDK_OPTS += -e STD_CELL_LIBRARY=$(STD_CELL_LIBRARY)
endif
_FAKE_VARIABLE_TO_FORCE_MKDIR := $(shell mkdir -p ./empty)
ENV_MOUNT = \
-v $(OPENLANE_DIR):/openlane\
-v $(PWD)/empty:/openlane/install
ifeq ($(MAKECMDGOALS), m)
ENV_MOUNT = \
-v $(OPENLANE_DIR):$(OPENLANE_DIR)\
-v $(PWD)/empty:$(OPENLANE_DIR)/install\
-w $(OPENLANE_DIR)
endif
ENV_START := docker run --rm\
-v $(HOME):$(HOME)\
$(ENV_MOUNT)\
$(PDK_OPTS)\
$(STD_CELL_OPTS)\
$(DOCKER_OPTIONS)
ENV_COMMAND = $(ENV_START) $(OPENLANE_IMAGE_NAME)-$(DOCKER_ARCH)
.DEFAULT_GOAL := all
.PHONY: all
all: get-openlane pdk
.PHONY: openlane
openlane:
@$(MAKE) -C docker openlane
docker tag efabless/openlane:current-$(DOCKER_ARCH) $(OPENLANE_IMAGE_NAME)-$(DOCKER_ARCH)
.PHONY: openlane-and-push-tools
openlane-and-push-tools: venv/created
@PYTHON_BIN=$(PWD)/venv/bin/$(PYTHON_BIN) BUILD_IF_CANT_PULL=1 BUILD_IF_CANT_PULL_THEN_PUSH=1 $(MAKE) -C docker openlane
pull-openlane:
@docker pull "$(OPENLANE_IMAGE_NAME)"
get-openlane:
@$(MAKE) pull-openlane || $(MAKE) openlane
.PHONY: m
m:
cd $(OPENLANE_DIR) && \
$(ENV_START) -ti $(OPENLANE_IMAGE_NAME)-$(DOCKER_ARCH)
.PHONY: mount
mount:
cd $(OPENLANE_DIR) && \
$(ENV_START) -ti $(OPENLANE_IMAGE_NAME)-$(DOCKER_ARCH)
.PHONY: pdk
pdk: venv/created
PYTHONPATH= ./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir 'volare>=0.12.3'
./venv/bin/volare enable --pdk $(PDK_FAMILY)
.PHONY: survey
survey:
$(PYTHON_BIN) ./env.py issue-survey
.PHONY: lint
lint: venv/created
./venv/bin/black --check .
./venv/bin/flake8 .
.PHONY: docs
docs: venv/created
$(MAKE) -C docs install
$(MAKE) -C docs html
.PHONY: start-build-env
start-build-env: venv/created
bash -c "bash --rcfile <(cat ~/.bashrc ./venv/bin/activate)"
venv: venv/created
venv/created: ./requirements.txt ./requirements_dev.txt ./requirements_lint.txt ./dependencies/python/precompile_time.txt
rm -rf ./venv
$(PYTHON_BIN) -m venv ./venv
PYTHONPATH= ./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir pip
PYTHONPATH= ./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir -r ./requirements_dev.txt
touch $@
DLTAG=custom_design_List
.PHONY: test_design_list fastest_test_set extended_test_set
fastest_test_set: DESIGN_LIST=$(shell python3 ./.github/test_sets/get_test_matrix.py --plain --scl $(PDK)/$(STD_CELL_LIBRARY) fastest_test_set)
fastest_test_set: DLTAG=$(FASTEST_TEST_SET_TAG)
fastest_test_set: test_design_list
extended_test_set: DESIGN_LIST=$(shell python3 ./.github/test_sets/get_test_matrix.py --plain --scl $(PDK)/$(STD_CELL_LIBRARY) extended_test_set)
extended_test_set: DLTAG=$(EXTENDED_TEST_SET_TAG)
extended_test_set: test_design_list
test_design_list:
cd $(OPENLANE_DIR) && \
$(ENV_COMMAND) sh -c "\
python3 run_designs.py\
--tag $(DLTAG)\
--threads $(THREADS)\
--print_rem $(PRINT_REM_DESIGNS_TIME)\
--benchmark $(BENCHMARK)\
--config_file config\
$(DESIGN_LIST)\
"
# -u is needed, as the python buffers the stdout, so no output is generated
run_issue_regression:
cd $(OPENLANE_DIR) && \
$(ENV_COMMAND) sh -c "\
python3 -um tests run $(ISSUE_REGRESSION_DESIGN)"
issue_regression_all:
cd $(OPENLANE_DIR) && \
$(ENV_COMMAND) sh -c "\
python3 -um tests run_all"
.PHONY: test
test:
cd $(OPENLANE_DIR) && \
$(ENV_COMMAND) sh -c "./flow.tcl -design $(TEST_DESIGN) -tag openlane_test -overwrite"
@[ -f $(OPENLANE_DIR)/designs/$(TEST_DESIGN)/runs/openlane_test/results/signoff/$(TEST_DESIGN).gds ] && \
echo "Basic test passed" || \
echo "Basic test failed"
.PHONY: quick_run
quick_run:
cd $(OPENLANE_DIR) && \
$(ENV_COMMAND) sh -c "./flow.tcl -design $(QUICK_RUN_DESIGN)"
.PHONY: clean_runs clean_results
clean_runs:
@rm -rf ./designs/*/runs ./designs/ci/*/runs ./_build/it_tc_logs && echo "Runs cleaned successfully." || echo "Failed to delete runs."
@rm -rf ./tests/*/runs && echo "Test runs cleaned successfully." || echo "Failed to delete test runs."
clean_results:
@{ find regression_results -mindepth 1 -maxdepth 1 -type d | grep -v benchmark | xargs rm -rf ; } && echo "Results cleaned successfully." || echo "Failed to delete results."