optical pins name revised. Pin type added

This commit is contained in:
=
2026-06-07 22:56:33 +08:00
parent a4ac88f002
commit 8462c3397f
262 changed files with 3251 additions and 1134 deletions
Binary file not shown.
+19 -2
View File
@@ -34,7 +34,6 @@ _PRIMITIVE_BUILDER_SPEC.loader.exec_module(_primitive_builder)
bootstrap_technology = _primitive_builder.bootstrap_technology
build_context = _primitive_builder.build_context
build_kwargs = _primitive_builder.build_kwargs
build_top_cell = _primitive_builder.build_top_cell
discover_primitive_classes = _primitive_builder.discover_primitive_classes
get_cell = _primitive_builder.get_cell
safe_name = _primitive_builder.safe_name
@@ -68,6 +67,7 @@ STATUS_STYLES = {
"skipped": ("-", "yellow", "Skipped"),
"failed": ("x", "red", "Failed"),
}
PIN_NAME_EXCLUDE = {"org"}
def colorize(text: str, color: str) -> str:
@@ -113,6 +113,23 @@ def image_subdir_for_module(module_name: str, package_root: str) -> Path:
return Path(*parts)
def visible_pin_names(cell: nd.Cell) -> list[str]:
"""Return all user-facing cell pins in deterministic cell order."""
return [name for name in cell.pin if name not in PIN_NAME_EXCLUDE]
def build_image_top_cell(cell: nd.Cell, top_name: str) -> nd.Cell:
"""Build a plotting wrapper that exposes and draws every component pin."""
pin_names = visible_pin_names(cell)
with nd.Cell(name=top_name, instantiate=False) as top_cell:
instance = cell.put(0, 0, 0)
if pin_names:
instance.raise_pins(pin_names, pin_names)
nd.put_stub(pinname=pin_names, pinsize=0.8)
return top_cell
def generate_image_for_class(
target_dir: Path,
class_name: str,
@@ -124,7 +141,7 @@ def generate_image_for_class(
"""Instantiate one component class and save its cell image."""
kwargs = build_kwargs(component_class, device_name, context)
instance = component_class(**kwargs)
top_cell = build_top_cell(get_cell(instance), top_name)
top_cell = build_image_top_cell(get_cell(instance), top_name)
target_dir.mkdir(parents=True, exist_ok=True)
image_path = target_dir / f"{class_name}.png"