Skip to content

Commit

Permalink
initial integration of openlane2
Browse files Browse the repository at this point in the history
  • Loading branch information
kareefardi committed Aug 17, 2023
1 parent dec4c74 commit d274405
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 32 deletions.
24 changes: 16 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export ROOTLESS
ifeq ($(PDK),sky130A)
SKYWATER_COMMIT=f70d8ca46961ff92719d8870a18a076370b85f6c
export OPEN_PDKS_COMMIT?=78b7bc32ddb4b6f14f76883c2e2dc5b5de9d1cbc
export OPENLANE_TAG?=2023.07.19
export OPENLANE_TAG?=2.0.0-b4
MPW_TAG ?= mpw-9d

ifeq ($(CARAVEL_LITE),1)
Expand Down Expand Up @@ -187,13 +187,21 @@ what:

# Install Openlane
.PHONY: openlane
openlane:
@if [ "$$(realpath $${OPENLANE_ROOT})" = "$$(realpath $$(pwd)/openlane)" ]; then\
echo "OPENLANE_ROOT is set to '$$(pwd)/openlane' which contains openlane config files"; \
echo "Please set it to a different directory"; \
exit 1; \
fi
cd openlane && $(MAKE) openlane
openlane: openlane-venv openlane-docker-container
# openlane installed

OPENLANE_TAG_DOCKER=$(subst -,,$(OPENLANE_TAG))
.PHONY: openlane-docker-container
openlane-docker-container:
docker pull ghcr.io/efabless/openlane2:$(OPENLANE_TAG_DOCKER)

.PHONY: openlane-venv
openlane-venv: venv/manifest.txt
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 > $@

#### Not sure if the targets following are of any use

Expand Down
48 changes: 24 additions & 24 deletions openlane/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,44 @@
MAKEFLAGS+=--warn-undefined-variables

export OPENLANE_RUN_TAG = $(shell date '+%y_%m_%d_%H_%M')
export CARAVEL_ROOT:=$(CARAVEL_ROOT)
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)
current_design = null

OPENLANE_USE_NIX ?= 0
ROOTLESS ?= 0
USER_ARGS = -u $$(id -u $$USER):$$(id -g $$USER)
ifeq ($(ROOTLESS), 1)
USER_ARGS =
endif

openlane_cmd = \
"flow.tcl \
-design $$(realpath ./$*) \
-save_path $$(realpath ..) \
-save \
-tag $(OPENLANE_RUN_TAG) \
-overwrite \
-ignore_mismatches"
openlane_cmd_interactive = "flow.tcl -it -file $$(realpath ./$*/interactive.tcl)"
openlane_args = \
--run-tag $(OPENLANE_RUN_TAG) \
--manual-pdk \
--pdk-root $(PDK_ROOT) \
$$(realpath ./$*)/config.json

docker_mounts = \
-v $$(realpath $(PWD)/..):$$(realpath $(PWD)/..) \
-v $(PDK_ROOT):$(PDK_ROOT) \
-v $(CARAVEL_ROOT):$(CARAVEL_ROOT) \
-v $(OPENLANE_ROOT):/openlane
-m $$(realpath $(PWD)/..) \
-m $(PDK_ROOT) \
-m $(CARAVEL_ROOT)

docker_env = \
-e PDK_ROOT=$(PDK_ROOT) \
-e PDK=$(PDK) \
-e MISMATCHES_OK=1 \
-e CARAVEL_ROOT=$(CARAVEL_ROOT) \
-e OPENLANE_RUN_TAG=$(OPENLANE_RUN_TAG)

ifneq ($(MCW_ROOT),)
docker_env += -e MCW_ROOT=$(MCW_ROOT)
docker_mounts += -v $(MCW_ROOT):$(MCW_ROOT)
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" )
Expand All @@ -68,17 +69,16 @@ list:
.PHONY: $(designs)
$(designs) : export current_design=$@
$(designs) : % : ./%/config.json
ifneq (,$(wildcard ./$(current_design)/interactive.tcl))
$(docker_run) \
$(OPENLANE_IMAGE_NAME) sh -c $(openlane_cmd_interactive)
else
# $(current_design)
mkdir -p ./$*/runs/$(OPENLANE_RUN_TAG)
rm -rf ./$*/runs/$(OPENLANE_RUN_TAG)
ifeq ($(OPENLANE_USE_NIX),1)
nix-shell --pure --command "openlane $(openlane_args)"
else
../openlane-venv/bin/python3 -m openlane $(docker_mounts) --dockerized $(openlane_args)
endif
mkdir -p ./$*/runs/$(OPENLANE_RUN_TAG)
rm -rf ./$*/runs/$*
ln -s $$(realpath ./$*/runs/$(OPENLANE_RUN_TAG)) ./$*/runs/$*
$(docker_run) \
$(OPENLANE_IMAGE_NAME) sh -c $(openlane_cmd)
endif
@mkdir -p ../signoff/$*/
@cp ./$*/runs/$*/OPENLANE_VERSION ../signoff/$*/
@cp ./$*/runs/$*/PDK_SOURCES ../signoff/$*/
Expand Down

0 comments on commit d274405

Please sign in to comment.