上传文件至「mxpic_router」
This commit is contained in:
+22
-4
@@ -71,16 +71,17 @@ def _build_cell(spec: CellSpec, built_cells: dict, pdk_root: str, prefer_full_gd
|
||||
pin_map = {}
|
||||
with nd.Cell(name=spec.name) as top:
|
||||
for instance_name, instance in spec.instances.items():
|
||||
layout_rotation = _layout_rotation(instance.rotation)
|
||||
if _is_basic_component(instance.component):
|
||||
basic_cell = _build_basic_component(instance, nd)
|
||||
placed = basic_cell.put(instance.x, instance.y, instance.rotation, flip=instance.flip, flop=instance.flop)
|
||||
placed = basic_cell.put(instance.x, instance.y, layout_rotation, flip=instance.flip, flop=instance.flop)
|
||||
for pin_name in getattr(placed, "pin", {}):
|
||||
if pin_name != "org":
|
||||
pin_map[(instance_name, pin_name)] = placed.pin[pin_name]
|
||||
continue
|
||||
|
||||
if instance.component in built_cells:
|
||||
placed = built_cells[instance.component].put(instance.x, instance.y, instance.rotation, flip=instance.flip, flop=instance.flop)
|
||||
placed = built_cells[instance.component].put(instance.x, instance.y, layout_rotation, flip=instance.flip, flop=instance.flop)
|
||||
for pin_name in getattr(placed, "pin", {}):
|
||||
if pin_name != "org":
|
||||
pin_map[(instance_name, pin_name)] = placed.pin[pin_name]
|
||||
@@ -91,7 +92,7 @@ def _build_cell(spec: CellSpec, built_cells: dict, pdk_root: str, prefer_full_gd
|
||||
warnings.append(f"Missing GDS for {instance_name}: {instance.component}")
|
||||
continue
|
||||
loaded = nd.load_gds(asset["gds_path"])
|
||||
loaded.put(instance.x, instance.y, instance.rotation, flip=instance.flip, flop=instance.flop)
|
||||
loaded.put(instance.x, instance.y, layout_rotation, flip=instance.flip, flop=instance.flop)
|
||||
_register_metadata_pins(pin_map, instance_name, instance, asset.get("metadata") or {}, nd, pdk_root)
|
||||
|
||||
for pin_name, pin in spec.pins.items():
|
||||
@@ -227,6 +228,7 @@ def _safe_cell_name(value: str) -> str:
|
||||
|
||||
|
||||
def _register_metadata_pins(pin_map, instance_name, instance, metadata: dict, nd, pdk_root: str) -> None:
|
||||
layout_rotation = _layout_rotation(instance.rotation)
|
||||
for pin_name, pin in _metadata_pins(metadata, pdk_root).items():
|
||||
x, y, angle = _transform_port(
|
||||
_safe_float(pin.get("x"), 0.0),
|
||||
@@ -234,7 +236,7 @@ def _register_metadata_pins(pin_map, instance_name, instance, metadata: dict, nd
|
||||
_safe_float(pin.get("a", pin.get("angle")), 0.0),
|
||||
instance.x,
|
||||
instance.y,
|
||||
instance.rotation,
|
||||
layout_rotation,
|
||||
instance.flip,
|
||||
instance.flop,
|
||||
)
|
||||
@@ -474,6 +476,8 @@ def _route_method_name_for_pins(pin1, pin2) -> str:
|
||||
delta = (angle2 - angle1) % 360
|
||||
if delta <= 1e-6 or abs(delta - 360) <= 1e-6:
|
||||
return "ubend_p2p"
|
||||
if abs(delta - 90) <= 1e-6 or abs(delta - 270) <= 1e-6:
|
||||
return "strt_bend_strt_p2p"
|
||||
if 120 < delta < 240:
|
||||
return "sbend_p2p"
|
||||
return "bend_p2p"
|
||||
@@ -562,6 +566,10 @@ def _transform_port(px: float, py: float, pa: float, ix: float, iy: float, rotat
|
||||
return ix + px * c - py * s, iy + px * s + py * c, (pa + rotation) % 360
|
||||
|
||||
|
||||
def _layout_rotation(eda_rotation: float) -> float:
|
||||
return -(_safe_float(eda_rotation, 0.0) or 0.0)
|
||||
|
||||
|
||||
def _safe_float(value, default=0.0):
|
||||
if value is None:
|
||||
return default
|
||||
@@ -620,6 +628,16 @@ class _NazcaInterconnectRoute:
|
||||
arrow=arrow,
|
||||
)
|
||||
|
||||
def strt_bend_strt_p2p(self, pin1=None, pin2=None, width=None, radius=None, xs=None, arrow=True, **kwargs):
|
||||
return self._interconnect.strt_bend_strt_p2p(
|
||||
pin1=pin1,
|
||||
pin2=pin2,
|
||||
width=self._route_width(width),
|
||||
radius=self._route_radius(radius),
|
||||
xs=self._route_xs(xs),
|
||||
arrow=arrow,
|
||||
)
|
||||
|
||||
def bend_p2p(self, pin1=None, pin2=None, width=None, radius=None, xs=None, arrow=True, **kwargs):
|
||||
route_method = getattr(self._interconnect, "bend_strt_bend_p2p", None)
|
||||
if route_method is None:
|
||||
|
||||
Reference in New Issue
Block a user