Skip to content

API

Add a bundle route using the a-star algorithm.

Parameters:

Name Type Description Default
component ProtoTKCell

The component to add the route into.

required
ports1 list[PortLike]

the start ports

required
ports2 list[PortLike]

the end ports

required
straight KCellSpec

the straight-spec to create straights with

required
bend KCellSpec

the bend-spec to create bends with

required
layers Iterable[LayerLike]

the layers to avoid.

required
grid_unit Int

the discretization unit for the a-star algorithm.

500
spacing Length

the spacing between the waveguides in the bundle

required
clearance Length

extra space (um) between the bundle body and any obstacle on layers. Each obstacle polygon is grown by clearance (via kdb.Region.sized) before A* discretization, so the bundle stays clearance away from every obstacle edge. 0.0 (default) preserves the prior behaviour of letting the bundle share an edge with obstacles.

0.0
fan_in FanStrategy

how the start (ports1) bundle is formed. A string ("manhattan", "sbend", "lbend") or a :class:FanStrategySpec dict with a "type" key and optional per-strategy parameters.

'manhattan'
fan_out FanStrategy | None

how the end (ports2) bundle is formed. Same options as fan_in. None (default) inherits fan_in so existing call sites keep working; pass an explicit value to mix strategies.

None

Returns:

Name Type Description
A BundleResult | list[None]

class:BundleResult with per-trace corner polylines,

BundleResult | list[None]

path lengths, and the bundle centerline.

Add a fan-in to a parent component.

Parameters:

Name Type Description Default
component ProtoTKCell

the component to add the fan-in to

required
inputs list[PortLike]

the list of ports to start from

required
straight KCellSpec

the straight-spec to create straights from

required
bend KCellSpec

the bend-spec to create bends from

required
x_bundle Length | None

the x-location (µm) where to form the confluence of the bundle. Will be two bend radii from the inputs if not given.

None
y_bundle Length | None

the y-location (µm) where to form the confluence of the bundle. Will be somewhere in the middle if not given.

None
spacing Length | None

the spacing (µm) between waveguides in the bundle

None
start_dir OrientationChar | None

the start direction of the bundle (derived from ports if not given)

None
strategy FanStrategy

fan-in strategy. A string ("manhattan", "sbend", or "lbend") or a :class:FanStrategySpec dict with a "type" key and optional per-strategy parameters. "manhattan" uses the existing 90°-comb fan-in. "sbend" compresses each wire to the bundle line with a single S-bend per port (useful when the bend radius is tight relative to the port pitch). "lbend" forms an L-shaped per-port fan-in (variable straight + 90° bend + variable straight) so virtual ports land on a common line at spacing pitch with the bundle direction rotated 90° from the input ports. "lbend" requires an explicit lbend_side ("left" or "right") in the strategy dict; "auto" resolution is only available via add_bundle_astar (which sees both port sets). Strategy-specific options (e.g. start_straight, lbend_side, sbend_length) are passed inside the dict, e.g. strategy={"type": "manhattan", "start_straight": 5.0}.

'manhattan'

Returns:

Type Description
NDArray[int64]

(stops, legs) where stops is the (N, 2) int64 array of

list[FanLeg]

bundle-side stop positions and legs is a list of

tuple[NDArray[int64], list[FanLeg]]

class:FanLeg with per-wire corner polylines and exact lengths.

tuple[NDArray[int64], list[FanLeg]]

legs[j] corresponds to stops[j]; legs[j].input_index

tuple[NDArray[int64], list[FanLeg]]

maps back to the caller's inputs list (wires are reordered by

tuple[NDArray[int64], list[FanLeg]]

lateral position). Each leg carries its placed instances

tuple[NDArray[int64], list[FanLeg]]

(legs[j].instances) in start→end order.

Add an a-star route to a component.

Parameters:

Name Type Description Default
component ProtoTKCell

the component to add the route to

required
start PortLike

the start port

required
stop PortLike

the stop port

required
straight KCellSpec

the straight-spec to create straights from

required
bend KCellSpec

the bend-spec to create bends from

required
layers Iterable[LayerLike]

the layers to avoid

required
grid_unit Dbu

the discretization unit for the a-star algorithm

required
clearance Length

extra space (µm) between the route body and any obstacle on layers. Each obstacle polygon is grown by clearance before A* discretization, so the route stays clearance away from every obstacle edge. 0.0 (default) preserves the prior behaviour of letting the route share an edge with obstacles.

0.0

Returns:

Name Type Description
A Route

class:Route whose backbone spans the full polyline

Route

(start port, intermediate corners, stop port) and whose

Route

length is the sum of the placed cells' info["length"]

Route

in µm (corners / path_length remain as aliases).

Deprecated: use add_route_manual(corners=...).

Deprecated: use add_route_manual(steps=...).

Find an a-star route without adding it to the component.

Parameters:

Name Type Description Default
component ProtoTKCell

the component to find the route in

required
start PortLike

the start port

required
stop PortLike

the stop port

required
straight KCellSpec

the straight-spec to create straights from

required
bend KCellSpec

the bend-spec to create bends from

required
layers Iterable[LayerLike]

the layers to avoid

required
grid_unit Dbu

the discretization unit for the a-star algorithm

required
clearance Length

extra space (µm) between the route body and any obstacle on layers. Implemented by polygon-growing the obstacles via kdb.Region.sized before A* discretization (the same mechanism the multilayer engines use).

0.0

Returns:

Type Description
PointsDbu

The corners of the route as a list of points in dbu.

Automatically place instances using openroad-style or tiling mode.

Parameters:

Name Type Description Default
c ProtoTKCell

component/KCell to place instances in.

required
instances list[str] | list[PlacedInstanceSpec]

list of instance names or specs.

required
nets list[PlacementNetSpec] | list[object]

placement netlist — either PlacementNetSpec dicts (pins refer to instance names) or RouteNetSpec objects. When RouteNetSpec objects are given they are auto-converted via derive_placement_nets().

required
mode PlacementMode

"openroad", "tiling", or "auto".

'auto'
objective PlacementObjective | None

objective weights.

None
constraints PlacementConstraints | None

placement constraints.

None
routing_feedback RoutingFeedbackConfig | None

reserved for future routing-in-loop strategies.

None
apply bool

apply placement in-place when True.

True
iterations int

optimizer iteration budget.

30

Returns:

Type Description
PlacementReport

Structured placement report with final locations and metrics.

Run place_auto with mode="openroad".

Run place_auto with mode="tiling".