diff --git a/Makefile b/Makefile index 1d6202a76..f852530f3 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ endif # Include Caravel Makefile Targets .PHONY: % : check-caravel %: - export CARAVEL_ROOT=$(CARAVEL_ROOT) && $(MAKE) -f $(CARAVEL_ROOT)/Makefile $@ + export CARAVEL_ROOT=$(CARAVEL_ROOT) && export PROJECT_ROOT=$(PROJECT_ROOT) && $(MAKE) -f $(CARAVEL_ROOT)/Makefile $@ .PHONY: install install: @@ -109,7 +109,7 @@ simenv: setup: check_dependencies install check-env install_mcw openlane pdk-with-volare setup-timing-scripts setup-cocotb # Openlane -blocks=$(shell cd openlane && find * -maxdepth 0 -type d) +blocks=$(shell cd $(PROJECT_ROOT)/openlane && find * -maxdepth 0 -type d) .PHONY: $(blocks) $(blocks): % : $(MAKE) -C openlane $* @@ -186,7 +186,7 @@ what: # Install Openlane .PHONY: openlane -openlane: openlane-venv openlane-docker-container +openlane: openlane-venv # openlane installed OPENLANE_TAG_DOCKER=$(subst -,,$(OPENLANE_TAG)) @@ -194,12 +194,12 @@ OPENLANE_TAG_DOCKER=$(subst -,,$(OPENLANE_TAG)) openlane-docker-container: docker pull ghcr.io/efabless/openlane2:$(OPENLANE_TAG_DOCKER) -openlane-venv: openlane-venv/manifest.txt -openlane-venv/manifest.txt: +openlane-venv: $(PROJECT_ROOT)/openlane-venv/manifest.txt +$(PROJECT_ROOT)/openlane-venv/manifest.txt: rm -rf openlane-venv - python3 -m venv ./openlane-venv - PYTHONPATH= ./openlane-venv/bin/python3 -m pip install openlane==$(OPENLANE_TAG) - PYTHONPATH= ./openlane-venv/bin/python3 -m pip freeze > $@ + python3 -m venv $(PROJECT_ROOT)/openlane-venv + PYTHONPATH= $(PROJECT_ROOT)/openlane-venv/bin/python3 -m pip install openlane==$(OPENLANE_TAG) + PYTHONPATH= $(PROJECT_ROOT)/openlane-venv/bin/python3 -m pip freeze > $(PROJECT_ROOT)/openlane-venv/manifest.txt #### Not sure if the targets following are of any use @@ -309,9 +309,9 @@ check_dependencies: fi -export CUP_ROOT=$(shell pwd) +export CUP_ROOT?=$(shell pwd) export TIMING_ROOT?=$(shell pwd)/dependencies/timing-scripts -export PROJECT_ROOT=$(CUP_ROOT) +export PROJECT_ROOT?=$(CUP_ROOT) timing-scripts-repo=https://github.com/efabless/timing-scripts.git $(TIMING_ROOT): diff --git a/openlane/Makefile b/openlane/Makefile index 2d76eb77f..e356b48ce 100644 --- a/openlane/Makefile +++ b/openlane/Makefile @@ -21,7 +21,7 @@ export PDK:=$(PDK) export PDK_ROOT:=$(PDK_ROOT) OPENLANE_TAG ?= 2023.07.19 OPENLANE_IMAGE_NAME ?= efabless/openlane:$(OPENLANE_TAG) -designs = $(shell find * -maxdepth 0 -type d) +designs = $(shell cd $(PROJECT_ROOT)/openlane && find * -maxdepth 0 -type d) current_design = null OPENLANE_USE_NIX ?= 0 ROOTLESS ?= 0 @@ -34,10 +34,10 @@ openlane_args = \ --run-tag $(OPENLANE_RUN_TAG) \ --manual-pdk \ --pdk-root $(PDK_ROOT) \ - $$(realpath ./$*)/config.json + $(PROJECT_ROOT)/openlane/$*/config.json docker_mounts = \ - -m $$(realpath $(PWD)/..) \ + -m $(PROJECT_ROOT)\ -m $(PDK_ROOT) \ -m $(CARAVEL_ROOT) @@ -53,9 +53,6 @@ export MCW_ROOT:=$(MCW_ROOT) docker_mounts += -m $(MCW_ROOT) endif -ifeq ($(OPENLANE_USE_NIX),0) -endif - docker_startup_mode = $(shell test -t 0 && echo "-it" || echo "--rm" ) openlane_extra_args = $(shell test -t 0 || echo "--log-level WARN") docker_run = \ @@ -69,21 +66,21 @@ list: .PHONY: $(designs) $(designs) : export current_design=$@ -$(designs) : % : ./%/config.json +$(designs) : % : $(PROJECT_ROOT)/openlane/%/config.json # $(current_design) - rm -rf ./$*/runs/$(OPENLANE_RUN_TAG) + @rm -rf $(PROJECT_ROOT)/openlane/$*/runs/$(OPENLANE_RUN_TAG) ifeq ($(OPENLANE_USE_NIX),1) nix-shell --pure --command "openlane $(openlane_args) $(openlane_extra_args)" else - ../openlane-venv/bin/python3 -m openlane $(docker_mounts) --dockerized $(openlane_args) $(openlane_extra_args) + $(PROJECT_ROOT)/openlane-venv/bin/python3 -m openlane $(docker_mounts) --dockerized $(openlane_args) $(openlane_extra_args) endif - mkdir -p ./$*/runs/$(OPENLANE_RUN_TAG) - rm -rf ./$*/runs/$* - ln -s $$(realpath ./$*/runs/$(OPENLANE_RUN_TAG)) ./$*/runs/$* - @mkdir -p ../signoff/$*/ - @echo $(OPENLANE_TAG) > ../signoff/$*/OPENLANE_VERSION - @cp $(PDK_ROOT)/$(PDK)/SOURCES ../signoff/$*/PDK_SOURCES - @cp ./$*/runs/$*/final/*.csv ../signoff/$*/ + @rm -rf $(PROJECT_ROOT)/openlane/$*/runs/$* + @ln -s $$(realpath $(PROJECT_ROOT)/openlane/$*/runs/$(OPENLANE_RUN_TAG)) $(PROJECT_ROOT)/openlane/$*/runs/$* + @mkdir -p $(PROJECT_ROOT)/signoff/$*/ + @echo $(OPENLANE_TAG) > $(PROJECT_ROOT)/signoff/$*/OPENLANE_VERSION + @cp $(PDK_ROOT)/$(PDK)/SOURCES $(PROJECT_ROOT)/signoff/$*/PDK_SOURCES + @cp $(PROJECT_ROOT)/openlane/$*/runs/$*/final/*.csv $(PROJECT_ROOT)/signoff/$*/ + @rsync -a $(PROJECT_ROOT)/openlane/$*/runs/$*/final/ $(PROJECT_ROOT)/ --exclude "metrics.csv" --exclude "metrics.json" .PHONY: openlane openlane: check-openlane-env diff --git a/openlane/shell.nix b/openlane/shell.nix index 750f32f98..ce394eb82 100644 --- a/openlane/shell.nix +++ b/openlane/shell.nix @@ -13,8 +13,8 @@ # limitations under the License. { pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/0218941ea68b4c625533bead7bbb94ccce52dceb.tar.gz") {}, - openlane-version ? "8b47c810ae47835079e09bbec8ff945c4b90b14a", - openlane-sha256 ? "sha256-I6vZhkqH+7InaQrmxWYJSuK0PKrMEA/UFAzfqFseR3A=" + openlane-version ? "2.0.0b7", + openlane-sha256 ? "sha256-LGO/dpSdAD2zYj+8X9MnsaRVIrX7P9AYHIa2ozJdB8M=" }: let openlane-src = pkgs.fetchFromGitHub {