mirror of
https://github.com/TinyTapeout/tt-support-tools.git
synced 2026-11-03 12:46:08 +01:00
feat(tt_util): create a pdk.json file with pdk name / version info
This file replaces the old "FLOW_VERSION" and "PDK_SOURCES"
This commit is contained in:
+15
-10
@@ -535,14 +535,20 @@ class Project:
|
|||||||
indent=2,
|
indent=2,
|
||||||
)
|
)
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
|
run_dir = os.path.join(self.local_dir, "runs/wokwi")
|
||||||
with open("runs/wokwi/FLOW_VERSION", "w") as f:
|
with open(os.path.join(run_dir, "resolved.json"), "r") as f:
|
||||||
resolved_json_path = "runs/wokwi/resolved.json"
|
ll_config = json.load(f)
|
||||||
config = json.load(open(os.path.join(self.local_dir, resolved_json_path)))
|
librelane_version = ll_config["meta"]["librelane_version"]
|
||||||
librelane_version = config["meta"]["librelane_version"]
|
with open(os.path.join(run_dir, "pdk.json"), "w") as f:
|
||||||
f.write(f"LibreLane {librelane_version}\n")
|
pdk_version_info = self.tech.read_pdk_version(ll_config["PDK_ROOT"])
|
||||||
with open("runs/wokwi/PDK_SOURCES", "w") as f:
|
pdk_json = {
|
||||||
f.write(self.tech.read_pdk_version(config["PDK_ROOT"]))
|
"FLOW_NAME": "LibreLane",
|
||||||
|
"FLOW_VERSION": librelane_version,
|
||||||
|
"PDK": ll_config["PDK"],
|
||||||
|
"PDK_SOURCE": pdk_version_info["source"],
|
||||||
|
"PDK_VERSION": pdk_version_info["version"],
|
||||||
|
}
|
||||||
|
json.dump(pdk_json, f, indent=2)
|
||||||
|
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
@@ -566,8 +572,7 @@ class Project:
|
|||||||
layout.write(oas_file)
|
layout.write(oas_file)
|
||||||
|
|
||||||
files_to_copy = [
|
files_to_copy = [
|
||||||
os.path.join(run_dir, "FLOW_VERSION"),
|
os.path.join(run_dir, "pdk.json"),
|
||||||
os.path.join(run_dir, "PDK_SOURCES"),
|
|
||||||
os.path.join(run_dir, "resolved.json"),
|
os.path.join(run_dir, "resolved.json"),
|
||||||
os.path.join(final_dir, "commit_id.json"),
|
os.path.join(final_dir, "commit_id.json"),
|
||||||
os.path.join(final_dir, "gds", f"{top_module}.gds"),
|
os.path.join(final_dir, "gds", f"{top_module}.gds"),
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ class CellDefinition(TypedDict):
|
|||||||
description: str
|
description: str
|
||||||
|
|
||||||
|
|
||||||
|
class PDKVersionInfo(TypedDict):
|
||||||
|
source: str
|
||||||
|
version: str
|
||||||
|
|
||||||
|
|
||||||
class Tech(Protocol):
|
class Tech(Protocol):
|
||||||
def_suffix: str
|
def_suffix: str
|
||||||
librelane_pdk_args: str
|
librelane_pdk_args: str
|
||||||
@@ -31,13 +36,20 @@ class Tech(Protocol):
|
|||||||
""" Lists all of the extra logo macros that need to be copied to the tt_top directory. """
|
""" Lists all of the extra logo macros that need to be copied to the tt_top directory. """
|
||||||
extra_logo_macros: List[str]
|
extra_logo_macros: List[str]
|
||||||
|
|
||||||
def read_pdk_version(self, pdk_root: str) -> str:
|
def read_pdk_version(self, pdk_root: str) -> PDKVersionInfo:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def load_cell_definitions(self) -> Dict[str, CellDefinition]:
|
def load_cell_definitions(self) -> Dict[str, CellDefinition]:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
|
def parse_openpdks_pdk_version(sources_file: str) -> PDKVersionInfo:
|
||||||
|
with open(sources_file) as f:
|
||||||
|
pdk_source, pdk_version = f.read().strip().split(" ")
|
||||||
|
assert pdk_source == "open_pdks"
|
||||||
|
return PDKVersionInfo(source=pdk_source, version=pdk_version)
|
||||||
|
|
||||||
|
|
||||||
class Sky130Tech(Tech):
|
class Sky130Tech(Tech):
|
||||||
def_suffix = "pg"
|
def_suffix = "pg"
|
||||||
librelane_pdk_args = ""
|
librelane_pdk_args = ""
|
||||||
@@ -75,10 +87,9 @@ class Sky130Tech(Tech):
|
|||||||
]
|
]
|
||||||
extra_logo_macros = []
|
extra_logo_macros = []
|
||||||
|
|
||||||
def read_pdk_version(self, pdk_root: str) -> str:
|
def read_pdk_version(self, pdk_root: str) -> PDKVersionInfo:
|
||||||
pdk_sources_file = os.path.join(pdk_root, "sky130A", "SOURCES")
|
pdk_sources_file = os.path.join(pdk_root, "sky130A", "SOURCES")
|
||||||
with open(pdk_sources_file) as f:
|
return parse_openpdks_pdk_version(pdk_sources_file)
|
||||||
return f.read()
|
|
||||||
|
|
||||||
def load_cell_definitions(self) -> Dict[str, CellDefinition]:
|
def load_cell_definitions(self) -> Dict[str, CellDefinition]:
|
||||||
URL_FORMAT = "https://skywater-pdk.readthedocs.io/en/main/contents/libraries/sky130_fd_sc_hd/cells/{name}/README.html"
|
URL_FORMAT = "https://skywater-pdk.readthedocs.io/en/main/contents/libraries/sky130_fd_sc_hd/cells/{name}/README.html"
|
||||||
@@ -123,11 +134,11 @@ class IHPTech(Tech):
|
|||||||
"tech/ihp-sg13g2/tt_logo_corner",
|
"tech/ihp-sg13g2/tt_logo_corner",
|
||||||
]
|
]
|
||||||
|
|
||||||
def read_pdk_version(self, pdk_root: str) -> str:
|
def read_pdk_version(self, pdk_root: str) -> PDKVersionInfo:
|
||||||
pdk_repo = Repo(pdk_root)
|
pdk_repo = Repo(pdk_root)
|
||||||
pdk_repo_name = list(pdk_repo.remotes[0].urls)[0].split("/")[-1]
|
pdk_repo_name = list(pdk_repo.remotes[0].urls)[0].split("/")[-1]
|
||||||
pdk_commit = pdk_repo.commit().hexsha
|
pdk_commit = pdk_repo.commit().hexsha
|
||||||
return f"{pdk_repo_name} {pdk_commit}"
|
return PDKVersionInfo(source=pdk_repo_name, version=pdk_commit)
|
||||||
|
|
||||||
def load_cell_definitions(self) -> Dict[str, CellDefinition]:
|
def load_cell_definitions(self) -> Dict[str, CellDefinition]:
|
||||||
URL_FORMAT = "https://raw.githubusercontent.com/IHP-GmbH/IHP-Open-PDK/refs/heads/main/ihp-sg13g2/libs.ref/sg13g2_stdcell/doc/sg13g2_stdcell_typ_1p20V_25C.pdf#{ref}"
|
URL_FORMAT = "https://raw.githubusercontent.com/IHP-GmbH/IHP-Open-PDK/refs/heads/main/ihp-sg13g2/libs.ref/sg13g2_stdcell/doc/sg13g2_stdcell_typ_1p20V_25C.pdf#{ref}"
|
||||||
|
|||||||
Reference in New Issue
Block a user