blob: aea51b8657e74005bc49fc3245c8e79377ea372e [file] [log] [blame]
dineshannayya62e46322022-02-15 14:19:56 +05301# SPDX-FileCopyrightText: 2020 Efabless Corporation
dineshannayya62e46322022-02-15 14:19:56 +05302# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13#
14# SPDX-License-Identifier: Apache-2.0
dineshannayya62e46322022-02-15 14:19:56 +053015#SHELL = sh -xv
dineshannayyaf4eb5d32022-05-12 18:47:09 +053016
dineshannayya62e46322022-02-15 14:19:56 +053017BLOCKS = $(shell find * -maxdepth 0 -type d)
18CONFIG = $(foreach block,$(BLOCKS), ./$(block)/config.tcl)
19CLEAN = $(foreach block,$(BLOCKS), clean-$(block))
20
dineshannayyaf4eb5d32022-05-12 18:47:09 +053021OPENLANE_TAG ?= mpw6
22OPENLANE_IMAGE_NAME ?= riscduino/openlane:$(OPENLANE_TAG)
23OPENLANE_BASIC_COMMAND = "cd $(PWD)/../openlane && flow.tcl -design ./$* -save_path .. -save -tag $* -overwrite"
24OPENLANE_INTERACTIVE_COMMAND = "cd $(PWD)/../openlane && flow.tcl -design ./$* -save_path .. -save -tag $* -overwrite -it -file ./$*/interactive.tcl"
dineshannayya62e46322022-02-15 14:19:56 +053025
26all: $(BLOCKS)
27
28$(CONFIG) :
29 @echo "Missing $@. Please create a configuration for that design"
30 @exit 1
31
dineshannayyaf4eb5d32022-05-12 18:47:09 +053032.PHONY: $(BLOCKS)
33$(BLOCKS) : % : ./%/config.tcl
34ifeq ($(OPENLANE_ROOT),)
35 @echo "Please export OPENLANE_ROOT"
36 @exit 1
37endif
38ifeq ($(PDK_ROOT),)
39 @echo "Please export PDK_ROOT"
40 @exit 1
41endif
dineshannayya62e46322022-02-15 14:19:56 +053042 @echo "###############################################"
43 @sleep 1
44
45 @if [ -f ./$*/interactive.tcl ]; then\
dineshannayyaf4eb5d32022-05-12 18:47:09 +053046 docker run --rm -v $(OPENLANE_ROOT):/openlane \
47 -v $(PDK_ROOT):$(PDK_ROOT) \
48 -v $(PWD)/..:$(PWD)/.. \
49 -v $(MCW_ROOT):$(MCW_ROOT) \
50 -v $(CARAVEL_ROOT):$(CARAVEL_ROOT) \
51 -e MCW_ROOT=$(MCW_ROOT) \
52 -e PDK_ROOT=$(PDK_ROOT) \
53 -e CARAVEL_ROOT=$(CARAVEL_ROOT) \
54 -e PDK=$(PDK) \
55 -e TEST_MISMATCHES=tools \
56 -e MISMATCHES_OK=1 \
dineshannayya62e46322022-02-15 14:19:56 +053057 -u $(shell id -u $(USER)):$(shell id -g $(USER)) \
58 $(OPENLANE_IMAGE_NAME) sh -c $(OPENLANE_INTERACTIVE_COMMAND);\
59 else\
dineshannayyaf4eb5d32022-05-12 18:47:09 +053060 docker run --rm -v $(OPENLANE_ROOT):/openlane \
61 -v $(PDK_ROOT):$(PDK_ROOT) \
62 -v $(PWD)/..:$(PWD)/.. \
63 -v $(CARAVEL_ROOT):$(CARAVEL_ROOT) \
64 -v $(MCW_ROOT):$(MCW_ROOT) \
65 -e MCW_ROOT=$(MCW_ROOT) \
66 -e PDK=$(PDK) \
67 -e PDK_ROOT=$(PDK_ROOT) \
68 -e CARAVEL_ROOT=$(CARAVEL_ROOT) \
69 -e TEST_MISMATCHES=tools \
70 -e MISMATCHES_OK=1 \
dineshannayya62e46322022-02-15 14:19:56 +053071 -u $(shell id -u $(USER)):$(shell id -g $(USER)) \
72 $(OPENLANE_IMAGE_NAME) sh -c $(OPENLANE_BASIC_COMMAND);\
73 fi
74 mkdir -p ../signoff/$*/
75 cp $*/runs/$*/OPENLANE_VERSION ../signoff/$*/
76 cp $*/runs/$*/PDK_SOURCES ../signoff/$*/
77 cp $*/runs/$*/reports/final_summary_report.csv ../signoff/$*/
78
dineshannayyaf4eb5d32022-05-12 18:47:09 +053079.PHONY: openlane
80openlane: check-openlane-env
81 if [ -d "$(OPENLANE_ROOT)" ]; then\
82 echo "Deleting exisiting $(OPENLANE_ROOT)" && \
83 rm -rf $(OPENLANE_ROOT) && sleep 2; \
84 fi
85 git clone https://github.com/The-OpenROAD-Project/OpenLane --branch=$(OPENLANE_TAG) --depth=1 $(OPENLANE_ROOT) && \
86 cd $(OPENLANE_ROOT) && \
87 export OPENLANE_IMAGE_NAME=efabless/openlane:$(OPENLANE_TAG) && \
88 export IMAGE_NAME=efabless/openlane:$(OPENLANE_TAG) && \
89 $(MAKE) pull-openlane
90
91.PHONY: check-openlane-env
92check-openlane-env:
93ifeq ($(OPENLANE_ROOT),)
94 @echo "Please export OPENLANE_ROOT"
95 @exit 1
96endif
97
dineshannayya62e46322022-02-15 14:19:56 +053098FORCE:
99
100clean:
101 @echo "Use clean_all to clean everything :)"
102
103clean_all: $(CLEAN)
104
105$(CLEAN): clean-% :
106 rm -rf runs/$*
107 rm -rf ../gds/$**
108 rm -rf ../mag/$**
109 rm -rf ../lef/$**