Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions flow/scripts/variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export NUM_CORES

#-------------------------------------------------------------------------------
# setup all commands used within this flow
export PYTHON_EXE ?= $(shell command -v python3)
PYTHON_EXE ?= $(shell command -v python3)
export PYTHON_EXE := $(PYTHON_EXE)

export RUN_CMD = $(PYTHON_EXE) $(FLOW_HOME)/scripts/run_command.py

Expand All @@ -81,16 +82,19 @@ export RUN_CMD = $(PYTHON_EXE) $(FLOW_HOME)/scripts/run_command.py
# 2.1 if in Nix shell: openroad, yosys from the environment
# 2.2 ORFS compiled tools: openroad, yosys
ifneq (${IN_NIX_SHELL},)
export OPENROAD_EXE ?= $(shell command -v openroad)
OPENROAD_EXE ?= $(shell command -v openroad)
else
export OPENROAD_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/openroad)
OPENROAD_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/openroad)
endif
ifneq (${IN_NIX_SHELL},)
export OPENSTA_EXE ?= $(shell command -v sta)
OPENSTA_EXE ?= $(shell command -v sta)
else
export OPENSTA_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/sta)
OPENSTA_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/sta)
endif

export OPENROAD_EXE := $(OPENROAD_EXE)
export OPENSTA_EXE := $(OPENSTA_EXE)

OPENROAD_IS_VALID := $(if $(OPENROAD_EXE),$(shell test -x $(OPENROAD_EXE) && echo "true"),)

export OPENROAD_ARGS = -no_init -threads $(NUM_CORES) $(OR_ARGS)
Expand All @@ -103,7 +107,8 @@ ifneq (${IN_NIX_SHELL},)
else
YOSYS_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/yosys/bin/yosys)
endif
export YOSYS_EXE

export YOSYS_EXE := $(YOSYS_EXE)

YOSYS_IS_VALID := $(if $(YOSYS_EXE),$(shell test -x $(YOSYS_EXE) && echo "true"),)

Expand All @@ -115,13 +120,14 @@ KEPLER_FORMAL_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/kepler-formal/bin/k
export KEPLER_FORMAL_EXE

ifeq ($(wildcard $(KLAYOUT_BIN_FROM_DIR)), $(KLAYOUT_BIN_FROM_DIR))
export KLAYOUT_CMD ?= sh -c 'LD_LIBRARY_PATH=$(dir $(KLAYOUT_BIN_FROM_DIR)) $$0 "$$@"' $(KLAYOUT_BIN_FROM_DIR)
KLAYOUT_CMD ?= sh -c 'LD_LIBRARY_PATH=$(dir $(KLAYOUT_BIN_FROM_DIR)) $$0 "$$@"' $(KLAYOUT_BIN_FROM_DIR)
else
ifeq ($(KLAYOUT_CMD),)
export KLAYOUT_CMD := $(shell command -v klayout)
KLAYOUT_CMD ?= $(shell command -v klayout)
endif
Comment on lines 125 to 127
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The ifeq ($(KLAYOUT_CMD),) check is redundant here because the ?= operator already ensures that the variable is only assigned if it is currently undefined. Removing this extra conditional block simplifies the logic and makes it consistent with how other tool variables (like PYTHON_EXE or OPENROAD_EXE) are handled in this file. Note that this change also means an explicitly defined empty KLAYOUT_CMD will now be respected rather than overwritten, which is consistent with the behavior of the other tool variables.

KLAYOUT_CMD ?= $(shell command -v klayout)

endif

export KLAYOUT_CMD := $(KLAYOUT_CMD)

#-------------------------------------------------------------------------------
WRAPPED_LEFS = $(foreach lef,$(notdir $(WRAP_LEFS)),$(OBJECTS_DIR)/lef/$(lef:.lef=_mod.lef))
Expand Down