From baaa665ad873b358089fc20150a9666c8c865334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Sat, 28 Sep 2024 15:01:15 +0200 Subject: [PATCH] variables: formalize variables and make metainformation machine readable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit yaml is easy to read, but it has its weaknesses, but was ultimately picked over json and toml. Signed-off-by: Øyvind Harboe --- flow/Makefile | 42 +------------------- flow/scripts/defaults.py | 15 ++++++++ flow/scripts/defaults.yaml | 78 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 40 deletions(-) create mode 100755 flow/scripts/defaults.py create mode 100644 flow/scripts/defaults.yaml diff --git a/flow/Makefile b/flow/Makefile index f9bf8b2f24..2dffa319db 100644 --- a/flow/Makefile +++ b/flow/Makefile @@ -109,46 +109,6 @@ DESIGN_CONFIG ?= ./designs/nangate45/gcd/config.mk # this file. include $(DESIGN_CONFIG) -# For instance Bazel needs artifacts (.odb and .rpt files) on a failure to -# allow the user to save hours on re-running the failed step locally, but -# when working with a Makefile flow, it is more natural to fail the step -# and leave the user to manually inspect the logs and artifacts directly via -# the file system. -# -# Set to 1 to change the behavior to generate artifacts upon failure to -# e.g. do a global route. The exit code will still be non-zero on all other -# failures that aren't covered by the "useful to inspect the artifacts on -# failure" use-case. -# -# Example: just like detailed routing, a global route that fails with congestion, is not -# a build failure(as in exit code non-zero), it is a successful(as in zero exit code) -# global route that produce reports detailing the problem. -# -# Detailed route will not proceed, if there is global routing congestion -# -# This allows build systems, such as bazel, to create artifacts for global -# and detailed route, even if the operation had problems, without having -# know about the semantics between global and detailed route. -# -# Considering that global and detailed route can run for a long time and -# use a lot of memory, this allows inspecting results on a laptop for -# a build that ran on a server. -export GENERATE_ARTIFACTS_ON_FAILURE ?= 0 - -# Default TNS_END_PERCENT value for post CTS timing repair -# Try fixing all violating endpoints by default (reduce to 5% for runtime) -export TNS_END_PERCENT ?=100 - -# Default routing layer adjustment -export ROUTING_LAYER_ADJUSTMENT ?= 0.5 -export RECOVER_POWER ?= 0 -export SKIP_INCREMENTAL_REPAIR ?= 0 -export DETAILED_METRICS ?= 0 -export EQUIVALENCE_CHECK ?= 0 -export CORE_UTILIZATION ?= -export DIE_AREA ?= -export CORE_AREA ?= - # If we are running headless use offscreen rendering for save_image ifeq ($(DISPLAY),) export QT_QPA_PLATFORM ?= offscreen @@ -200,6 +160,8 @@ export UTILS_DIR ?= $(FLOW_HOME)/util export SCRIPTS_DIR ?= $(FLOW_HOME)/scripts export TEST_DIR ?= $(FLOW_HOME)/test +$(foreach line,$(shell $(SCRIPTS_DIR)/defaults.py),$(eval export $(line))) + PUBLIC=nangate45 sky130hd sky130hs asap7 ihp-sg13g2 gf180 ifneq ($(wildcard $(PLATFORM_HOME)/$(PLATFORM)),) diff --git a/flow/scripts/defaults.py b/flow/scripts/defaults.py new file mode 100755 index 0000000000..0b107b47d1 --- /dev/null +++ b/flow/scripts/defaults.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import os +import yaml + +dir_path = os.path.dirname(os.path.realpath(__file__)) + +yaml_path = os.path.join(dir_path, "defaults.yaml") +with open(yaml_path, "r") as file: + data = yaml.safe_load(file) + +for key, value in data.items(): + if value["value"] is None: + continue + print(f'{key}?={value["value"]}') diff --git a/flow/scripts/defaults.yaml b/flow/scripts/defaults.yaml new file mode 100644 index 0000000000..6b0e20f6c1 --- /dev/null +++ b/flow/scripts/defaults.yaml @@ -0,0 +1,78 @@ +GENERATE_ARTIFACTS_ON_FAILURE: + description: > + For instance Bazel needs artifacts (.odb and .rpt files) on a failure to + allow the user to save hours on re-running the failed step locally, but + when working with a Makefile flow, it is more natural to fail the step + and leave the user to manually inspect the logs and artifacts directly via + the file system. + + Set to 1 to change the behavior to generate artifacts upon failure to + e.g. do a global route. The exit code will still be non-zero on all other + failures that aren't covered by the "useful to inspect the artifacts on + failure" use-case. + + Example: just like detailed routing, a global route that fails with congestion, is not + a build failure(as in exit code non-zero), it is a successful(as in zero exit code) + global route that produce reports detailing the problem. + + Detailed route will not proceed, if there is global routing congestion + + This allows build systems, such as bazel, to create artifacts for global + and detailed route, even if the operation had problems, without having + know about the semantics between global and detailed route. + + Considering that global and detailed route can run for a long time and + use a lot of memory, this allows inspecting results on a laptop for + a build that ran on a server. + value: 0 + stages: + - all + +TNS_END_PERCENT: + description: > + Default TNS_END_PERCENT value for post CTS timing repair. + Try fixing all violating endpoints by default (reduce to 5% for runtime). + value: 100 + stages: + - crt + - floorplan + - grt + +ROUTING_LAYER_ADJUSTMENT: + value: 0.5 + description: Default routing layer adjustment + stages: + - place + - grt + - route + - final + +RECOVER_POWER: + value: 0 + stages: + - grt +SKIP_INCREMENTAL_REPAIR: + value: 0 + stages: + - grt +DETAILED_METRICS: + value: 0 + stages: + - cts + - grt +EQUIVALENCE_CHECK: + value: 0 + stages: + - cts +CORE_UTILIZATION: + value: null + stages: + - floorplan +DIE_AREA: + value: null + stages: + - floorplan +CORE_AREA: + value: null + stages: + - floorplan