Routing problem for multi-pin port and anchors are debugged

This commit is contained in:
2026-05-31 22:16:44 +08:00
parent 9b4e8da796
commit ce7f6e95c4
36 changed files with 2470 additions and 676 deletions
+18 -1
View File
@@ -107,7 +107,24 @@ class PdkRegistry:
if not yaml_path:
return None
with open(yaml_path, "r", encoding="utf-8") as file:
return yaml.safe_load(file) or {}
data = yaml.safe_load(file) or {}
return self._normalize_pdk_pins(data)
def _normalize_pdk_pins(self, data: dict) -> dict:
"""Treat legacy PDK `ports` metadata as `pins` inside approved PDK roots."""
if (
self._allows_legacy_ports_as_pins()
and isinstance(data, dict)
and "pins" not in data
and isinstance(data.get("ports"), dict)
):
data = dict(data)
data["pins"] = data["ports"]
return data
def _allows_legacy_ports_as_pins(self) -> bool:
normalized = self.public_root.replace("\\", "/").lower()
return "/opt_pdk_public/" in f"{normalized}/" or "/opt_pdk_atlas/" in f"{normalized}/"
def _inside_root(self, path: str) -> bool:
"""Check that a candidate asset path remains inside the permitted PDK root."""