Replace hardcoded PDK paths with environment variable based paths for portability

This commit is contained in:
engrvip123 2025-07-11 12:03:46 +05:30
parent 7373e32470
commit f399a5e6e5
2 changed files with 18 additions and 4 deletions

View File

@ -1,8 +1,15 @@
import os
from mosplot.lookup_table_generator.simulators import NgspiceSimulator, HspiceSimulator
from mosplot.lookup_table_generator import LookupTableGenerator, TransistorSweep
# One of `include_paths` or `lib_mappings` must be specified.
# The rest are optional.
# Read environment variables to build model path
PDK_ROOT = os.environ["PDK_ROOT"]
PDK = os.environ["PDK"]
model_path = os.path.join(PDK_ROOT, PDK, "libs.tech/ngspice/models/cornerMOSlv.lib")
ngspice = NgspiceSimulator(
# Provide path to simulator if simulator is not in system path.
simulator_path="ngspice",
@ -15,8 +22,8 @@ ngspice = NgspiceSimulator(
# Files to include with `.LIB`.
lib_mappings = [
("/home/pedersen/IHP-Open-PDK/ihp-sg13g2/libs.tech/ngspice/models/cornerMOSlv.lib", " mos_tt") # Put your own path to the corner lib
lib_mappings = [
(model_path, "mos_tt")
],
# If the transistor is defined inside a subcircuit in

View File

@ -1,8 +1,15 @@
import os
from mosplot.lookup_table_generator.simulators import NgspiceSimulator, HspiceSimulator
from mosplot.lookup_table_generator import LookupTableGenerator, TransistorSweep
# One of `include_paths` or `lib_mappings` must be specified.
# The rest are optional.
# Read environment variables to build model path
PDK_ROOT = os.environ["PDK_ROOT"]
PDK = os.environ["PDK"]
model_path = os.path.join(PDK_ROOT, PDK, "libs.tech/ngspice/models/cornerMOSlv.lib")
ngspice = NgspiceSimulator(
# Provide path to simulator if simulator is not in system path.
simulator_path="ngspice",
@ -15,8 +22,8 @@ ngspice = NgspiceSimulator(
# Files to include with `.LIB`.
lib_mappings = [
("/home/pedersen/IHP-Open-PDK/ihp-sg13g2/libs.tech/ngspice/models/cornerMOSlv.lib", " mos_tt") # Put your own path to the corner lib
lib_mappings = [
(model_path, "mos_tt")
],
# If the transistor is defined inside a subcircuit in