2021-11-15 07:50:43 -06:00
|
|
|
# SPDX-FileCopyrightText: 2020 Efabless Corporation
|
2022-02-25 12:47:04 -06:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
2021-11-15 07:50:43 -06:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2022-08-15 04:28:54 -05:00
|
|
|
MAKEFLAGS+=--warn-undefined-variables
|
2021-11-15 07:50:43 -06:00
|
|
|
|
2022-10-10 06:51:05 -05:00
|
|
|
export OPENLANE_RUN_TAG ?= $(shell date '+%y_%m_%d_%H_%M')
|
2022-04-13 14:38:06 -05:00
|
|
|
OPENLANE_TAG ?= 2021.11.23_01.42.34
|
2021-11-15 07:50:43 -06:00
|
|
|
OPENLANE_IMAGE_NAME ?= efabless/openlane:$(OPENLANE_TAG)
|
2022-10-10 06:51:05 -05:00
|
|
|
IT_SCRIPT ?= ./interactive.tcl
|
2022-08-15 04:28:54 -05:00
|
|
|
designs = $(shell find * -maxdepth 0 -type d)
|
|
|
|
current_design = null
|
2021-11-15 07:50:43 -06:00
|
|
|
|
2022-08-15 04:28:54 -05:00
|
|
|
openlane_cmd = \
|
|
|
|
"flow.tcl \
|
|
|
|
-design $$(realpath ./$*) \
|
|
|
|
-save_path $$(realpath ..) \
|
|
|
|
-save \
|
2022-10-10 06:51:05 -05:00
|
|
|
-OPENLANE_RUN_TAG $(OPENLAN_RUN_TAG) \
|
|
|
|
-verbose 1 \
|
2022-08-15 04:28:54 -05:00
|
|
|
-overwrite"
|
2022-10-10 06:51:05 -05:00
|
|
|
openlane_cmd_interactive = "flow.tcl -ignore_mismatches -it -file $$(realpath ./$*/$(IT_SCRIPT))"
|
|
|
|
openlane_cmd_regression = "cd /openlane && ./run_designs.py \
|
|
|
|
--regression $$(realpath ./$*/regression.config) \
|
|
|
|
--threads 6 \
|
|
|
|
$$(realpath ./$*)"
|
2021-11-15 07:50:43 -06:00
|
|
|
|
2022-08-15 04:28:54 -05:00
|
|
|
docker_mounts = \
|
|
|
|
-v $$(realpath $(PWD)/..):$$(realpath $(PWD)/..) \
|
|
|
|
-v $(PDK_ROOT):$(PDK_ROOT) \
|
|
|
|
-v $(CARAVEL_ROOT):$(CARAVEL_ROOT) \
|
|
|
|
-v $(PWD):$(PWD) \
|
2022-09-27 09:09:26 -05:00
|
|
|
-v $(HOME):$(HOME)
|
2021-11-15 07:50:43 -06:00
|
|
|
|
2022-08-15 04:28:54 -05:00
|
|
|
docker_env = \
|
|
|
|
-e PDK_ROOT=$(PDK_ROOT) \
|
|
|
|
-e PDK=$(PDK) \
|
|
|
|
-e MISMATCHES_OK=1 \
|
|
|
|
-e CARAVEL_ROOT=$(CARAVEL_ROOT) \
|
|
|
|
-e OPENLANE_RUN_TAG=$(OPENLANE_RUN_TAG) \
|
|
|
|
-w $(PWD)
|
|
|
|
|
2022-10-10 06:51:05 -05:00
|
|
|
ifneq ($(OPENLANE_ROOT),)
|
|
|
|
$(info openlane $(OPENLANE_ROOT))
|
|
|
|
docker_mounts += -v $(OPENLANE_ROOT):/openlane
|
|
|
|
docker_mounts += -v $(OPENLANE_ROOT):/openLANE_flow
|
|
|
|
endif
|
|
|
|
|
2022-08-15 04:28:54 -05:00
|
|
|
ifneq ($(MCW_ROOT),)
|
|
|
|
docker_env += -e MCW_ROOT=$(MCW_ROOT)
|
|
|
|
docker_mounts += -v $(MCW_ROOT):$(MCW_ROOT)
|
2021-11-15 07:50:43 -06:00
|
|
|
endif
|
|
|
|
|
2022-08-15 04:28:54 -05:00
|
|
|
docker_startup_mode = $(shell test -t 0 && echo "-it" || echo "--rm" )
|
|
|
|
docker_run = \
|
|
|
|
docker run $(docker_startup_mode) \
|
|
|
|
$(docker_mounts) \
|
|
|
|
$(docker_env) \
|
|
|
|
-u $(shell id -u $(USER)):$(shell id -g $(USER))
|
|
|
|
|
|
|
|
list:
|
|
|
|
@echo $(designs)
|
|
|
|
|
2022-10-10 06:51:05 -05:00
|
|
|
regression-designs=$(designs:%=%-regression)
|
|
|
|
.PHONY: $(regression-designs)
|
|
|
|
$(regression-designs): %-regression: ./%/regression.config
|
|
|
|
$(docker_run) \
|
|
|
|
$(OPENLANE_IMAGE_NAME) sh -c $(openlane_cmd_regression)
|
|
|
|
|
|
|
|
|
2022-08-15 04:28:54 -05:00
|
|
|
.PHONY: $(designs)
|
|
|
|
$(designs) : % : ./%/config.tcl
|
2022-09-27 09:09:26 -05:00
|
|
|
ifneq (,$(wildcard ./$(MAKECMDGOALS)/interactive.tcl)))
|
|
|
|
$(docker_run) \
|
|
|
|
$(OPENLANE_IMAGE_NAME) sh -c $(openlane_cmd_interactive)
|
|
|
|
else
|
|
|
|
# $(MAKECMDGOALS)
|
2022-08-15 04:28:54 -05:00
|
|
|
mkdir -p ./$*/runs/$(OPENLANE_RUN_TAG)
|
|
|
|
rm -rf ./$*/runs/$*
|
|
|
|
ln -s $$(realpath ./$*/runs/$(OPENLANE_RUN_TAG)) ./$*/runs/$*
|
|
|
|
$(docker_run) \
|
|
|
|
$(OPENLANE_IMAGE_NAME) sh -c $(openlane_cmd)
|
|
|
|
endif
|
|
|
|
@mkdir -p ../signoff/$*/
|
2022-09-27 09:09:26 -05:00
|
|
|
@cp ./$*/runs/$(OPENLANE_RUN_TAG)/OPENLANE_VERSION ../signoff/$*/
|
|
|
|
@cp ./$*/runs/$(OPENLANE_RUN_TAG)/PDK_SOURCES ../signoff/$*/
|
|
|
|
@cp ./$*/runs/$(OPENLANE_RUN_TAG)/reports/*.csv ../signoff/$*/
|
2021-11-15 07:50:43 -06:00
|
|
|
|
|
|
|
.PHONY: openlane
|
2022-02-25 12:39:11 -06:00
|
|
|
openlane: check-openlane-env
|
|
|
|
if [ -d "$(OPENLANE_ROOT)" ]; then\
|
|
|
|
echo "Deleting exisiting $(OPENLANE_ROOT)" && \
|
|
|
|
rm -rf $(OPENLANE_ROOT) && sleep 2; \
|
2022-08-15 04:28:54 -05:00
|
|
|
fi
|
2021-11-15 07:50:43 -06:00
|
|
|
git clone https://github.com/The-OpenROAD-Project/OpenLane --branch=$(OPENLANE_TAG) --depth=1 $(OPENLANE_ROOT) && \
|
|
|
|
cd $(OPENLANE_ROOT) && \
|
2022-02-25 12:39:11 -06:00
|
|
|
export OPENLANE_IMAGE_NAME=efabless/openlane:$(OPENLANE_TAG) && \
|
2021-11-15 07:50:43 -06:00
|
|
|
export IMAGE_NAME=efabless/openlane:$(OPENLANE_TAG) && \
|
2022-02-03 12:10:53 -06:00
|
|
|
$(MAKE) pull-openlane
|
2021-11-15 07:50:43 -06:00
|
|
|
|
2022-02-25 12:39:11 -06:00
|
|
|
.PHONY: check-openlane-env
|
|
|
|
check-openlane-env:
|
|
|
|
ifeq ($(OPENLANE_ROOT),)
|
|
|
|
@echo "Please export OPENLANE_ROOT"
|
|
|
|
@exit 1
|
|
|
|
endif
|