| # SPDX-FileCopyrightText: Copyright 2020 eFabless |
| # |
| # SPDX-License-Identifier: Apache-2.0 |
| # |
| # 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 |
| # |
| # https://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. |
| |
| |
| # cannot commit files larger than 100 MB to GitHub |
| FILE_SIZE_LIMIT_MB = 100 |
| LARGE_FILES := $(shell find ./gds -type f -name "*.gds") |
| LARGE_FILES += $(shell find . -type f -size +$(FILE_SIZE_LIMIT_MB)M -not -path "./.git/*" -not -path "./gds/*" -not -path "./openlane/*") |
| |
| LARGE_FILES_GZ := $(addsuffix .gz, $(LARGE_FILES)) |
| |
| ARCHIVES := $(shell find . -type f -name "*.gz") |
| ARCHIVE_SOURCES := $(basename $(ARCHIVES)) |
| |
| # PDK setup configs |
| THREADS ?= $(shell nproc) |
| STD_CELL_LIBRARY ?= sky130_fd_sc_hd |
| SPECIAL_VOLTAGE_LIBRARY ?= sky130_fd_sc_hvl |
| IO_LIBRARY ?= sky130_fd_io |
| SKYWATER_COMMIT ?= 3d7617a1acb92ea883539bcf22a632d6361a5de4 |
| OPEN_PDKS_COMMIT ?= 3959de867a4acb6867df376dac495e33bb0734f1 |
| |
| .DEFAULT_GOAL := ship |
| # We need portable GDS_FILE pointers... |
| .PHONY: ship |
| ship: check-env uncompress |
| @echo "###############################################" |
| @echo "Generating Caravel GDS (sources are in the 'gds' directory)" |
| @sleep 1 |
| @cp gds/caravel.gds gds/caravel.old.gds && echo "Copying old Caravel to gds/caravel.old.gds" || true |
| @cd gds && MAGTYPE=mag magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/current/sky130A.magicrc -noc -dnull gen_caravel.tcl < /dev/null |
| |
| |
| |
| .PHONY: clean |
| clean: |
| echo "clean" |
| |
| |
| |
| .PHONY: verify |
| verify: |
| echo "verify" |
| |
| .PHONY: init_block_flat |
| init_block_flat: |
| @echo |
| @echo " clearing user_projec_example" |
| @echo |
| rm -fR openlane/user_proj_example/* |
| @echo |
| @echo " overwritting user_proj_example with 16x16 block" |
| @echo |
| cp ol_templates/config_block.tcl openlane/user_proj_example/config.tcl |
| cp ol_templates/pin_order.cfg openlane/user_proj_example/pin_order.cfg |
| |
| .PHONY: init_block_cells |
| init_block_cells: |
| @echo |
| @echo " clearing user_projec_example" |
| @echo |
| rm -fR openlane/user_proj_example/* |
| @echo |
| @echo " overwritting user_proj_example with 16x16 block using black box cells" |
| @echo |
| cp ol_templates/config_block2.tcl openlane/user_proj_example/config.tcl |
| cp ol_templates/pdn.tcl openlane/user_proj_example/pdn.tcl |
| cp ol_templates/pin_order.cfg openlane/user_proj_example/pin_order.cfg |
| |
| .PHONY: help |
| help: |
| @echo " available commands (do 'make <command>')" |
| @echo |
| @awk '/^.PHONY/{print " " $$2}' Makefile |
| |
| |
| $(LARGE_FILES_GZ): %.gz: % |
| @if ! [ $(suffix $<) == ".gz" ]; then\ |
| gzip -n --best $< > /dev/null &&\ |
| echo "$< -> $@";\ |
| fi |
| |
| # This target compresses all files larger than $(FILE_SIZE_LIMIT_MB) MB |
| .PHONY: compress |
| compress: $(LARGE_FILES_GZ) |
| @echo "Files larger than $(FILE_SIZE_LIMIT_MB) MBytes are compressed!" |
| |
| |
| |
| $(ARCHIVE_SOURCES): %: %.gz |
| @gzip -d $< &&\ |
| echo "$< -> $@";\ |
| |
| .PHONY: uncompress |
| uncompress: $(ARCHIVE_SOURCES) |
| @echo "All files are uncompressed!" |
| |
| .PHONY: pdk |
| pdk: skywater-pdk skywater-library open_pdks build-pdk |
| |
| $(PDK_ROOT)/skywater-pdk: |
| git clone https://github.com/google/skywater-pdk.git $(PDK_ROOT)/skywater-pdk |
| |
| .PHONY: skywater-pdk |
| skywater-pdk: check-env $(PDK_ROOT)/skywater-pdk |
| cd $(PDK_ROOT)/skywater-pdk && \ |
| git checkout -qf $(SKYWATER_COMMIT) |
| |
| .PHONY: skywater-library |
| skywater-library: check-env $(PDK_ROOT)/skywater-pdk |
| cd $(PDK_ROOT)/skywater-pdk && \ |
| git submodule update --init libraries/$(STD_CELL_LIBRARY)/latest && \ |
| git submodule update --init libraries/$(IO_LIBRARY)/latest && \ |
| git submodule update --init libraries/$(SPECIAL_VOLTAGE_LIBRARY)/latest && \ |
| $(MAKE) -j$(THREADS) timing |
| |
| ### OPEN_PDKS |
| $(PDK_ROOT)/open_pdks: |
| git clone https://github.com/RTimothyEdwards/open_pdks.git $(PDK_ROOT)/open_pdks |
| |
| .PHONY: open_pdks |
| open_pdks: check-env $(PDK_ROOT)/open_pdks |
| cd $(PDK_ROOT)/open_pdks && \ |
| git checkout -qf $(OPEN_PDKS_COMMIT) |
| |
| .PHONY: build-pdk |
| build-pdk: check-env $(PDK_ROOT)/open_pdks $(PDK_ROOT)/skywater-pdk |
| [ -d $(PDK_ROOT)/sky130A ] && \ |
| (echo "Warning: A sky130A build already exists under $(PDK_ROOT). It will be deleted first!" && \ |
| sleep 5 && \ |
| rm -rf $(PDK_ROOT)/sky130A) || \ |
| true |
| cd $(PDK_ROOT)/open_pdks && \ |
| ./configure --with-sky130-source=$(PDK_ROOT)/skywater-pdk/libraries --with-sky130-local-path=$(PDK_ROOT) && \ |
| cd sky130 && \ |
| $(MAKE) veryclean && \ |
| $(MAKE) && \ |
| $(MAKE) install-local |
| |
| check-env: |
| ifndef PDK_ROOT |
| $(error PDK_ROOT is undefined, please export it before running make) |
| endif |