Validate tech_name in config file iterating over technology dir

We're now validating the tech_name param specified by the user in the config file listing all the subfolders present in the technology folder. If the technology specified is not present as folder, we will emit an error and quit.
This commit is contained in:
Mik Igor 2023-10-27 01:29:27 +02:00 committed by GitHub
parent 5811c5ce99
commit 173e47ae45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -558,16 +558,22 @@ def import_tech():
openram.OPENRAM_TECH = OPENRAM_TECH
# Add all of the paths
tech_found = None
for tech_path in OPENRAM_TECH.split(":"):
debug.check(os.path.isdir(tech_path),
"$OPENRAM_TECH does not exist: {}".format(tech_path))
sys.path.append(tech_path)
debug.info(1, "Adding technology path: {}".format(tech_path))
# Validate tech_name param
techname_lower = OPTS.tech_name.lower()
if (techname_lower is None) or (techname_lower!="sky130" and techname_lower!="scn3me_subm" and techname_lower!="scn4m_subm" and techname_lower!="freepdk45") :
debug.error("tech_name in config file should be sky130|scn3me_subm|scn4m_subm|freepdk45")
# List all tech dirs in that path and check if we can find the tech_name inside
for tech_dir in os.listdir(tech_path):
if tech_dir==OPTS.tech_name :
tech_found = tech_dir
break;
# If the tech_name param specified by the user is not present in the technology folder, emit an error and quit
if (tech_found is None):
debug.error(f"You specified \'tech_name={OPTS.tech_name}\' in your config file, but that technology is not present in the technologies folder!")
quit()
# Import the tech