dineshannayya | 62e4632 | 2022-02-15 14:19:56 +0530 | [diff] [blame] | 1 | # SPDX-FileCopyrightText: 2020 Efabless Corporation |
dineshannayya | 62e4632 | 2022-02-15 14:19:56 +0530 | [diff] [blame] | 2 | # 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 |
dineshannayya | 62e4632 | 2022-02-15 14:19:56 +0530 | [diff] [blame] | 15 | #SHELL = sh -xv |
dineshannayya | f4eb5d3 | 2022-05-12 18:47:09 +0530 | [diff] [blame] | 16 | |
dineshannayya | 62e4632 | 2022-02-15 14:19:56 +0530 | [diff] [blame] | 17 | BLOCKS = $(shell find * -maxdepth 0 -type d) |
| 18 | CONFIG = $(foreach block,$(BLOCKS), ./$(block)/config.tcl) |
| 19 | CLEAN = $(foreach block,$(BLOCKS), clean-$(block)) |
| 20 | |
dineshannayya | f4eb5d3 | 2022-05-12 18:47:09 +0530 | [diff] [blame] | 21 | OPENLANE_TAG ?= mpw6 |
| 22 | OPENLANE_IMAGE_NAME ?= riscduino/openlane:$(OPENLANE_TAG) |
| 23 | OPENLANE_BASIC_COMMAND = "cd $(PWD)/../openlane && flow.tcl -design ./$* -save_path .. -save -tag $* -overwrite" |
| 24 | OPENLANE_INTERACTIVE_COMMAND = "cd $(PWD)/../openlane && flow.tcl -design ./$* -save_path .. -save -tag $* -overwrite -it -file ./$*/interactive.tcl" |
dineshannayya | 62e4632 | 2022-02-15 14:19:56 +0530 | [diff] [blame] | 25 | |
| 26 | all: $(BLOCKS) |
| 27 | |
| 28 | $(CONFIG) : |
| 29 | @echo "Missing $@. Please create a configuration for that design" |
| 30 | @exit 1 |
| 31 | |
dineshannayya | f4eb5d3 | 2022-05-12 18:47:09 +0530 | [diff] [blame] | 32 | .PHONY: $(BLOCKS) |
| 33 | $(BLOCKS) : % : ./%/config.tcl |
| 34 | ifeq ($(OPENLANE_ROOT),) |
| 35 | @echo "Please export OPENLANE_ROOT" |
| 36 | @exit 1 |
| 37 | endif |
| 38 | ifeq ($(PDK_ROOT),) |
| 39 | @echo "Please export PDK_ROOT" |
| 40 | @exit 1 |
| 41 | endif |
dineshannayya | 62e4632 | 2022-02-15 14:19:56 +0530 | [diff] [blame] | 42 | @echo "###############################################" |
| 43 | @sleep 1 |
| 44 | |
| 45 | @if [ -f ./$*/interactive.tcl ]; then\ |
dineshannayya | f4eb5d3 | 2022-05-12 18:47:09 +0530 | [diff] [blame] | 46 | 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 \ |
dineshannayya | 62e4632 | 2022-02-15 14:19:56 +0530 | [diff] [blame] | 57 | -u $(shell id -u $(USER)):$(shell id -g $(USER)) \ |
| 58 | $(OPENLANE_IMAGE_NAME) sh -c $(OPENLANE_INTERACTIVE_COMMAND);\ |
| 59 | else\ |
dineshannayya | f4eb5d3 | 2022-05-12 18:47:09 +0530 | [diff] [blame] | 60 | 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 \ |
dineshannayya | 62e4632 | 2022-02-15 14:19:56 +0530 | [diff] [blame] | 71 | -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 | |
dineshannayya | f4eb5d3 | 2022-05-12 18:47:09 +0530 | [diff] [blame] | 79 | .PHONY: openlane |
| 80 | openlane: 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 |
| 92 | check-openlane-env: |
| 93 | ifeq ($(OPENLANE_ROOT),) |
| 94 | @echo "Please export OPENLANE_ROOT" |
| 95 | @exit 1 |
| 96 | endif |
| 97 | |
dineshannayya | 62e4632 | 2022-02-15 14:19:56 +0530 | [diff] [blame] | 98 | FORCE: |
| 99 | |
| 100 | clean: |
| 101 | @echo "Use clean_all to clean everything :)" |
| 102 | |
| 103 | clean_all: $(CLEAN) |
| 104 | |
| 105 | $(CLEAN): clean-% : |
| 106 | rm -rf runs/$* |
| 107 | rm -rf ../gds/$** |
| 108 | rm -rf ../mag/$** |
| 109 | rm -rf ../lef/$** |