refactor: separate tech specific code

Make the codebase more PDK-agnostic by moving tech-specific code to `tech.py` and tech specific files (e.g. def files, tile_sizes.yaml) to `tech/<pdkname>` subdirectory.
This commit is contained in:
Uri Shaked
2025-09-13 20:28:48 +03:00
parent c67d54ee54
commit 28fd25f684
57 changed files with 264 additions and 271 deletions
+40
View File
@@ -0,0 +1,40 @@
import glob
import json
import os
from typing import Dict, List, Optional, TypedDict
class Port(TypedDict):
kind: str
name: str
direction: str
description: str
class Sky130Cell(TypedDict):
description: str
file_prefix: str
library: str
name: str
parameters: List[str]
ports: List[Port]
type: str
verilog_name: str
equation: Optional[str]
def create_cell_defs():
json_files = glob.glob("sky130_fd_sc_hd/latest/cells/*/definition.json")
definitions: Dict[str, Sky130Cell] = {}
for json_file in json_files:
with open(json_file) as fh:
definition: Sky130Cell = json.load(fh)
definitions[definition["name"]] = definition
script_dir = os.path.dirname(os.path.realpath(__file__))
with open(f"{script_dir}/cells.json", "w") as fh:
json.dump(definitions, fh)
if __name__ == "__main__":
create_cell_defs()