From 23e7b66dfa8affaeb9416d3ccb97590d673958c3 Mon Sep 17 00:00:00 2001 From: Kareem Farid Date: Tue, 8 Oct 2024 14:26:09 +0300 Subject: [PATCH 1/3] docs: Add Deprecated Names to Variable table remove FP_DEF_TEMPLATE for OpenROADStep config_vars Signed-off-by: Kareem Farid --- .../generate_configvar_docs/common_pdk_vars.md | 12 ++++++------ .../generate_configvar_docs/common_vars.md | 6 +++--- docs/source/faq.md | 2 +- openlane/config/variable.py | 8 ++++++++ openlane/flows/flow.py | 6 +++--- openlane/steps/openroad.py | 5 ----- openlane/steps/step.py | 4 ++-- 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/docs/_templates/generate_configvar_docs/common_pdk_vars.md b/docs/_templates/generate_configvar_docs/common_pdk_vars.md index 2569f7815..f026353f3 100644 --- a/docs/_templates/generate_configvar_docs/common_pdk_vars.md +++ b/docs/_templates/generate_configvar_docs/common_pdk_vars.md @@ -20,10 +20,10 @@ ${"##"} PDK-Level These are variables that affect the entire PDK. -| Variable Name | Type | Description | Units | -| - | - | - | - | +| Variable Name | Type | Description | Units | Deprecated Names | +| - | - | - | - | - | %for var in pdk_variables: -| `${var.name}`{#${var._get_docs_identifier()}} | ${var.type_repr_md(for_document=True)} | ${var.desc_repr_md()} | ${var.units or ""} | +| `${var.name}`{#${var._get_docs_identifier()}} | ${var.type_repr_md(for_document=True)} | ${var.desc_repr_md()} | ${var.units or ""} | ${var.get_deprecated_names_md()|join("
")} | %endfor (univ_flow_cvars_scl)= @@ -31,8 +31,8 @@ ${"##"} SCL-Level These are variables that affect a specific standard-cell library. -| Variable Name | Type | Description | Units | -| - | - | - | - | +| Variable Name | Type | Description | Units | Deprecated Names | +| - | - | - | - | - | %for var in scl_variables: -| `${var.name}`{#${var._get_docs_identifier()}} | ${var.type_repr_md(for_document=True)} | ${var.desc_repr_md()} | ${var.units or ""} | +| `${var.name}`{#${var._get_docs_identifier()}} | ${var.type_repr_md(for_document=True)} | ${var.desc_repr_md()} | ${var.units or ""} | ${var.get_deprecated_names_md()|join("
")} | %endfor diff --git a/docs/_templates/generate_configvar_docs/common_vars.md b/docs/_templates/generate_configvar_docs/common_vars.md index 02f2e17fc..d6395e35a 100644 --- a/docs/_templates/generate_configvar_docs/common_vars.md +++ b/docs/_templates/generate_configvar_docs/common_vars.md @@ -12,8 +12,8 @@ can freely override these values. optional and behave accordingly. ``` -| Variable Name | Type | Description | Default | Units | -| - | - | - | - | - | +| Variable Name | Type | Description | Default | Units | Deprecated Names | +| - | - | - | - | - | - | %for var in option_variables: -| [`${var.name}`]{#${var._get_docs_identifier()}} | ${var.type_repr_md(for_document=True)} | ${var.desc_repr_md()} | `${var.default}` | ${var.units or ""} | +| [`${var.name}`]{#${var._get_docs_identifier()}} | ${var.type_repr_md(for_document=True)} | ${var.desc_repr_md()} | `${var.default}` | ${var.units or ""} | ${var.get_deprecated_names_md()|join("
")} | %endfor diff --git a/docs/source/faq.md b/docs/source/faq.md index 491d1c6e7..b2f25111b 100644 --- a/docs/source/faq.md +++ b/docs/source/faq.md @@ -7,7 +7,7 @@ ## General -(faq-whats-openlane=) +(faq-whats-openlane)= ### What is OpenLane? diff --git a/openlane/config/variable.py b/openlane/config/variable.py index ab4899fb6..7019fba9a 100644 --- a/openlane/config/variable.py +++ b/openlane/config/variable.py @@ -381,6 +381,14 @@ def type_repr_md(self, for_document: bool = False) -> str: # pragma: no cover return repr_type(self.type).replace("|", "|
") return repr_type(self.type) + def get_deprecated_names_md(self) -> List[str]: + deprecated_names_md = [] + for deprecated_name in self.deprecated_names: + if not isinstance(deprecated_name, str): + deprecated_name, _ = deprecated_name + deprecated_names_md.append(f"`{deprecated_name}`") + return deprecated_names_md + def desc_repr_md(self) -> str: # pragma: no cover """ :returns: The description, but with newlines escaped for Markdown. diff --git a/openlane/flows/flow.py b/openlane/flows/flow.py index 192243b1d..a39994fb1 100644 --- a/openlane/flows/flow.py +++ b/openlane/flows/flow.py @@ -419,14 +419,14 @@ def get_help_md(Self) -> str: # pragma: no cover #### Flow-specific Configuration Variables - | Variable Name | Type | Description | Default | Units | - | - | - | - | - | - | + | Variable Name | Type | Description | Default | Units | Deprecated Names | + | - | - | - | - | - | - | """ ) for var in flow_config_vars: units = var.units or "" pdk_superscript = "PDK" if var.pdk else "" - result += f"| `{var.name}`{{#{var._get_docs_identifier(Self.__name__)}}}{pdk_superscript} | {var.type_repr_md()} | {var.desc_repr_md()} | `{var.default}` | {units} |\n" + result += f"| `{var.name}`{{#{var._get_docs_identifier(Self.__name__)}}}{pdk_superscript} | {var.type_repr_md()} | {var.desc_repr_md()} | `{var.default}` | {units} | {'
'.join(var.get_deprecated_names_md())} |\n" result += "\n" if len(Self.Steps): diff --git a/openlane/steps/openroad.py b/openlane/steps/openroad.py index a358145e0..e1b04981c 100644 --- a/openlane/steps/openroad.py +++ b/openlane/steps/openroad.py @@ -211,11 +211,6 @@ class OpenROADStep(TclStep): Optional[Path], "Specifies the SDC file used during all implementation (PnR) steps", ), - Variable( - "FP_DEF_TEMPLATE", - Optional[Path], - "Points to the DEF file to be used as a template.", - ), ] @abstractmethod diff --git a/openlane/steps/step.py b/openlane/steps/step.py index 15d18d575..2373bd610 100644 --- a/openlane/steps/step.py +++ b/openlane/steps/step.py @@ -678,14 +678,14 @@ def get_help_md( ({Self.id.lower()}-configuration-variables)= #### Configuration Variables - | Variable Name | Type | Description | Default | Units | + | Variable Name | Type | Description | Default | Units | Deprecated Names | | - | - | - | - | - | """ ) for var in Self.config_vars: units = var.units or "" pdk_superscript = "PDK" if var.pdk else "" - result += f"| `{var.name}`{{#{var._get_docs_identifier(Self.id)}}}{pdk_superscript} | {var.type_repr_md(for_document=True)} | {var.desc_repr_md()} | `{var.default}` | {units} |\n" + result += f"| `{var.name}`{{#{var._get_docs_identifier(Self.id)}}}{pdk_superscript} | {var.type_repr_md(for_document=True)} | {var.desc_repr_md()} | `{var.default}` | {units} | {'
'.join(var.get_deprecated_names_md())} |\n" result += "\n" result = ( From cc018f3ebcb427137b4a049d01d00d9456352529 Mon Sep 17 00:00:00 2001 From: Kareem Farid Date: Tue, 8 Oct 2024 15:38:04 +0300 Subject: [PATCH 2/3] Restore FP_DEF_TEMPLATE in OpenROADStep to avoid breakingchange Iterate on set of unique Variables when generating docs for a step Update __hash__ for Variable to avoid unhashable list Signed-off-by: Kareem Farid --- openlane/config/variable.py | 2 +- openlane/steps/openroad.py | 5 +++++ openlane/steps/step.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/openlane/config/variable.py b/openlane/config/variable.py index 7019fba9a..29e0e85d3 100644 --- a/openlane/config/variable.py +++ b/openlane/config/variable.py @@ -718,7 +718,7 @@ def _get_docs_identifier(self, parent: Optional[str] = None) -> str: return identifier def __hash__(self) -> int: - return hash((self.name, self.type, self.default)) + return hash((self.name, str(self.type), str(self.default))) def __eq__(self, rhs: object) -> bool: if not isinstance(rhs, Variable): diff --git a/openlane/steps/openroad.py b/openlane/steps/openroad.py index e1b04981c..a358145e0 100644 --- a/openlane/steps/openroad.py +++ b/openlane/steps/openroad.py @@ -211,6 +211,11 @@ class OpenROADStep(TclStep): Optional[Path], "Specifies the SDC file used during all implementation (PnR) steps", ), + Variable( + "FP_DEF_TEMPLATE", + Optional[Path], + "Points to the DEF file to be used as a template.", + ), ] @abstractmethod diff --git a/openlane/steps/step.py b/openlane/steps/step.py index 2373bd610..8b24632ed 100644 --- a/openlane/steps/step.py +++ b/openlane/steps/step.py @@ -682,7 +682,7 @@ def get_help_md( | - | - | - | - | - | """ ) - for var in Self.config_vars: + for var in set(Self.config_vars): units = var.units or "" pdk_superscript = "PDK" if var.pdk else "" result += f"| `{var.name}`{{#{var._get_docs_identifier(Self.id)}}}{pdk_superscript} | {var.type_repr_md(for_document=True)} | {var.desc_repr_md()} | `{var.default}` | {units} | {'
'.join(var.get_deprecated_names_md())} |\n" From 8c7cd1d337e7795a12a31f7210b3e40b881f0855 Mon Sep 17 00:00:00 2001 From: Kareem Farid Date: Thu, 10 Oct 2024 16:32:11 +0300 Subject: [PATCH 3/3] Fix broken tables --- openlane/steps/step.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlane/steps/step.py b/openlane/steps/step.py index 8b24632ed..85114a25f 100644 --- a/openlane/steps/step.py +++ b/openlane/steps/step.py @@ -679,7 +679,7 @@ def get_help_md( #### Configuration Variables | Variable Name | Type | Description | Default | Units | Deprecated Names | - | - | - | - | - | - | + | - | - | - | - | - | - | """ ) for var in set(Self.config_vars):