Refine routing geometry checks and streamline documentation
Report coincident terminals and unusable seeds per net, update custom bend handling and verification, and cover the revised behavior with regression tests. Shorten the user and developer guides around reader tasks and keep the illustrated routing walkthrough and reference links easy to find.
This commit is contained in:
parent
8b32d68496
commit
eac083a37d
4 changed files with 1034 additions and 594 deletions
|
|
@ -1,6 +1,8 @@
|
|||
# Public API reference
|
||||
|
||||
Import these types from `inire`. To see how the inputs fit together in a runnable design, start with the [layout guide](route-a-layout.md#define-the-inputs).
|
||||
Import these types from `inire`.
|
||||
|
||||
- [Runnable layout example](route-a-layout.md#define-the-inputs)
|
||||
|
||||
## Route a problem
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ Import these types from `inire`. To see how the inputs fit together in a runnabl
|
|||
route(problem, *, options=None, iteration_callback=None) -> RoutingRunResult
|
||||
```
|
||||
|
||||
Omitting `options` uses `RoutingOptions()`. To observe progress, pass a callable accepting `(index, results_by_net)`. Each call receives a snapshot of the nets in one completed congestion iteration. Indices increase across attempts. An iteration that times out can consume an index without calling back. Automatic mode uses the same planner order with or without a callback. Check the returned result for final coverage, including on runs that finish without a callback.
|
||||
The default is `RoutingOptions()`. The progress callback accepts `(index, results_by_net)` for each completed congestion iteration. Indices increase across attempts, with gaps for timeouts. Use the returned result for final coverage.
|
||||
|
||||
For a zero-node attempt that completes its replay iteration, the callback receives the verified results after any refinement.
|
||||
|
||||
|
|
@ -17,7 +19,7 @@ For a zero-node attempt that completes its replay iteration, the callback receiv
|
|||
### Ports and nets
|
||||
|
||||
- `Port(x, y, r)` rounds coordinates to integers. The heading `r` is in degrees, with 0 east, 90 north, 180 west, and 270 south. The rounded angle must be a multiple of 90 and is wrapped to the range 0–359.
|
||||
- `NetSpec(net_id, start, target, width=2.0)` uses a unique string ID, two ports, and a finite positive width. Set the start heading to the direction of departure and the target heading to the direction of arrival. If both snapped ports are identical, connect the placed ports directly and omit that net from the routing problem.
|
||||
- `NetSpec(net_id, start, target, width=2.0)` uses a unique string ID, two ports, and a finite positive width. Set the start heading to the direction of departure and the target heading to the direction of arrival. Identical snapped ports produce an `unroutable` result with a `terminal_error` for that net. This diagnostic appears in the final results and iteration callbacks. The router plans the remaining nets and ignores seeds for coincident ports. Check the placed connection directly when the ports are intended to abut.
|
||||
|
||||
### RoutingProblem
|
||||
|
||||
|
|
@ -30,13 +32,15 @@ The fields below appear in constructor order. Use one layout unit for coordinate
|
|||
| `static_obstacles` | `()` | Valid, nonempty Shapely `Polygon` objects in board coordinates that define routing keepouts. Coordinates may be fractional. |
|
||||
| `initial_paths` | Empty mapping | A read-only snapshot of net IDs mapped to `PathSeed` objects. Supply a new mapping to change seeds. |
|
||||
| `clearance` | `2.0` | Finite, nonnegative spacing required between distinct nets and between a net and a keepout. At zero clearance, distinct nets must still be disjoint, including at vertices. Boundary contact with a keepout is allowed. |
|
||||
| `safety_zone_radius` | `0.0021` | Tolerance for small keepout intersections at a move's endpoints during search. |
|
||||
| `self_clearance` | `0.0` | Optional spacing within one net. Applies between components when the intervening centerline is at least this long. Adjacent joins and components immediately on either side of one bend are exempt. Unintended contact is always checked. |
|
||||
| `safety_zone_radius` | `0.0021` | Distance around move endpoints where a local proxy intersection can be rechecked against the physical polygons. The physical polygons must meet clearance. Also supplies the margin for the optimistic connectivity estimate in automatic mode. |
|
||||
| `self_clearance` | `0.0` | Optional spacing within one net. Applies between components when the intervening centerline is at least this long. Adjacent joins and components immediately on either side of one bend are exempt. At an adjacent join involving a custom outline, boundary contact is allowed and area overlap is a collision. |
|
||||
| `fixed_routes` | `()` | Completed or imported net geometry supplied as `FixedRoute(net_id, polygons)`. Search and verification check clearance to fixed routes using the physical outlines. IDs must be unique across fixed and active nets. |
|
||||
|
||||
## Path seeds
|
||||
|
||||
`PathSeed(segments)` holds an ordered tuple of `StraightSeed(length)`, `Bend90Seed(radius, direction)`, and `SBendSeed(offset, radius)` moves. Lengths and radii must be finite and positive. When routing a seed, straight lengths are rounded to the nearest grid unit, with ties rounded to even and a minimum of one unit. Bend directions are `"CW"` and `"CCW"`. S-bend offsets must be nonzero integers with magnitude less than twice the radius. A seed is materialized from the net's current start port using its width and the run's geometry options. A radius absent from the corresponding option list raises `ValueError`. Search skips seeds with a configured bend radius below half the net width. For a workflow that starts from an existing route, see [Reuse an existing route](route-a-layout.md#reuse-an-existing-route).
|
||||
`PathSeed(segments)` holds an ordered tuple of `StraightSeed(length)`, `Bend90Seed(radius, direction)`, and `SBendSeed(offset, radius)` moves. Lengths and radii must be finite and positive. When routing a seed, straight lengths are rounded to the nearest grid unit, with ties rounded to even and a minimum of one unit. Bend directions are `"CW"` and `"CCW"`. S-bend offsets must be nonzero integers with magnitude less than twice the radius. A seed is materialized from the net's current start port using its width and the run's geometry options. Moves that use a generated circular outline or a proxy derived from one require a radius of at least half the net width.
|
||||
|
||||
A disabled radius or offset discards the seed and sets the net's `seed_error`. Active search can route the net from scratch. Zero-node replay still checks the other seeds. Unknown net IDs raise `ValueError`.
|
||||
|
||||
## Results
|
||||
|
||||
|
|
@ -47,13 +51,13 @@ The fields below appear in constructor order. Use one layout unit for coordinate
|
|||
| `RoutingResult.requested_net` and `effective_net` | The net as supplied and the net used by the worker, including resolved headings. |
|
||||
| `RoutingResult.path` | Ordered path components from the source to the last reached state. Each component carries its move specification and placed start and end ports. An unroutable result has an empty path. |
|
||||
| `RoutingResult.reached_target` | Whether the path reached the target position and heading. With heading inference, the check uses the chosen heading. Read `is_valid` for the result of geometry verification. |
|
||||
| `RoutingResult.report` | `total_length` in layout units plus static, dynamic, and self-collision counts. `out_of_bounds` flags geometry outside the board. `discontinuous` flags missing or point-only joins, including at terminal faces. `invalid_geometry` flags invalid or empty physical polygons. `seed_error` identifies a supplied bend that cannot carry the net's width or cannot be safely materialized. `terminal_error` identifies an inaccessible start or target face. |
|
||||
| `RoutingResult.report` | `total_length` in layout units plus static, dynamic, and self-collision counts. `out_of_bounds` flags geometry outside the board. `invalid_geometry` flags invalid polygons or a rejected seed that produced no path. `seed_error` describes a seed rejected by the configured move options or by geometry preparation. `terminal_error` identifies coincident ports or an inaccessible start or target face. |
|
||||
| `RoutingResult.as_seed()` | The ordered moves for [saving a placement recipe](route-a-layout.md#save-a-placement-recipe) or replaying a path. |
|
||||
| `RoutingResult.locked_geometry` | Physical polygons checked during routing. Use these to inspect the route or [reserve a completed net](route-a-layout.md#reuse-an-existing-route). |
|
||||
| `RoutingRunResult.automatic` | In automatic mode, the selected planner, verified IDs, stage history, and any capacity or port-conflict bound. `None` for explicit modes. |
|
||||
| `RoutingRunResult.topology` and `metrics` | Corridor counts and seed work when reported by the selected worker, plus work counters across the run. |
|
||||
|
||||
Check `is_valid` and keep the effective net and geometry settings with each placement recipe. [Placement workflow](route-a-layout.md#save-a-placement-recipe)
|
||||
Check the continuity of the assembled polygons in your layout tool. The legacy `discontinuous` field stays false on new routing reports.
|
||||
|
||||
For structured logging, `dataclasses.asdict(run)` preserves the per-net fields. Choose how to encode the Shapely polygons when writing JSON.
|
||||
|
||||
|
|
@ -78,24 +82,26 @@ For structured logging, `dataclasses.asdict(run)` preserves the per-net fields.
|
|||
| `min_straight_length` | `5.0` | Finite, nonnegative minimum length for regular forward moves in lattice search. |
|
||||
| `max_straight_length` | `2000.0` | Finite, positive maximum distance for the forward scan in lattice search. |
|
||||
| `greedy_h_weight` | `1.5` | Finite, nonnegative weight on the estimated cost still needed to reach the target. Lower values give more influence to the cost of the path so far. |
|
||||
| `bend_radii` | `(50.0, 100.0)` | Finite, positive radii permitted for 90-degree bends in search and seeds. Each move needs a radius of at least half its net width. Fractional radii retain their curvature and extend both tangents to the next grid point. An empty list disables 90-degree bends. |
|
||||
| `sbend_radii` | `(10.0,)` | Finite, positive radii permitted for S-bends in search and seeds, subject to the same width requirement. An empty list disables S-bends. |
|
||||
| `bend_radii` | `(50.0, 100.0)` | Finite, positive radii permitted for 90-degree bends in search and seeds. Generated circular outlines and proxies derived from them require a radius of at least half the net width. Fractional circular radii retain their curvature and extend both tangents to the next grid point. An empty list disables 90-degree bends. |
|
||||
| `sbend_radii` | `(10.0,)` | Finite, positive radii permitted for S-bends in search and seeds. Generated S-bends require a radius of at least half the net width. An empty list disables S-bends. |
|
||||
| `sbend_offsets` | `None` | `None` lets the router choose signed lateral offsets. An explicit list restricts routing and seeds to those offsets after rounding to the grid. An empty list disables S-bends. |
|
||||
| `bend_collision_type` | `"arc"` | Search proxy, one of `"arc"`, `"bbox"`, or `"clipped_bbox"`. The legacy polygon form defines both shapes unless split geometry is supplied. |
|
||||
| `bend_proxy_geometry` | `None` | Override the bend proxy. A polygon applies to 90-degree bends. A custom polygon proxy by itself keeps the standard physical arc and emits a warning. |
|
||||
| `bend_physical_geometry` | `None` | Override 90-degree bend geometry with `"arc"` or a polygon. A custom physical polygon also supplies the default proxy when the collision type is `"arc"`. Define the polygon relative to the arc center and include both tangent extensions for a fractional radius. |
|
||||
| `bend_clip_margin` | `None` | Optional legacy shrink margin for `"clipped_bbox"`. The default uses an eight-point proxy for each arc and extends it along any grid tangents. |
|
||||
| `visibility_guidance` | `"tangent_corner"` | Choose tangent candidates, local visibility tests from indexed corners with `"exact_corner"`, or no visibility suggestions with `"off"`. |
|
||||
| `sbend_outlines` | `()` | Complete custom S-bend polygons, supplied as `SBendOutline(offset, radius, width, polygon)` entries. Each entry applies to its signed offset, radius, and net width. |
|
||||
| `sbend_outlines` | `()` | Complete custom S-bend polygons, supplied as `SBendOutline(offset, radius, width, polygon)` entries. An entry applies when its signed offset and radius are enabled and its width matches the net. Disabled entries stay registered for reuse with other search settings. |
|
||||
| `proximity_range` | `10.0` | Obstacle proximity scoring range in layout units. Scale it with the coordinates when changing units. Large perimeters use an exact boundary index once the sample budget is reached. |
|
||||
| `bend_physical_length` | `None` | Optional authored centerline length for the shared custom 90-degree template, including tangent extensions. Search, refinement, and reports use it when supplied. |
|
||||
| `distance_heuristic_weight` | `1.0` | Finite, nonnegative multiplier for the remaining-distance term only. Increase it to favor progress toward the target relative to estimated turn penalties. The routed path's objective stays the same. |
|
||||
|
||||
A custom S-bend outline uses local coordinates. Its input face is centered at `(0, 0)`, its output face at `(span, offset)`, and both ports face east. Use the same grid span as `SBendSeed(offset, radius)`, including any tangent extension to reach the output face. For example, an offset of `40` with radius `50` has its output at `(80, 40)`. The router rotates and translates the entire outline and uses it for collision checks and seed replay. Supply a separate outline to customize the opposite offset. Width matching allows a relative difference of `1e-12` to account for floating-point conversions. An ambiguous match raises an error. Unmatched moves use the circular S-bend. Set `SBendOutline.length` to use a process-specific centerline length for scoring, refinement, and reporting. The default is the nominal circular length. Automatic mode uses lattice search when a registered outline matches a net width. Bundle mode requires circular bends for its nets.
|
||||
A custom S-bend outline uses local coordinates. Its input face is centered at `(0, 0)`, its output face at `(span, offset)`, and both ports face east. Use the same grid span as `SBendSeed(offset, radius)`, including any tangent extension to reach the output face. For example, an offset of `40` with radius `50` has its output at `(80, 40)`. The router rotates and translates the entire outline and uses it for collision checks and seed replay. Supply a separate outline to customize the opposite offset. Width matching allows a relative difference of `1e-12` to account for floating-point conversions. An ambiguous match raises an error. Unmatched moves use the circular S-bend. Set `SBendOutline.length` to use a process-specific centerline length for scoring, refinement, and reporting. The default is the nominal circular length. Automatic mode uses lattice search when an enabled outline matches a net width. Bundle mode requires circular bends for its nets.
|
||||
|
||||
When migrating a half-arc template, supply the complete outline through `sbend_outlines` and keep `bend_physical_geometry` for custom 90-degree bends. Both terminal faces of each custom polygon must be centered on their ports and match the routed width. A custom 90-degree template is shared across nets, so it can only be used by nets whose width matches its faces. Replay an `SBendSeed` with the same outlines and bend settings to recover its physical geometry.
|
||||
When migrating a half-arc template, supply the complete outline through `sbend_outlines` and keep `bend_physical_geometry` for custom 90-degree bends. Center the faces on their declared ports and match the routed width to assemble the result. `SBendOutline` warns if its polygon disagrees with its declared ports. When a custom 90-degree outline appears in a result, `route()` warns about port mismatches once per radius and net width. Use Python's warning filters to treat these mismatches as errors. Replay an `SBendSeed` with the same outlines and bend settings to recover its physical geometry.
|
||||
|
||||
When a net can use a custom outline, search checks the geometry of each candidate move at its terminals. Seed replay verifies the materialized faces.
|
||||
Search and replay use placed custom outlines for board containment. When a declared port lies outside the board, proximity scoring samples the nearest point on the placed outline. Final verification checks the placed polygons against the board, keepouts, and other routes.
|
||||
|
||||
For a complete custom S-bend outline, or a custom 90-degree bend with a custom polygon proxy, the radius determines the declared snapped endpoints. Use the supplied polygons to represent the process geometry.
|
||||
|
||||
Circular bends approximate the outer edge within a sagitta of 0.01 layout units. The router also sizes the subdivision for the outer edge of a clearance-expanded circular proxy. A generated circular arc that needs more than 250,000 subdivisions is rejected before sampling. Use coarser layout units if the required radii exceed this limit.
|
||||
|
||||
|
|
@ -135,7 +141,7 @@ Increase the iteration limit when later reroutes might resolve conflicts. Adjust
|
|||
|
||||
### TopologyOptions
|
||||
|
||||
For a layout that repeatedly stops short at an opening, `guide` can suggest a passage while letting search choose where to turn. To compare this with realizing a physical starting path in `seed`, see the [routing mode choices](tune-and-troubleshoot.md#choose-a-routing-mode).
|
||||
|
||||
|
||||
| Field | Default | Effect |
|
||||
| --- | --- | --- |
|
||||
|
|
@ -159,4 +165,4 @@ The flags default to `False`.
|
|||
| `capture_frontier_trace` | See why search pruned moves near a final route conflict. |
|
||||
| `capture_pre_pair_frontier_trace` | Inspect the routing state before pair-local repair. |
|
||||
|
||||
For the corresponding result fields and a worked trace, see the [developer diagnostics](../routing-diagnostics.md#traces).
|
||||
- [Diagnostics fields and worked trace](../routing-diagnostics.md#traces)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# Route with process constraints
|
||||
|
||||
Inire checks routed-path continuity, board containment, and clearance for the geometry in the routing problem. Use the placed-cell and process data for port compatibility, layer assignment, and length tolerances. Keep that context with each [placement recipe](route-a-layout.md#save-a-placement-recipe) when assembling the layout.
|
||||
Keep the layer and process rules with each [placement recipe](route-a-layout.md#save-a-placement-recipe). Check physical joins in the assembled layout.
|
||||
|
||||
## Check placed optical ports
|
||||
|
||||
Read the physical widths from the placed devices' port metadata. `PlacedPort.connect` checks both declared widths before constructing the constant-width net.
|
||||
`PlacedPort.connect` checks that the placed devices have matching port widths.
|
||||
|
||||
```python
|
||||
from inire import Port
|
||||
|
|
@ -15,7 +15,7 @@ taper_input = PlacedPort(Port(70000, 10000, 0), width=500)
|
|||
net = source.connect("source_to_taper", taper_input)
|
||||
```
|
||||
|
||||
For a 3,000 nm target, place the 40 µm taper with its 500 nm face at `taper_input` and its 3,000 nm face abutting the target. Use routing keepouts with local openings for the terminal leads. When you assemble the layout, place the verified route against the device ports and check the physical joins. [EBeam taper cell](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/gds/EBeam/ebeam_routing_taper_te1550_w%3D500nm_to_w%3D3000nm_L%3D40um.gds)
|
||||
Place the 40 µm [EBeam taper](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/gds/EBeam/ebeam_routing_taper_te1550_w%3D500nm_to_w%3D3000nm_L%3D40um.gds) with the 500 nm face at `taper_input` and the 3,000 nm face at the target. Leave access for the route in the device keepouts.
|
||||
|
||||
## Preserve length-sensitive paths
|
||||
|
||||
|
|
@ -30,11 +30,11 @@ if preserves_length(replacement, authored_length, length_tolerance):
|
|||
placement = (replacement.effective_net, replacement.as_seed(), options.search)
|
||||
```
|
||||
|
||||
An authored 286.770 µm path in the Raymond MZI array can be replaced geometrically by a 127.208 µm route. If the circuit uses process-specific Bézier bends, supply the measured centerline length with the custom bend template and use the same setting for search and replay. The length check retains the original placement when the replacement falls outside the circuit tolerance. [Raymond MZI layout](https://github.com/SiEPIC/openEBL-2025-02/blob/a887476a301db2a014be007717cd1821e111f58e/submissions/EBeam_hannahraymond_MZIv21.gds) · [Custom bend lengths](api-reference.md#searchoptions)
|
||||
In the [Raymond MZI layout](https://github.com/SiEPIC/openEBL-2025-02/blob/a887476a301db2a014be007717cd1821e111f58e/submissions/EBeam_hannahraymond_MZIv21.gds), a 127.208 µm route fits in place of a 286.770 µm path. The circuit tolerance decides whether to keep it. Use the same [custom bend lengths](api-reference.md#searchoptions) for search and replay.
|
||||
|
||||
## Keep layers and process profiles with the nets
|
||||
|
||||
Each `RoutingProblem` represents one collision plane. Group independent layers by layer and datatype and keep that pair with the placement recipes. Add projected keepouts from other layers when the process requires cross-layer spacing. Keep intentional transitions between layers as placed circuit devices.
|
||||
Use one `RoutingProblem` per collision plane. Keep the layer and datatype with the placement. Project keepouts from other layers when the process requires cross-layer spacing.
|
||||
|
||||
```python
|
||||
from inire import RoutingProblem, route
|
||||
|
|
@ -55,7 +55,7 @@ for layer, nets in partition_layers([((1, 0), silicon_net), ((4, 0), nitride_net
|
|||
placements_by_layer[layer] = placements
|
||||
```
|
||||
|
||||
For different bend rules on the same layer, supply each group's allowed radii in `SearchOptions`. `route_profiles` applies those options to search, seed replay, and refinement, and reserves the verified groups in the order supplied. In the QFoundry example, the flux line can use 15 µm radius while the feedline requires at least 50 µm although both have a 15.5 µm signal width and 7 µm gaps. [QFoundry process profiles](https://github.com/tii-qfoundry/PDK_QFoundry/blob/9c31db1d6879c96bd98460ee134181a865481d75/qfoundry/tech/waveguides.xml#L21-L64)
|
||||
On one layer, `route_profiles` routes each group with its own options and reserves verified geometry in group order. The [QFoundry profiles](https://github.com/tii-qfoundry/PDK_QFoundry/blob/9c31db1d6879c96bd98460ee134181a865481d75/qfoundry/tech/waveguides.xml#L21-L64) allow a 15 µm flux-line bend but require 50 µm for the feedline.
|
||||
|
||||
```python
|
||||
from inire import RoutingProblem
|
||||
|
|
|
|||
|
|
@ -1,28 +1,41 @@
|
|||
# Route a layout
|
||||
|
||||
To get a result you can experiment with, run the [single-net quick start](../../README.md#route-a-net). To route your own design, set up the board and connections in the order below.
|
||||
- [Run the single-net quick start](../../README.md#route-a-net)
|
||||
|
||||
## Define the inputs
|
||||
|
||||
1. **Choose a coordinate unit.** Inire snaps port coordinates to an integer grid. Choose a unit fine enough to preserve narrow gaps, and use it for widths, radii, clearance, and bounds too.
|
||||
2. **Set source and target headings.** A heading is the direction the waveguide travels as it leaves its source or enters its target. Heading 0 points east and 90 points north. If a device labels a target port by the direction it faces outward, reverse that heading by 180 degrees. For example, a waveguide entering a west-facing port travels east, so its target heading is 0.
|
||||
3. **Add a net for each connection.** Give each `NetSpec` a unique ID and the guide width. Use your process's allowed bend radii in [`SearchOptions`](api-reference.md#searchoptions).
|
||||
4. **Set the board and keepouts.** Pass the board rectangle as `bounds`, Shapely polygons as `static_obstacles`, and the required physical spacing as `clearance`. For the defaults and accepted inputs, see [`RoutingProblem`](api-reference.md#routingproblem).
|
||||
5. **Route and check.** Call `route(problem, options=options)`. Automatic mode is the default. Before using a placement recipe, [check the net's result](tune-and-troubleshoot.md#read-the-result).
|
||||
Choose a coordinate unit fine enough for your layout. `Port` rounds coordinates to integers. Use the direction of travel at both ports (0° east, 90° north).
|
||||
|
||||
```python
|
||||
from shapely.geometry import box
|
||||
|
||||
from inire import NetSpec, Port, RoutingProblem, route
|
||||
|
||||
net = NetSpec("input", Port(10, 20, 0), Port(90, 20, 0), width=2)
|
||||
problem = RoutingProblem(
|
||||
bounds=(0, 0, 100, 80),
|
||||
nets=(net,),
|
||||
static_obstacles=(box(40, 40, 60, 60),),
|
||||
clearance=2,
|
||||
)
|
||||
result = route(problem).results_by_net["input"]
|
||||
```
|
||||
|
||||
- [Check the result](tune-and-troubleshoot.md#read-the-result)
|
||||
- [Set allowed bend radii](api-reference.md#searchoptions)
|
||||
- [Layout input types and defaults](api-reference.md#routingproblem)
|
||||
|
||||
<a id="connect-a-preplaced-crossing"></a>
|
||||
|
||||
## Route between placed crossings
|
||||
|
||||
1. **Place the crossing cells.** Keep each cell's physical footprint and internal connections in your layout. Get the port positions and headings in board coordinates after applying placement and rotation.
|
||||
2. **Reserve routing keepouts around the cells.** Use the device's routing keepout if supplied. Otherwise, start from its footprint and make local openings at the ports you're connecting. Keep the full physical cell in your layout.
|
||||
3. **Route the external connections.** Give Inire one net per connection between devices. The example connects A's east port to B's west port. B's arrival heading points east into the cell.
|
||||
1. Place both cells and transform their ports into board coordinates.
|
||||
2. Use the cells' routing keepouts or cut port openings in copies of their footprints.
|
||||
3. Add a net for each external connection. A route entering B's west-facing port travels east, so its target heading is 0.
|
||||
|
||||

|
||||
|
||||
The dashed outlines show the full footprints of crossings A and B. The shaded keepouts leave a port opening on each facing edge. The external waveguide leaves A at `(80, 75)` and enters B at `(260, 115)`. Both arrows point east.
|
||||
|
||||
Each opening is 12 units wide. A straight approach of width 2 with clearance 4 on each side needs `2 + 2 * 4 = 10` units between keepout edges. Leave extra room for any turn near a port, and check the opening after snapping the port to the grid.
|
||||
The shaded keepouts have 12-unit openings in the dashed cell footprints. A straight approach needs 10 units (width 2 plus clearance 4 on each side).
|
||||
|
||||
```python
|
||||
from shapely.geometry import box
|
||||
|
|
@ -63,13 +76,13 @@ result = run.results_by_net[net_id]
|
|||
assert result.is_valid
|
||||
```
|
||||
|
||||
When assembling the layout, check the port joins and clearance against the actual placed-cell geometry. Inire verifies the external route against the keepouts you supplied.
|
||||
Check joins and clearance against the full cells when assembling the layout.
|
||||
|
||||
For declared port widths and transition cells, see [Check placed optical ports](fabrication.md#check-placed-optical-ports).
|
||||
- [Port widths and transition cells](fabrication.md#check-placed-optical-ports)
|
||||
|
||||
## Save a placement recipe
|
||||
|
||||
After checking `result.is_valid`, use `result.as_seed()` to get the ordered moves. Keep the effective net, the component settings, and your coordinate unit with the recipe. The effective net records the resolved terminal positions and headings and the route width.
|
||||
Keep a verified route's resolved net, ordered moves, component settings, and coordinate unit. This snippet uses `result` and `options` from the crossing example.
|
||||
|
||||
```python
|
||||
if not result.is_valid:
|
||||
|
|
@ -78,18 +91,16 @@ if not result.is_valid:
|
|||
placement = (result.effective_net, result.as_seed(), options.search)
|
||||
```
|
||||
|
||||
The example uses the `options` from the crossing example. If you called `route(problem)`, use `RoutingOptions().search`.
|
||||
For a run with default options, use `RoutingOptions().search`.
|
||||
|
||||
Place the first move at the effective start port and each subsequent move at the previous move's end port. For explicit placements, read the `move_spec`, `start_port`, and `end_port` of each component in `result.path`. Use the same width, radii, tangent extensions, and custom outlines that the router checked.
|
||||
|
||||
Your layout tool realizes the components and writes the layout. Choose widths and clearance with enough margin for any downstream rounding. Inire's verification describes the supplied geometry in routing units. Use `result.locked_geometry` to inspect the polygons it checked or reserve them in a later routing run.
|
||||
Place each move at the previous move's endpoint, starting at the resolved start port. For explicit placements, read `move_spec`, `start_port`, and `end_port` from `result.path`. Use `result.locked_geometry` to compare your layout against the checked polygons, allowing for the writer's rounding.
|
||||
|
||||
## Reuse an existing route
|
||||
|
||||
- **Give the router a route it can move.** Put `result.as_seed()` in `initial_paths` under the net's ID. A seed uses the current start port, width, and geometry settings. Search can follow a partial seed from the first iteration and can leave it to find another approach. To build a hint from turns and straights, see the [path seed reference](api-reference.md#path-seeds).
|
||||
- **Hold a route fixed.** Check `result.is_valid`, then use `FixedRoute.from_result(result)` and pass it in `fixed_routes` alongside the remaining nets. The next run respects it as a distinct net, including at zero clearance.
|
||||
- **Allow changes.** Pass `initial_paths={net_id: result.as_seed()}`. Search can follow or leave the [seed](api-reference.md#path-seeds).
|
||||
- **Hold the route fixed.** Pass `FixedRoute.from_result(result)` in `fixed_routes`. It blocks contact with other nets even at zero clearance.
|
||||
|
||||
When terminal headings are inferred, use the effective net with the saved moves to replay the same placement.
|
||||
Replay the crossing example with its resolved net and saved moves. Reuse `problem` and `options` from that example.
|
||||
|
||||
```python
|
||||
from dataclasses import replace
|
||||
|
|
@ -140,6 +151,6 @@ assert detour.is_valid
|
|||
detour_placement = (detour.effective_net, detour.as_seed(), options.search)
|
||||
```
|
||||
|
||||
For imported metal or waveguide polygons that belong to an existing net, use `FixedRoute("existing_net", imported_polygons)`. Supply polygons in board coordinates. For other artwork that blocks routing, use `static_obstacles`.
|
||||
For imported artwork in board coordinates, use `FixedRoute("existing_net", imported_polygons)` if it belongs to a net. Use `static_obstacles` for other keepouts.
|
||||
|
||||
To compare the two paths on a plot, see the [fixed-route example](../../examples/README.md#route-around-fixed-geometry).
|
||||
- [Fixed-route example and plot](../../examples/README.md#route-around-fixed-geometry)
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
# Tune and troubleshoot a route
|
||||
|
||||
Start with `run.results_by_net[net_id].outcome`. It distinguishes a path that stopped short from one that reached its target and failed a geometry check.
|
||||
|
||||
## Read the result
|
||||
|
||||
Get the route with `result = run.results_by_net[net_id]`.
|
||||
|
||||
| `result.outcome` | What to inspect |
|
||||
| --- | --- |
|
||||
| `completed` | The path reached its target and passed verification. Read its length in `report.total_length` and [save its placement recipe](route-a-layout.md#save-a-placement-recipe). |
|
||||
| `colliding` | The path reached its target and failed verification. Check `result.report` for keepout clearance, conflicts with another route, self-overlap, invalid geometry, a bad join, or geometry outside the board. |
|
||||
| `colliding` | Reached the target and failed verification. Check `result.report` for collisions, invalid polygons, or a board boundary violation. |
|
||||
| `partial` | Read the position and heading of `result.path[-1].end_port`. Check room for the path to continue from that heading. If the next turn fits, compare search limits. |
|
||||
| `unroutable` | The path is empty. Check the launch heading and room for the first straight or bend. |
|
||||
|
||||
Check `is_valid` before placing a result. Every routing mode checks that the physical polygons fit within the board.
|
||||
Place the result when `result.is_valid` is true.
|
||||
|
||||
## Why a net stopped short
|
||||
|
||||
1. **Check the coverage bound in automatic mode.** Compare the verified count with `run.automatic.max_routed`. If the bound is below the requested total, `capacity_limit` can identify a cut with too few tracks and `port_conflicts` can identify pairs of nets whose ports are too close. If the count falls below the bound, check the approaches and search limits as well.
|
||||
2. **Check the next approach.** Follow a partial route from its last heading toward the target heading. Check whether the allowed turns fit with the guide width and clearance. If the approach requires a turn larger than the available space, reposition the port or give the turn more room.
|
||||
3. **Compare two search limits.** If the geometry looks feasible, rerun with a larger `search.node_limit` and compare the path endpoint and verified count. The limit applies per search. One run can search the same net several times. Look up the default and related fields in [`SearchOptions`](api-reference.md#searchoptions).
|
||||
1. **Check the bound in automatic mode.** If `run.automatic.max_routed` is below the requested count, check `capacity_limit` for a bottleneck and `port_conflicts` for ports that are too close.
|
||||
2. **Check room for the next turn.** For a [partial result](#read-the-result), start at `result.path[-1].end_port`. Compare the allowed radii and clearance with the room to reach the target heading.
|
||||
3. **Try a larger search budget.** If the approach fits, increase `node_limit` in [`SearchOptions`](api-reference.md#searchoptions) and compare the endpoint and verified count. The limit is per search, and a run can search a net more than once.
|
||||
|
||||

|
||||
|
||||
At three nodes per search the dashed path ends before the first keepout. At 500 the solid path clears the obstacles and reaches the target with the required westbound heading. To reproduce the comparison, change `node_limit` from 3 to 500 in a copy of the [best-effort example](../../examples/09_unroutable_best_effort.py).
|
||||
Rerun the [best-effort example](../../examples/09_unroutable_best_effort.py) with `node_limit` raised from 3 to 500.
|
||||
|
||||
## Choose a routing mode
|
||||
|
||||
|
|
@ -37,7 +37,9 @@ Set `TopologyOptions(mode=...)` and pass it as `topology` in `RoutingOptions`.
|
|||
|
||||
- Guide and seed modes need Shapely 2.1 or later with GEOS 3.10 or later when planning corridors. Nets that receive no corridor can use ordinary lattice search. A caller-supplied seed takes precedence over a generated one. Set `node_limit=0` to verify supplied seeds without planning corridors. [Constrained triangulation requirements](https://shapely.readthedocs.io/en/2.1.2/reference/shapely.constrained_delaunay_triangles.html)
|
||||
- Use `infer_terminal_headings` with automatic or bundle mode if your ports may change direction and the layout supports bundle planning. Compare fixed and flexible headings in [complex-routing example 1](../../examples/advanced.md#complex-routing-example-1).
|
||||
- Automatic mode starts with smaller budgets and can retry with your configured ceiling if coverage remains below the bound. It runs lattice search directly for custom physical bends or polygonal search proxies. With no triangulation available, it tries the constructive planners before falling back to lattice search. [Example with all five modes](../complex-routing-example-1.md#compare-all-routing-modes)
|
||||
- Automatic starts with smaller budgets and can retry up to your ceiling. When corridor planning is unavailable, it can fall back to lattice search.
|
||||
|
||||
[Compare all five modes on one board](../complex-routing-example-1.md#compare-all-routing-modes)
|
||||
|
||||
## Choose the next setting
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue