From 036847b585f7eb248b2e9ae9e2ac1fb35581df93 Mon Sep 17 00:00:00 2001 From: Shubham Kumar Date: Tue, 25 Jun 2024 11:24:20 +0530 Subject: [PATCH 1/3] Modified hardcoded PDK path with the environment variable PDK_ROOT --- .../glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py b/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py index b07f09339..316be14b5 100644 --- a/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py +++ b/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py @@ -33,7 +33,7 @@ openfasoc_dir = Path(__file__).resolve().parent.parent.parent.parent.parent.parent.parent klayout_drc_file = Path(__file__).resolve().parent / "sky130.lydrc" -pdk_root = Path('/usr/bin/miniconda3/share/pdk/') +pdk_root = Path('$PDK_ROOT') lvs_schematic_ref_file = openfasoc_dir / "common" / "platforms" / "sky130hd" / "cdl" / "sky130_fd_sc_hd.spice" magic_drc_file = pdk_root / "sky130A" / "libs.tech" / "magic" / "sky130A.magicrc" lvs_setup_tcl_file = pdk_root / "sky130A" / "libs.tech" / "netgen" / "sky130A_setup.tcl" @@ -65,4 +65,5 @@ # set the grid size sky130_mapped_pdk.gds_write_settings.precision = 5*10**-9 sky130_mapped_pdk.cell_decorator_settings.cache=False -sky130_mapped_pdk.gds_write_settings.flatten_invalid_refs=False \ No newline at end of file +sky130_mapped_pdk.gds_write_settings.flatten_invalid_refs=False + From f0a0ce51ceed7a0bb068f61d093c8e0de8e90fae Mon Sep 17 00:00:00 2001 From: Shubham Kumar Date: Thu, 27 Jun 2024 19:56:16 +0530 Subject: [PATCH 2/3] Added EnvironmentError if pdk_root cannot be found --- .../flow/pdk/sky130_mapped/sky130_mapped.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py b/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py index 316be14b5..9a3ecaa73 100644 --- a/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py +++ b/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py @@ -1,7 +1,7 @@ """ usage: from sky130_mapped import sky130_mapped_pdk """ - +import os from ..mappedpdk import MappedPDK, SetupPDKFiles from ..sky130_mapped.grules import grulesobj from pathlib import Path @@ -33,6 +33,22 @@ openfasoc_dir = Path(__file__).resolve().parent.parent.parent.parent.parent.parent.parent klayout_drc_file = Path(__file__).resolve().parent / "sky130.lydrc" + +paths_to_check = [ + Path('$PDK_ROOT'), + Path("/usr/bin/miniconda3/share/pdk/"), + Path(f"/home/{os.getenv('LOGNAME')}/miniconda3/share/pdk/") +] +pdk_root = None +for path in paths_to_check: + # print(f"\n...Checking for PDK root at: {path}...") + if path.exists(): + pdk_root = path + break + +if not pdk_root: + raise EnvironmentError("PDK root not found in expected locations!") + pdk_root = Path('$PDK_ROOT') lvs_schematic_ref_file = openfasoc_dir / "common" / "platforms" / "sky130hd" / "cdl" / "sky130_fd_sc_hd.spice" magic_drc_file = pdk_root / "sky130A" / "libs.tech" / "magic" / "sky130A.magicrc" From 64a53624f7ed722a57414a31bb04694329f7cb48 Mon Sep 17 00:00:00 2001 From: Shubham Kumar Date: Thu, 27 Jun 2024 20:02:52 +0530 Subject: [PATCH 3/3] Added EnvironmentError if pdk_root not found at expexted locations --- .../flow/pdk/sky130_mapped/sky130_mapped.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py b/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py index 316be14b5..8d4cd2134 100644 --- a/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py +++ b/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py @@ -1,7 +1,7 @@ """ usage: from sky130_mapped import sky130_mapped_pdk """ - +import os from ..mappedpdk import MappedPDK, SetupPDKFiles from ..sky130_mapped.grules import grulesobj from pathlib import Path @@ -33,7 +33,22 @@ openfasoc_dir = Path(__file__).resolve().parent.parent.parent.parent.parent.parent.parent klayout_drc_file = Path(__file__).resolve().parent / "sky130.lydrc" -pdk_root = Path('$PDK_ROOT') + +paths_to_check = [ + Path('$PDK_ROOT'), + Path("/usr/bin/miniconda3/share/pdk/"), + Path(f"/home/{os.getenv('LOGNAME')}/miniconda3/share/pdk/") +] +pdk_root = None +for path in paths_to_check: + # print(f"\n...Checking for PDK root at: {path}...") + if path.exists(): + pdk_root = path + break + +if not pdk_root: + raise EnvironmentError("PDK root not found in expected locations!") + lvs_schematic_ref_file = openfasoc_dir / "common" / "platforms" / "sky130hd" / "cdl" / "sky130_fd_sc_hd.spice" magic_drc_file = pdk_root / "sky130A" / "libs.tech" / "magic" / "sky130A.magicrc" lvs_setup_tcl_file = pdk_root / "sky130A" / "libs.tech" / "netgen" / "sky130A_setup.tcl"