manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 1 | # SPDX-FileCopyrightText: 2020 Efabless Corporation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | # |
| 15 | # SPDX-License-Identifier: Apache-2.0 |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 16 | MAKEFLAGS+=--warn-undefined-variables |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 17 | |
kareem | d637b3e | 2022-07-06 08:19:47 -0700 | [diff] [blame] | 18 | export CARAVEL_ROOT?=$(PWD)/caravel |
manarabdelaty | 2632315 | 2021-09-16 23:11:34 +0200 | [diff] [blame] | 19 | PRECHECK_ROOT?=${HOME}/mpw_precheck |
jeffdi | 585ad26 | 2022-10-24 21:50:35 -0700 | [diff] [blame] | 20 | export MCW_ROOT?=$(PWD)/mgmt_core_wrapper |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 21 | SIM?=RTL |
| 22 | |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 23 | # Install lite version of caravel, (1): caravel-lite, (0): caravel |
| 24 | CARAVEL_LITE?=1 |
| 25 | |
Marwan Abbas | 0a55a1c | 2022-03-01 03:39:19 -0800 | [diff] [blame] | 26 | # PDK switch varient |
Kareem Farid | fb0bab4 | 2022-11-15 17:16:42 +0200 | [diff] [blame] | 27 | export PDK?=sky130A |
Jeff DiCorpo | fb0bd7f | 2022-10-27 23:01:14 -0700 | [diff] [blame] | 28 | #export PDK?=gf180mcuC |
Marwan Abbas | 45f9720 | 2022-07-01 16:26:21 +0200 | [diff] [blame] | 29 | export PDKPATH?=$(PDK_ROOT)/$(PDK) |
Marwan Abbas | 0a55a1c | 2022-03-01 03:39:19 -0800 | [diff] [blame] | 30 | |
jeffdi | f7a3d57 | 2022-10-12 08:45:05 -0700 | [diff] [blame] | 31 | |
Jeff DiCorpo | 5c041f1 | 2022-02-25 17:56:06 -0800 | [diff] [blame] | 32 | |
Jeff DiCorpo | 04ae05f | 2022-10-27 22:56:37 -0700 | [diff] [blame] | 33 | ifeq ($(PDK),sky130A) |
| 34 | SKYWATER_COMMIT=f70d8ca46961ff92719d8870a18a076370b85f6c |
| 35 | export OPEN_PDKS_COMMIT?=0059588eebfc704681dc2368bd1d33d96281d10f |
Jeff DiCorpo | 4dd8cd4 | 2022-11-19 16:55:39 -0800 | [diff] [blame] | 36 | export OPENLANE_TAG?=2022.11.19 |
Jeff DiCorpo | 4a37c74 | 2022-11-19 14:50:12 -0800 | [diff] [blame] | 37 | MPW_TAG ?= mpw-8a |
Jeff DiCorpo | 04ae05f | 2022-10-27 22:56:37 -0700 | [diff] [blame] | 38 | |
| 39 | ifeq ($(CARAVEL_LITE),1) |
| 40 | CARAVEL_NAME := caravel-lite |
| 41 | CARAVEL_REPO := https://github.com/efabless/caravel-lite |
| 42 | CARAVEL_TAG := $(MPW_TAG) |
| 43 | else |
| 44 | CARAVEL_NAME := caravel |
| 45 | CARAVEL_REPO := https://github.com/efabless/caravel |
| 46 | CARAVEL_TAG := $(MPW_TAG) |
| 47 | endif |
| 48 | |
Jeff DiCorpo | fb0bd7f | 2022-10-27 23:01:14 -0700 | [diff] [blame] | 49 | endif |
| 50 | |
jeffdi | f7a3d57 | 2022-10-12 08:45:05 -0700 | [diff] [blame] | 51 | ifeq ($(PDK),sky130B) |
| 52 | SKYWATER_COMMIT=f70d8ca46961ff92719d8870a18a076370b85f6c |
jeffdi | 2af30e6 | 2022-10-24 21:13:50 -0700 | [diff] [blame] | 53 | export OPEN_PDKS_COMMIT?=0059588eebfc704681dc2368bd1d33d96281d10f |
Jeff DiCorpo | 4dd8cd4 | 2022-11-19 16:55:39 -0800 | [diff] [blame] | 54 | export OPENLANE_TAG?=2022.11.19 |
Jeff DiCorpo | 4a37c74 | 2022-11-19 14:50:12 -0800 | [diff] [blame] | 55 | MPW_TAG ?= mpw-8a |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 56 | |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 57 | ifeq ($(CARAVEL_LITE),1) |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 58 | CARAVEL_NAME := caravel-lite |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 59 | CARAVEL_REPO := https://github.com/efabless/caravel-lite |
Jeff DiCorpo | 5c041f1 | 2022-02-25 17:56:06 -0800 | [diff] [blame] | 60 | CARAVEL_TAG := $(MPW_TAG) |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 61 | else |
| 62 | CARAVEL_NAME := caravel |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 63 | CARAVEL_REPO := https://github.com/efabless/caravel |
Jeff DiCorpo | 5c041f1 | 2022-02-25 17:56:06 -0800 | [diff] [blame] | 64 | CARAVEL_TAG := $(MPW_TAG) |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 65 | endif |
| 66 | |
Jeff DiCorpo | fb0bd7f | 2022-10-27 23:01:14 -0700 | [diff] [blame] | 67 | endif |
| 68 | |
| 69 | ifeq ($(PDK),gf180mcuC) |
jeffdi | 2d83d67 | 2022-10-12 13:45:59 -0700 | [diff] [blame] | 70 | |
jeffdi | 465b6eb | 2022-10-24 21:47:37 -0700 | [diff] [blame] | 71 | MPW_TAG ?= gfmpw-0a |
jeffdi | e308dde | 2022-10-24 19:21:52 -0700 | [diff] [blame] | 72 | CARAVEL_NAME := caravel |
| 73 | CARAVEL_REPO := https://github.com/efabless/caravel-gf180mcu |
| 74 | CARAVEL_TAG := $(MPW_TAG) |
| 75 | #OPENLANE_TAG=ddfeab57e3e8769ea3d40dda12be0460e09bb6d9 |
jeffdi | 2af30e6 | 2022-10-24 21:13:50 -0700 | [diff] [blame] | 76 | export OPEN_PDKS_COMMIT?=0059588eebfc704681dc2368bd1d33d96281d10f |
Jeff DiCorpo | 4dd8cd4 | 2022-11-19 16:55:39 -0800 | [diff] [blame] | 77 | export OPENLANE_TAG?=2022.11.19 |
jeffdi | 2d83d67 | 2022-10-12 13:45:59 -0700 | [diff] [blame] | 78 | |
jeffdi | f7a3d57 | 2022-10-12 08:45:05 -0700 | [diff] [blame] | 79 | endif |
| 80 | |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 81 | # Include Caravel Makefile Targets |
manarabdelaty | 2632315 | 2021-09-16 23:11:34 +0200 | [diff] [blame] | 82 | .PHONY: % : check-caravel |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 83 | %: |
manarabdelaty | 2632315 | 2021-09-16 23:11:34 +0200 | [diff] [blame] | 84 | export CARAVEL_ROOT=$(CARAVEL_ROOT) && $(MAKE) -f $(CARAVEL_ROOT)/Makefile $@ |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 85 | |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 86 | .PHONY: install |
| 87 | install: |
| 88 | if [ -d "$(CARAVEL_ROOT)" ]; then\ |
| 89 | echo "Deleting exisiting $(CARAVEL_ROOT)" && \ |
| 90 | rm -rf $(CARAVEL_ROOT) && sleep 2;\ |
| 91 | fi |
| 92 | echo "Installing $(CARAVEL_NAME).." |
| 93 | git clone -b $(CARAVEL_TAG) $(CARAVEL_REPO) $(CARAVEL_ROOT) --depth=1 |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 94 | |
manarabdelaty | 340cc4a | 2021-04-20 18:28:22 +0200 | [diff] [blame] | 95 | # Install DV setup |
| 96 | .PHONY: simenv |
| 97 | simenv: |
Marwan Abbas | bb25068 | 2022-07-06 09:43:59 +0200 | [diff] [blame] | 98 | docker pull efabless/dv:latest |
manarabdelaty | 340cc4a | 2021-04-20 18:28:22 +0200 | [diff] [blame] | 99 | |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 100 | .PHONY: setup |
Kareem Farid | d105f68 | 2022-11-15 18:07:26 +0200 | [diff] [blame] | 101 | setup: install check-env install_mcw openlane pdk-with-volare setup-timing-scripts |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 102 | |
| 103 | # Openlane |
| 104 | blocks=$(shell cd openlane && find * -maxdepth 0 -type d) |
| 105 | .PHONY: $(blocks) |
Kareem Farid | 0eb93ef | 2022-03-02 13:25:37 +0200 | [diff] [blame] | 106 | $(blocks): % : |
kareem | d637b3e | 2022-07-06 08:19:47 -0700 | [diff] [blame] | 107 | $(MAKE) -C openlane $* |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 108 | |
| 109 | dv_patterns=$(shell cd verilog/dv && find * -maxdepth 0 -type d) |
| 110 | dv-targets-rtl=$(dv_patterns:%=verify-%-rtl) |
| 111 | dv-targets-gl=$(dv_patterns:%=verify-%-gl) |
| 112 | dv-targets-gl-sdf=$(dv_patterns:%=verify-%-gl-sdf) |
| 113 | |
manarabdelaty | 340cc4a | 2021-04-20 18:28:22 +0200 | [diff] [blame] | 114 | TARGET_PATH=$(shell pwd) |
Marwan Abbas | 1105cc7 | 2022-03-17 10:01:30 -0700 | [diff] [blame] | 115 | verify_command="source ~/.bashrc && cd ${TARGET_PATH}/verilog/dv/$* && export SIM=${SIM} && make" |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 116 | dv_base_dependencies=simenv |
| 117 | docker_run_verify=\ |
manarabdelaty | b6ce442 | 2021-09-16 22:09:24 +0200 | [diff] [blame] | 118 | docker run -v ${TARGET_PATH}:${TARGET_PATH} -v ${PDK_ROOT}:${PDK_ROOT} \ |
kareem | ab6cfe1 | 2022-02-15 05:36:48 -0800 | [diff] [blame] | 119 | -v ${CARAVEL_ROOT}:${CARAVEL_ROOT} \ |
| 120 | -e TARGET_PATH=${TARGET_PATH} -e PDK_ROOT=${PDK_ROOT} \ |
| 121 | -e CARAVEL_ROOT=${CARAVEL_ROOT} \ |
Marwan Abbas | 1105cc7 | 2022-03-17 10:01:30 -0700 | [diff] [blame] | 122 | -e TOOLS=/foss/tools/riscv-gnu-toolchain-rv32i/217e7f3debe424d61374d31e33a091a630535937 \ |
kareem | ab6cfe1 | 2022-02-15 05:36:48 -0800 | [diff] [blame] | 123 | -e DESIGNS=$(TARGET_PATH) \ |
Jeff DiCorpo | fec2ae6 | 2022-10-27 22:21:22 -0700 | [diff] [blame] | 124 | -e USER_PROJECT_VERILOG=$(TARGET_PATH)/verilog \ |
Marwan Abbas | 1b16eff | 2022-03-02 09:21:34 -0800 | [diff] [blame] | 125 | -e PDK=$(PDK) \ |
Marwan Abbas | 6878870 | 2022-02-15 16:49:02 +0200 | [diff] [blame] | 126 | -e CORE_VERILOG_PATH=$(TARGET_PATH)/mgmt_core_wrapper/verilog \ |
Jeff DiCorpo | fec2ae6 | 2022-10-27 22:21:22 -0700 | [diff] [blame] | 127 | -e CARAVEL_VERILOG_PATH=$(TARGET_PATH)/caravel/verilog \ |
kareem | ab6cfe1 | 2022-02-15 05:36:48 -0800 | [diff] [blame] | 128 | -e MCW_ROOT=$(MCW_ROOT) \ |
Marwan Abbas | 1105cc7 | 2022-03-17 10:01:30 -0700 | [diff] [blame] | 129 | -u $$(id -u $$USER):$$(id -g $$USER) efabless/dv:latest \ |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 130 | sh -c $(verify_command) |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 131 | |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 132 | .PHONY: harden |
| 133 | harden: $(blocks) |
| 134 | |
| 135 | .PHONY: verify |
Jeff DiCorpo | 76e88e1 | 2022-03-19 14:12:29 -0700 | [diff] [blame] | 136 | verify: $(dv-targets-rtl) |
| 137 | |
Marwan Abbas | eda6099 | 2022-03-03 19:53:27 +0200 | [diff] [blame] | 138 | .PHONY: verify-all-rtl |
| 139 | verify-all-rtl: $(dv-targets-rtl) |
| 140 | |
| 141 | .PHONY: verify-all-gl |
| 142 | verify-all-gl: $(dv-targets-gl) |
| 143 | |
| 144 | .PHONY: verify-all-gl-sdf |
Marwan Abbas | 17c43a6 | 2022-03-03 21:11:51 +0200 | [diff] [blame] | 145 | verify-all-gl-sdf: $(dv-targets-gl-sdf) |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 146 | |
| 147 | $(dv-targets-rtl): SIM=RTL |
| 148 | $(dv-targets-rtl): verify-%-rtl: $(dv_base_dependencies) |
| 149 | $(docker_run_verify) |
| 150 | |
| 151 | $(dv-targets-gl): SIM=GL |
| 152 | $(dv-targets-gl): verify-%-gl: $(dv_base_dependencies) |
| 153 | $(docker_run_verify) |
| 154 | |
| 155 | $(dv-targets-gl-sdf): SIM=GL_SDF |
| 156 | $(dv-targets-gl-sdf): verify-%-gl-sdf: $(dv_base_dependencies) |
| 157 | $(docker_run_verify) |
| 158 | |
| 159 | clean-targets=$(blocks:%=clean-%) |
| 160 | .PHONY: $(clean-targets) |
| 161 | $(clean-targets): clean-% : |
| 162 | rm -f ./verilog/gl/$*.v |
| 163 | rm -f ./spef/$*.spef |
| 164 | rm -f ./sdc/$*.sdc |
| 165 | rm -f ./sdf/$*.sdf |
| 166 | rm -f ./gds/$*.gds |
| 167 | rm -f ./mag/$*.mag |
| 168 | rm -f ./lef/$*.lef |
| 169 | rm -f ./maglef/*.maglef |
| 170 | |
| 171 | make_what=setup $(blocks) $(dv-targets-rtl) $(dv-targets-gl) $(dv-targets-gl-sdf) $(clean-targets) |
| 172 | .PHONY: what |
| 173 | what: |
| 174 | # $(make_what) |
| 175 | |
| 176 | # Install Openlane |
| 177 | .PHONY: openlane |
| 178 | openlane: |
Kareem Farid | 13edb81 | 2022-06-08 13:03:08 +0200 | [diff] [blame] | 179 | @if [ "$$(realpath $${OPENLANE_ROOT})" = "$$(realpath $$(pwd)/openlane)" ]; then\ |
| 180 | echo "OPENLANE_ROOT is set to '$$(pwd)/openlane' which contains openlane config files"; \ |
| 181 | echo "Please set it to a different directory"; \ |
| 182 | exit 1; \ |
| 183 | fi |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 184 | cd openlane && $(MAKE) openlane |
| 185 | |
| 186 | #### Not sure if the targets following are of any use |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 187 | |
| 188 | # Create symbolic links to caravel's main files |
| 189 | .PHONY: simlink |
| 190 | simlink: check-caravel |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 191 | ### Symbolic links relative path to $CARAVEL_ROOT |
manarabdelaty | 78c1b01 | 2021-04-23 17:12:54 +0200 | [diff] [blame] | 192 | $(eval MAKEFILE_PATH := $(shell realpath --relative-to=openlane $(CARAVEL_ROOT)/openlane/Makefile)) |
| 193 | $(eval PIN_CFG_PATH := $(shell realpath --relative-to=openlane/user_project_wrapper $(CARAVEL_ROOT)/openlane/user_project_wrapper_empty/pin_order.cfg)) |
manarabdelaty | e542bdf | 2021-04-20 11:15:40 +0200 | [diff] [blame] | 194 | mkdir -p openlane |
| 195 | mkdir -p openlane/user_project_wrapper |
| 196 | cd openlane &&\ |
manarabdelaty | 78c1b01 | 2021-04-23 17:12:54 +0200 | [diff] [blame] | 197 | ln -sf $(MAKEFILE_PATH) Makefile |
manarabdelaty | e542bdf | 2021-04-20 11:15:40 +0200 | [diff] [blame] | 198 | cd openlane/user_project_wrapper &&\ |
manarabdelaty | 78c1b01 | 2021-04-23 17:12:54 +0200 | [diff] [blame] | 199 | ln -sf $(PIN_CFG_PATH) pin_order.cfg |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 200 | |
| 201 | # Update Caravel |
| 202 | .PHONY: update_caravel |
| 203 | update_caravel: check-caravel |
jeffdi | 298918f | 2021-12-16 11:15:44 -0800 | [diff] [blame] | 204 | cd $(CARAVEL_ROOT)/ && git checkout $(CARAVEL_TAG) && git pull |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 205 | |
| 206 | # Uninstall Caravel |
| 207 | .PHONY: uninstall |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 208 | uninstall: |
manarabdelaty | 78c1b01 | 2021-04-23 17:12:54 +0200 | [diff] [blame] | 209 | rm -rf $(CARAVEL_ROOT) |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 210 | |
manarabdelaty | 340cc4a | 2021-04-20 18:28:22 +0200 | [diff] [blame] | 211 | |
manarabdelaty | 78c1b01 | 2021-04-23 17:12:54 +0200 | [diff] [blame] | 212 | # Install Pre-check |
| 213 | # Default installs to the user home directory, override by "export PRECHECK_ROOT=<precheck-installation-path>" |
| 214 | .PHONY: precheck |
| 215 | precheck: |
Jeff DiCorpo | 9d5fd02 | 2022-03-19 11:01:27 -0700 | [diff] [blame] | 216 | @git clone --depth=1 --branch $(MPW_TAG) https://github.com/efabless/mpw_precheck.git $(PRECHECK_ROOT) |
manarabdelaty | b6ce442 | 2021-09-16 22:09:24 +0200 | [diff] [blame] | 217 | @docker pull efabless/mpw_precheck:latest |
manarabdelaty | 78c1b01 | 2021-04-23 17:12:54 +0200 | [diff] [blame] | 218 | |
| 219 | .PHONY: run-precheck |
Ahmed El Omla | 0abd161 | 2022-02-08 19:12:27 +0200 | [diff] [blame] | 220 | run-precheck: check-pdk check-precheck |
manarabdelaty | b6ce442 | 2021-09-16 22:09:24 +0200 | [diff] [blame] | 221 | $(eval INPUT_DIRECTORY := $(shell pwd)) |
manarabdelaty | 78c1b01 | 2021-04-23 17:12:54 +0200 | [diff] [blame] | 222 | cd $(PRECHECK_ROOT) && \ |
Marwan Abbas | d9bdb82 | 2022-04-16 10:34:40 -0700 | [diff] [blame] | 223 | docker run -v $(PRECHECK_ROOT):$(PRECHECK_ROOT) \ |
| 224 | -v $(INPUT_DIRECTORY):$(INPUT_DIRECTORY) \ |
| 225 | -v $(PDK_ROOT):$(PDK_ROOT) \ |
| 226 | -e INPUT_DIRECTORY=$(INPUT_DIRECTORY) \ |
Ahmed El Omla | 31cccd5 | 2022-07-01 12:35:45 +0200 | [diff] [blame] | 227 | -e PDK_PATH=$(PDK_ROOT)/$(PDK) \ |
Jeff DiCorpo | c069564 | 2022-07-08 06:41:16 -0700 | [diff] [blame] | 228 | -e PDK_ROOT=$(PDK_ROOT) \ |
Marwan Abbas | d9bdb82 | 2022-04-16 10:34:40 -0700 | [diff] [blame] | 229 | -e PDKPATH=$(PDKPATH) \ |
| 230 | -u $(shell id -u $(USER)):$(shell id -g $(USER)) \ |
Ahmed El Omla | 42a1546 | 2022-07-07 17:01:55 +0200 | [diff] [blame] | 231 | efabless/mpw_precheck:latest bash -c "cd $(PRECHECK_ROOT) ; python3 mpw_precheck.py --input_directory $(INPUT_DIRECTORY) --pdk_path $(PDK_ROOT)/$(PDK)" |
manarabdelaty | d8dd010 | 2021-04-30 08:40:52 +0200 | [diff] [blame] | 232 | |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 233 | |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 234 | |
kareem | 035ac3d | 2022-02-25 10:34:26 -0800 | [diff] [blame] | 235 | .PHONY: clean |
| 236 | clean: |
| 237 | cd ./verilog/dv/ && \ |
| 238 | $(MAKE) -j$(THREADS) clean |
| 239 | |
manarabdelaty | b41301c | 2021-04-19 23:30:35 +0200 | [diff] [blame] | 240 | check-caravel: |
| 241 | @if [ ! -d "$(CARAVEL_ROOT)" ]; then \ |
| 242 | echo "Caravel Root: "$(CARAVEL_ROOT)" doesn't exists, please export the correct path before running make. "; \ |
| 243 | exit 1; \ |
Jeff DiCorpo | fb944f9 | 2021-04-20 00:40:50 +0000 | [diff] [blame] | 244 | fi |
manarabdelaty | 78c1b01 | 2021-04-23 17:12:54 +0200 | [diff] [blame] | 245 | |
| 246 | check-precheck: |
| 247 | @if [ ! -d "$(PRECHECK_ROOT)" ]; then \ |
| 248 | echo "Pre-check Root: "$(PRECHECK_ROOT)" doesn't exists, please export the correct path before running make. "; \ |
| 249 | exit 1; \ |
| 250 | fi |
| 251 | |
| 252 | check-pdk: |
| 253 | @if [ ! -d "$(PDK_ROOT)" ]; then \ |
| 254 | echo "PDK Root: "$(PDK_ROOT)" doesn't exists, please export the correct path before running make. "; \ |
| 255 | exit 1; \ |
manarabdelaty | d8dd010 | 2021-04-30 08:40:52 +0200 | [diff] [blame] | 256 | fi |
| 257 | |
| 258 | .PHONY: help |
| 259 | help: |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 260 | cd $(CARAVEL_ROOT) && $(MAKE) help |
manarabdelaty | d8dd010 | 2021-04-30 08:40:52 +0200 | [diff] [blame] | 261 | @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' |
kareem | 76e8a0f | 2022-02-25 10:13:53 -0800 | [diff] [blame] | 262 | |
| 263 | |
Kareem Farid | 7fecf2d | 2022-11-13 18:19:43 +0200 | [diff] [blame] | 264 | export CUP_ROOT=$(shell pwd) |
Kareem Farid | a199697 | 2022-11-14 20:19:36 +0200 | [diff] [blame] | 265 | export TIMING_ROOT?=$(shell pwd)/deps/timing-scripts |
| 266 | export PROJECT_ROOT=$(CUP_ROOT) |
Jeff DiCorpo | 5c41f08 | 2022-11-18 19:29:44 -0800 | [diff] [blame] | 267 | timing-scripts-repo=https://github.com/efabless/timing-scripts.git |
Kareem Farid | 7fecf2d | 2022-11-13 18:19:43 +0200 | [diff] [blame] | 268 | |
| 269 | $(TIMING_ROOT): |
Kareem Farid | d105f68 | 2022-11-15 18:07:26 +0200 | [diff] [blame] | 270 | @mkdir -p $(CUP_ROOT)/deps |
Kareem Farid | a199697 | 2022-11-14 20:19:36 +0200 | [diff] [blame] | 271 | @git clone $(timing-scripts-repo) $(TIMING_ROOT) |
Kareem Farid | 7fecf2d | 2022-11-13 18:19:43 +0200 | [diff] [blame] | 272 | |
| 273 | .PHONY: setup-timing-scripts |
| 274 | setup-timing-scripts: $(TIMING_ROOT) |
Kareem Farid | a199697 | 2022-11-14 20:19:36 +0200 | [diff] [blame] | 275 | @( cd $(TIMING_ROOT) && git pull ) |
Kareem Farid | d105f68 | 2022-11-15 18:07:26 +0200 | [diff] [blame] | 276 | @#( cd $(TIMING_ROOT) && git fetch && git checkout $(MPW_TAG); ) |
Kareem Farid | a199697 | 2022-11-14 20:19:36 +0200 | [diff] [blame] | 277 | @python3 -m venv ./venv |
| 278 | . ./venv/bin/activate && \ |
| 279 | python3 -m pip install --upgrade pip && \ |
| 280 | python3 -m pip install -r $(TIMING_ROOT)/requirements.txt && \ |
| 281 | deactivate |
Kareem Farid | 7fecf2d | 2022-11-13 18:19:43 +0200 | [diff] [blame] | 282 | |
| 283 | ./verilog/gl/user_project_wrapper.v: |
| 284 | $(error you don't have $@) |
| 285 | |
Kareem Farid | d105f68 | 2022-11-15 18:07:26 +0200 | [diff] [blame] | 286 | ./env/spef-mapping.tcl: |
| 287 | @echo "run the following:" |
| 288 | @echo "make extract-parasitics" |
| 289 | @echo "make create-spef-mapping" |
| 290 | exit 1 |
| 291 | |
| 292 | .PHONY: create-spef-mapping |
| 293 | create-spef-mapping: ./verilog/gl/user_project_wrapper.v |
Kareem Farid | a199697 | 2022-11-14 20:19:36 +0200 | [diff] [blame] | 294 | @. ./venv/bin/activate && \ |
| 295 | python3 $(TIMING_ROOT)/scripts/generate_spef_mapping.py \ |
| 296 | -i ./verilog/gl/user_project_wrapper.v \ |
| 297 | -o ./env/spef-mapping.tcl \ |
| 298 | --pdk-path $(PDK_ROOT)/$(PDK) \ |
Kareem Farid | d105f68 | 2022-11-15 18:07:26 +0200 | [diff] [blame] | 299 | --macro-parent mprj \ |
Kareem Farid | a199697 | 2022-11-14 20:19:36 +0200 | [diff] [blame] | 300 | --project-root "$(CUP_ROOT)" && \ |
| 301 | deactivate |
| 302 | |
| 303 | .PHONY: extract-parasitics |
Kareem Farid | d105f68 | 2022-11-15 18:07:26 +0200 | [diff] [blame] | 304 | extract-parasitics: ./verilog/gl/user_project_wrapper.v |
Kareem Farid | a199697 | 2022-11-14 20:19:36 +0200 | [diff] [blame] | 305 | @. ./venv/bin/activate && \ |
Kareem Farid | 12e5b39 | 2022-11-15 14:04:25 +0200 | [diff] [blame] | 306 | python3 $(TIMING_ROOT)/scripts/get_macros.py \ |
| 307 | -i ./verilog/gl/user_project_wrapper.v \ |
| 308 | -o ./tmp-macros-list \ |
Kareem Farid | d105f68 | 2022-11-15 18:07:26 +0200 | [diff] [blame] | 309 | --project-root "$(CUP_ROOT)" \ |
Kareem Farid | 12e5b39 | 2022-11-15 14:04:25 +0200 | [diff] [blame] | 310 | --pdk-path $(PDK_ROOT)/$(PDK) && \ |
| 311 | deactivate |
| 312 | @cat ./tmp-macros-list | cut -d " " -f2 \ |
| 313 | | xargs -I % bash -c "$(MAKE) -C $(TIMING_ROOT) \ |
| 314 | -f $(TIMING_ROOT)/timing.mk rcx-% || echo 'Cannot extract %. Probably no def for this macro'" |
Kareem Farid | d105f68 | 2022-11-15 18:07:26 +0200 | [diff] [blame] | 315 | @$(MAKE) -C $(TIMING_ROOT) -f $(TIMING_ROOT)/timing.mk rcx-user_project_wrapper |
| 316 | @cat ./tmp-macros-list |
| 317 | @rm ./tmp-macros-list |
Kareem Farid | a199697 | 2022-11-14 20:19:36 +0200 | [diff] [blame] | 318 | |
Kareem Farid | 7fecf2d | 2022-11-13 18:19:43 +0200 | [diff] [blame] | 319 | .PHONY: caravel-sta |
| 320 | caravel-sta: ./env/spef-mapping.tcl |
Kareem Farid | d105f68 | 2022-11-15 18:07:26 +0200 | [diff] [blame] | 321 | @$(MAKE) -C $(TIMING_ROOT) -f $(TIMING_ROOT)/timing.mk caravel-timing-typ |
Kareem Farid | a199697 | 2022-11-14 20:19:36 +0200 | [diff] [blame] | 322 | @$(MAKE) -C $(TIMING_ROOT) -f $(TIMING_ROOT)/timing.mk caravel-timing-fast |
| 323 | @$(MAKE) -C $(TIMING_ROOT) -f $(TIMING_ROOT)/timing.mk caravel-timing-slow |
Kareem Farid | d105f68 | 2022-11-15 18:07:26 +0200 | [diff] [blame] | 324 | @echo "You can find results for all corners in $(CUP_ROOT)/signoff/caravel/openlane-signoff/timing/" |