Keep fabrication helpers in tests and simplify documentation links

This commit is contained in:
Jan Petykiewicz 2026-11-29 23:29:31 -08:00
commit b509efc95d
17 changed files with 65 additions and 138 deletions

21
DOCS.md
View file

@ -2,16 +2,16 @@
# User guide
- [Run your first route](README.md#route-a-net)
- [Quick start](README.md#route-a-net)
<a id="incremental-routing-with-locked-geometry"></a>
<a id="initial-paths-with-pathseed"></a>
## Describe a layout
- [Set units, port headings, and keepouts](docs/user/route-a-layout.md#define-the-inputs)
- [Route between placed crossings](docs/user/route-a-layout.md#route-between-placed-crossings)
- [Reuse an existing route](docs/user/route-a-layout.md#reuse-an-existing-route)
- [Layout inputs](docs/user/route-a-layout.md#define-the-inputs)
- [Placed crossings](docs/user/route-a-layout.md#route-between-placed-crossings)
- [Route reuse](docs/user/route-a-layout.md#reuse-an-existing-route)
<a id="read-the-result"></a>
<a id="topological-routing"></a>
@ -21,12 +21,11 @@
## Check and improve a route
- [Check the result](docs/user/tune-and-troubleshoot.md#read-the-result)
- [Save a placement recipe](docs/user/route-a-layout.md#save-a-placement-recipe)
- [Route with process constraints](docs/user/fabrication.md)
- [Diagnose an unfinished net](docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short)
- [Choose a routing mode](docs/user/tune-and-troubleshoot.md#choose-a-routing-mode)
- [Adjust a setting](docs/user/tune-and-troubleshoot.md#choose-the-next-setting)
- [Route outcomes](docs/user/tune-and-troubleshoot.md#read-the-result)
- [Placement recipes](docs/user/route-a-layout.md#save-a-placement-recipe)
- [Unfinished routes](docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short)
- [Routing modes](docs/user/tune-and-troubleshoot.md#choose-a-routing-mode)
- [Tuning settings](docs/user/tune-and-troubleshoot.md#choose-the-next-setting)
<a id="moved-reference-sections"></a>
<a id="searchoptions"></a>
@ -45,4 +44,4 @@
## Examples
- [Runnable examples](examples/README.md)
- [Walk through a nine-net run](docs/complex-routing-example-1.md)
- [Complex-routing walkthrough](docs/complex-routing-example-1.md)

View file

@ -37,9 +37,9 @@ The example prints `200.0`. Heading `0` is east at both ports.
## Route your own layout
- [Set up a layout](docs/user/route-a-layout.md#define-the-inputs)
- [Diagnose a partial route](docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short)
- [Save a placement recipe](docs/user/route-a-layout.md#save-a-placement-recipe)
- [Layout inputs](docs/user/route-a-layout.md#define-the-inputs)
- [Partial routes](docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short)
- [Placement recipes](docs/user/route-a-layout.md#save-a-placement-recipe)
- [User guide](DOCS.md)
## Develop Inire

View file

@ -3,7 +3,7 @@
`route()` uses the same worker to search, replay seeds, and verify paths. An explicit mode configures the worker directly. Automatic routing sets a coverage target and tries different plans or worker settings.
- [Worker entry point](../inire/router/_stack.py#L65)
- [Walk through one complete run](complex-routing-example-1.md)
- [Complex-routing walkthrough](complex-routing-example-1.md)
## Automatic routing
@ -29,7 +29,7 @@ Follow the left column while coverage is below the target. Reaching the target s
Holding the straight trunk fixed in `stress-retry-straight-decoy` blocks both vertical routes. The `residual-dogleg` stage finishes the trunk with a four-turn detour, bringing coverage to four out of four. When changing lock ordering, check which stage finishes the trunk.
- [Trunk detour figure](../examples/advanced.md#trunk-that-detours-around-branches)
- [Run a single-case benchmark](benchmarks.md#run-a-benchmark)
- [Single-case benchmark](benchmarks.md#run-a-benchmark)
## Detailed search and congestion

View file

@ -1,6 +1,6 @@
# Benchmark fixtures
- [Choose a benchmark case](benchmarks.md#choose-a-case)
- [Benchmark cases](benchmarks.md#choose-a-case)
- [Corpus registry and profiles](../inire/tests/routing_corpus.py)
## Complex-routing example 1
@ -15,8 +15,8 @@ python -m scripts.route_complex_routing_example --output /tmp/inire-complex-rout
Expect nine verified routes. The unseeded export met the original checker's cost and geometry requirements.
- [Compare the resulting layouts](../examples/advanced.md#complex-routing-example-1)
- [Follow the illustrated walkthrough](complex-routing-example-1.md)
- [Example gallery](../examples/advanced.md#complex-routing-example-1)
- [Complex-routing walkthrough](complex-routing-example-1.md)
To replay a known layout, pass `--reference-lane-plan` for the shared bottom passage or `--single-bottom-track` for the one-track version. Use the unseeded command above for planner coverage and timing.
@ -28,11 +28,25 @@ To replay a known layout, pass `--reference-lane-plan` for the shared bottom pas
Use unseeded runs to evaluate routing policy. For a separate check of geometry and clearance, use the reference paths in the [crossing fixtures](../inire/tests/routing_crossing_benchmarks.py).
## Fabrication regression cases
The layout tests use process dimensions to exercise routing and placement replay.
| Case | Checks |
| --- | --- |
| Optical ports | Matching widths allow a direct link. A wider target needs a taper. |
| Authored lengths | Custom bend lengths are retained when the route is replayed. |
| Layers and process profiles | Independent planes retain layer assignment. Ordered profiles reserve earlier routes and apply their own bend limits. |
| Coplanar waveguide | Route the conductor and gap envelope from the same seed. With a 29.5 µm envelope and 3 µm clearance, 28 and 32 µm pitches fail and 36 µm passes. |
- [Layout regression tests](../inire/tests/test_layout.py)
- [Fabrication study](../plans/full-project-review.md#31-preserve-authored-lengths-when-rerouting-phase-sensitive-connections--medium)
## Imported fixtures
The importer cuts port openings in device keepouts and snaps optical ports to a 0.1 µm grid. One layout unit is 0.1 µm.
- [Converted geometry for all six cases](../inire/tests/data/external_routing_benchmarks.json)
- [Converted fixture geometry](../inire/tests/data/external_routing_benchmarks.json)
| Cases | Pinned source | License |
| --- | --- | --- |

View file

@ -62,7 +62,7 @@ python -m scripts.compare_topological_routing \
At 100 nodes per search, `off` verifies no routes. Guide and seed each verify one at the same cost. Guide uses 4 expansions. Seed uses 36 to build its starting path.
- [How corridors become paths](topological-routing.md#corridor-planning-and-realization)
- [Corridor planning and realization](topological-routing.md#corridor-planning-and-realization)
### Test a retry on holdouts

View file

@ -78,7 +78,7 @@ python -m scripts.compare_topological_routing \
The point-terminal variant accepts a westbound arrival for `net_08`, so the original bundle needs no turnaround. Rerun the gallery command with `--case complex-routing-example-1-point-terminals` to see the result.
- [Both layouts in the gallery](../examples/advanced.md#complex-routing-example-1)
- [Example gallery](../examples/advanced.md#complex-routing-example-1)
- [Waypoint export](benchmark-fixtures.md#complex-routing-example-1)
## Compare all routing modes

View file

@ -1,12 +1,14 @@
# Developer guide
## Choose a task
<a id="choose-a-task"></a>
- [Understand one routing run](complex-routing-example-1.md)
- [Find the implementation](architecture.md)
- [Investigate coverage, cost, or runtime](routing-diagnostics.md)
- [Run benchmarks](benchmarks.md)
- [Look up the public API](user/api-reference.md)
## Links
- [Complex-routing walkthrough](complex-routing-example-1.md)
- [Router architecture](architecture.md)
- [Routing diagnostics](routing-diagnostics.md)
- [Benchmarks](benchmarks.md)
- [Public API](user/api-reference.md)
## Check a change

View file

@ -2,7 +2,7 @@
Investigate changes in planner selection, coverage, or runtime.
- [Troubleshoot a layout](user/tune-and-troubleshoot.md)
- [Layout troubleshooting](user/tune-and-troubleshoot.md)
## Automatic reports

View file

@ -2,7 +2,7 @@
Import these types from `inire`.
- [Runnable layout example](route-a-layout.md#define-the-inputs)
- [Layout example](route-a-layout.md#define-the-inputs)
## Route a problem
@ -97,7 +97,7 @@ For structured logging, `dataclasses.asdict(run)` preserves the per-net fields.
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. 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.
Match custom outline faces to their declared ports and width. `SBendOutline` warns about a mismatch at construction. For a custom 90-degree outline used in a result, `route()` warns once per radius and net width. Replay an `SBendSeed` with the same outlines and bend settings.
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.

View file

@ -1,85 +0,0 @@
# Route with process constraints
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
`PlacedPort.connect` checks that the placed devices have matching port widths.
```python
from inire import Port
from inire.layout import PlacedPort
source = PlacedPort(Port(10000, 10000, 0), width=500)
taper_input = PlacedPort(Port(70000, 10000, 0), width=500)
net = source.connect("source_to_taper", taper_input)
```
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
Keep the original placement and authored length when rerouting one arm of an interferometer. Compare the replacement to the tolerance supplied by the circuit designer. For a matched pair, compare the signed difference between the two arm lengths before and after the replacement.
```python
from inire.layout import preserves_length
# Lengths are in the same units as the routing layout.
placement = original_placement
if preserves_length(replacement, authored_length, length_tolerance):
placement = (replacement.effective_net, replacement.as_seed(), options.search)
```
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
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
from inire.layout import partition_layers
placements_by_layer = {}
for layer, nets in partition_layers([((1, 0), silicon_net), ((4, 0), nitride_net)]).items():
plane = RoutingProblem(
bounds, nets, static_obstacles=keepouts_by_layer[layer], clearance=clearance_by_layer[layer],
)
options = options_by_layer[layer]
run = route(plane, options=options)
placements = {}
for net_id, result in run.results_by_net.items():
if not result.is_valid:
raise ValueError(f"Route {net_id!r} ended with outcome {result.outcome!r}")
placements[net_id] = (result.effective_net, result.as_seed(), options.search)
placements_by_layer[layer] = placements
```
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
from inire.layout import route_profiles
cpw_plane = RoutingProblem(
bounds, (flux_net, feed_net), static_obstacles=cpw_keepouts, clearance=ground_strip_width,
)
profiles = [
((flux_net.net_id,), flux_options),
((feed_net.net_id,), feed_options),
]
results = route_profiles(cpw_plane, profiles)
placements = {}
for net_ids, options in profiles:
for net_id in net_ids:
result = results[net_id]
if not result.is_valid:
raise ValueError(f"Route {net_id!r} ended with outcome {result.outcome!r}")
placements[net_id] = (result.effective_net, result.as_seed(), options.search)
```
## Route a coplanar waveguide envelope
For a 15.5 µm signal with a 7 µm gap on each side, route with a width of 29.5 µm. Use the required ground-strip width as the clearance between envelopes. Save the verified placement recipe for your component library. To verify the same path at the signal width, replay its seed with a 15.5 µm net using the same effective ports and bend rules.
A 3 µm minimum ground strip rejects parallel tracks at 28 µm and 32 µm pitches. A 36 µm pitch leaves a 6.5 µm strip between their envelopes.

View file

@ -1,6 +1,6 @@
# Route a layout
- [Run the single-net quick start](../../README.md#route-a-net)
- [Quick start](../../README.md#route-a-net)
## Define the inputs
@ -21,8 +21,8 @@ problem = RoutingProblem(
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)
- [Route outcomes](tune-and-troubleshoot.md#read-the-result)
- [Bend radius settings](api-reference.md#searchoptions)
- [Layout input types and defaults](api-reference.md#routingproblem)
<a id="connect-a-preplaced-crossing"></a>
@ -78,8 +78,6 @@ assert result.is_valid
Check joins and clearance against the full cells when assembling the layout.
- [Port widths and transition cells](fabrication.md#check-placed-optical-ports)
## Save a placement recipe
Keep a verified route's resolved net, ordered moves, component settings, and coordinate unit. This snippet uses `result` and `options` from the crossing example.

View file

@ -2,7 +2,7 @@
## Start with a connection
- [Run the quick start](../README.md#route-a-net)
- [Quick start](../README.md#route-a-net)
![A straight waveguide from (50, 100) to (250, 100). Both port arrows point east.](../docs/figures/first-route.png)
@ -12,7 +12,7 @@
All nine routes verify. Follow the long lower route beneath both south approaches.
- [Run this layout and browse other advanced cases](advanced.md)
- [Advanced example gallery](advanced.md)
## Optional workflows
@ -24,8 +24,8 @@ After [installing Inire](../README.md#install), run the example scripts with Pyt
`FixedRoute.from_result()` reserves the straight route. The next connection detours around its end.
- [Runnable fixed-route example](03_locked_paths.py)
- [Reuse a route in your own layout](../docs/user/route-a-layout.md#reuse-an-existing-route)
- [Fixed-route script](03_locked_paths.py)
- [Route reuse](../docs/user/route-a-layout.md#reuse-an-existing-route)
<a id="fit-bends-to-available-room"></a>
@ -40,5 +40,5 @@ After [installing Inire](../README.md#install), run the example scripts with Pyt
At `node_limit=3`, the route stops after its first turn. At 500 it reaches the target.
- [Run the best-effort example](09_unroutable_best_effort.py)
- [Diagnose a partial route](../docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short)
- [Best-effort script](09_unroutable_best_effort.py)
- [Partial routes](../docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short)

View file

@ -2,10 +2,10 @@
Route stress-test boards with shared openings, tight turns, and placed crossings.
- [Competing passages](#competing-passages) for different guide widths and routes travelling in both directions.
- [Bend and return room](#bend-and-return-room) for alternating detours, short shifts, and branches.
- [Placed crossings](#placed-crossings) for access slots and external detours.
- [Complex-routing example 1](#complex-routing-example-1) for fixed and inferred headings on the same input.
- [Competing passages](#competing-passages)
- [Bend and return room](#bend-and-return-room)
- [Placed crossings](#placed-crossings)
- [Complex-routing example 1](#complex-routing-example-1)
## Run a layout
@ -72,7 +72,7 @@ In `stress-retry-mixed-port-bank`, the two short routes connect offset ports on
The cells are already placed. Slots in their keepouts give the external routes access to each port.
- [Set up your own crossing cells](../docs/user/route-a-layout.md#route-between-placed-crossings)
- [Placed crossing setup](../docs/user/route-a-layout.md#route-between-placed-crossings)
### Opposed S-bends beside a crossing

View file

@ -1,4 +1,4 @@
"""Routing helpers for placed ports, authored lengths, and process profiles."""
"""Test helpers for placed ports, authored lengths, and process profiles."""
from __future__ import annotations

View file

@ -11,7 +11,7 @@ from inire import (
Bend90Seed, CongestionOptions, FixedRoute, NetSpec, PathSeed, Port, RefinementOptions,
RoutingOptions, RoutingProblem, SBendOutline, SearchOptions, StraightSeed, TopologyOptions, route,
)
from inire.layout import PlacedPort, partition_layers, preserves_length, route_profiles
from inire.tests.layout_helpers import PlacedPort, partition_layers, preserves_length, route_profiles
_REPLAY = RoutingOptions(search=SearchOptions(node_limit=0), refinement=RefinementOptions(enabled=False))

View file

@ -17,8 +17,7 @@ Use these notes during edits. When a heading has inbound links, check the starti
| Troubleshooting / Read the result | A run and a net ID | Interpret the outcome and find the next check |
| Troubleshooting / Why a net stopped short | An unresolved route | Check the capacity bound, turn room, and search budget |
| Troubleshooting / Modes and settings | The observed symptom or desired route behavior | Choose a mode or change one setting and compare results |
| Fabrication / Ports and length | Placed-cell port data or a known authored length | Position a taper or apply a circuit length tolerance |
| Fabrication / Layers and coplanar envelopes | A process layer map or CPW cross-section | Route by collision plane and bend profile, or route a gap envelope |
| Benchmark fixtures / Fabrication regression cases | A routing or placement change | Find the process dimensions and related layout tests |
| API / Call and inputs | The public call or input type to look up | Signatures, units, accepted values, and callback behavior |
| API / Seeds and results | A proposed move sequence or a returned run | Replay requirements and the fields to inspect |
| API / Options | The setting to change | Its default, effect, and range |

View file

@ -248,7 +248,7 @@ Verify supplied paths once when the search budget is zero and return the physica
In the Raymond fabrication submission, the two `MZI9` arms carry authored length annotations of 286.770 µm (`Waveguide$10`) and 183.637 µm (`Waveguide$1`). Replacing the former with the automatic route from `(261120, -46270, 0)` to `(261120, -167770, 180)` on the 1 nm grid gives a 127.208 µm path, using two clockwise 5 µm quarter turns and a 111.5 µm straight. Both 500 nm port faces join the existing silicon, and the modified MZI array still passes the published EBeam deck. The signed arm-length difference changes from +103.133 µm to −56.429 µm. Even when the original waypoints and radius are replayed, the circular replacement's reported length can differ from the authored waveguide length. The EBeam 500 nm strip definition specifies Bézier bends, and the `Waveguide` cell's authored 156.137 µm becomes 154.948 µm with circular bends. [Raymond fabrication layout](https://github.com/SiEPIC/openEBL-2025-02/blob/a887476a301db2a014be007717cd1821e111f58e/submissions/EBeam_hannahraymond_MZIv21.gds) · [EBeam waveguide definitions](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/WAVEGUIDES.xml#L3-L15) · [Public results](../docs/user/api-reference.md#results)
Document which geometric and fabrication checks are covered and which circuit constraints callers must supply and check. Add a reuse example that compares a verified replacement with the authored length and preserves the incumbent when the length difference falls outside tolerance. Evaluate a per-net length target or pairwise length-difference constraint, and carry the actual process-specific bend length through search, refinement, and export when that model is supplied. Use both a length-sensitive MZI and an unconstrained connection as acceptance cases. [Authored length workflow](../docs/user/fabrication.md#preserve-length-sensitive-paths)
Document which geometric and fabrication checks are covered and which circuit constraints callers must supply and check. Add a reuse example that compares a verified replacement with the authored length and preserves the incumbent when the length difference falls outside tolerance. Evaluate a per-net length target or pairwise length-difference constraint, and carry the actual process-specific bend length through search, refinement, and export when that model is supplied. Use both a length-sensitive MZI and an unconstrained connection as acceptance cases. [Fabrication regression cases](../docs/benchmark-fixtures.md#fabrication-regression-cases)
## 32. Infer a launch S-bend before a final quarter turn — Medium
@ -260,7 +260,7 @@ Use the position before a supported terminal quarter turn to propose useful S-be
The pinned QFoundry feedline defines a 15.5 µm signal trace with a 7 µm gap on each side. Replay two parallel, 200 µm straight connections on a 1 nm grid using `NetSpec.width=15500` and `clearance=3000`. At a 32 µm pitch Inire verifies both center conductors. Converting the paths to the negative lithography layer leaves a 2.5 µm ground strip between the two gap envelopes. The QFoundry deck reports one aluminum width violation. At 28 µm pitch the two envelopes merge and the center ground strip disappears. The deck reports no width violation because the intended strip no longer exists. Replaying the same paths at the 29.5 µm envelope width with 3 µm clearance rejects both pitches. A 36 µm control verifies the envelopes, leaves a 6.5 µm strip, and passes the deck. [RF routing scope](../README.md) · [QFoundry waveguide dimensions and layers](https://github.com/tii-qfoundry/PDK_QFoundry/blob/9c31db1d6879c96bd98460ee134181a865481d75/qfoundry/tech/waveguides.xml#L21-L48) · [QFoundry fabrication checks](https://github.com/tii-qfoundry/PDK_QFoundry/blob/9c31db1d6879c96bd98460ee134181a865481d75/qfoundry/tech/drc/drc.lydrc)
Route against the gap envelope and replay the verified placement at the signal width. At the 15 µm minimum flux-line bend radius, the router accepts the 15.5 µm signal and the 29.5 µm gap envelope. The 49.5 µm width exceeds the bend diameter. Check the three pitches using the published dimensions and process rules. [CPW envelope routing](../docs/user/fabrication.md#route-a-coplanar-waveguide-envelope)
Route against the gap envelope and replay the verified placement at the signal width. At the 15 µm minimum flux-line bend radius, the router accepts the 15.5 µm signal and the 29.5 µm gap envelope. The 49.5 µm width exceeds the bend diameter. Check the three pitches using the published dimensions and process rules. [Fabrication regression cases](../docs/benchmark-fixtures.md#fabrication-regression-cases)
## 34. Apply the bend rules for each geometry class on a mixed layout — Medium