Fix fabrication verification and routing diagnostics follow-up

This commit is contained in:
Jan Petykiewicz 2026-11-29 00:09:54 -08:00
commit cea23ef1b4
3 changed files with 248 additions and 76 deletions

View file

@ -44,7 +44,7 @@ The fields below appear in constructor order. Use one layout unit for coordinate
| `RoutingResult.path` | Ordered path components from the source to the last reached state. 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. `terminal_error` identifies an inaccessible start or target face. |
| `RoutingResult.locked_geometry` and `as_seed()` | Physical polygons and the sequence of moves, respectively. Check validity before exporting polygons or using them as keepouts. |
| `RoutingResult.locked_geometry` and `as_seed()` | Physical polygons and the sequence of moves, respectively. Check validity before exporting polygons or [reserving 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. |

View file

@ -32,14 +32,15 @@ An authored 286.770 µm path in the Raymond MZI array can be replaced geometrica
## Check the export grid
Use the layout writer's rounding grid in routing units. `verify_export_grid` rounds route vertices while holding the supplied keepouts fixed. Supply the actual keepout geometry as it will appear in the file. Export the returned polygons only if their reports pass. Recheck the assembled cell after writing when the writer performs further operations such as path merging or coordinate transforms.
Use the layout writer's rounding grid in routing units. `verify_export_grid` rounds route vertices while holding the supplied keepouts fixed. Supply the keepout geometry as it will appear in the file and pass all intended routes on the layer in one call so they are checked against each other. The function requires each supplied result to have passed routing verification. Recheck the assembled cell after writing when the writer performs further operations such as path merging or coordinate transforms.
```python
from inire.layout import verify_export_grid
verified = {name: result for name, result in run.results_by_net.items() if result.is_valid}
export = verify_export_grid(problem, verified, grid=1.0)
assert export.is_valid, export.reports_by_net
results = {net.net_id: run.results_by_net[net.net_id] for net in problem.nets}
export = verify_export_grid(problem, results, grid=1.0)
if not export.is_valid:
raise ValueError(export.reports_by_net)
geometry_by_net = export.geometry_by_net
```
@ -58,24 +59,32 @@ for layer, nets in partition_layers([((1, 0), silicon_net), ((4, 0), nitride_net
plane = RoutingProblem(bounds, nets, static_obstacles=keepouts_by_layer[layer], clearance=clearance_by_layer[layer])
run = route(plane, options=options_by_layer[layer])
export = verify_export_grid(plane, run.results_by_net, grid=1.0)
assert export.is_valid, export.reports_by_net
if not export.is_valid:
raise ValueError(export.reports_by_net)
geometry_by_layer[layer] = export.geometry_by_net
```
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)
```python
from inire.layout import route_profiles
from inire import RoutingProblem
from inire.layout import route_profiles, verify_export_grid
results = route_profiles(plane, [
(("flux",), flux_options),
(("feed",), feed_options),
cpw_plane = RoutingProblem(
bounds, (flux_net, feed_net), static_obstacles=cpw_keepouts, clearance=ground_strip_width,
)
results = route_profiles(cpw_plane, [
((flux_net.net_id,), flux_options),
((feed_net.net_id,), feed_options),
])
export = verify_export_grid(cpw_plane, results, grid=1.0)
if not export.is_valid:
raise ValueError(export.reports_by_net)
```
## Verify a coplanar waveguide cross-section
For a 15.5 µm signal with a 7 µm gap on each side, route the 29.5 µm envelope. Use the required ground-strip width as the clearance between envelopes. Replay the verified seed with a 15.5 µm net using the same ports and bend rules. The conductor and envelope together define the negative gap mask. A separate wider ground exclusion can be buffered locally from the envelope. This fills the inside of turns where a constant-width circular strip wider than the bend diameter would collapse.
For a 15.5 µm signal with a 7 µm gap on each side, route the 29.5 µm envelope. Use the required ground-strip width as the clearance between envelopes. Replay the verified seed with a 15.5 µm net using the same ports and bend rules. The conductor and envelope together define the negative gap mask. `coplanar_geometry` checks for side contact and allows the gap to end at the terminal faces. Check the process minimum gap in the assembled layout. A separate wider ground exclusion can be buffered locally from the envelope. This fills the inside of turns where a constant-width circular strip wider than the bend diameter would collapse.
```python
from inire.layout import coplanar_geometry

View file

@ -90,7 +90,7 @@ For a multi-net layout, apply the validity check to every net you intend to expo
## 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 add `result.locked_geometry` to `static_obstacles` while routing other nets. The next run applies its own clearance to those polygons.
- **Hold a route fixed.** Check `result.is_valid`, then replay its seed in the first group of `route_profiles` with search and refinement disabled. Later groups respect it as a distinct net, including at zero clearance. Verify the groups together before [exporting the layer](fabrication.md#check-the-export-grid).
When terminal headings are inferred, store the two selected ports alongside the seed, width, and geometry options. Use those exact ports to replay the route and export the same polygons.
@ -123,30 +123,30 @@ for net in verified_nets:
assert result.locked_geometry == chosen.results_by_net[net.net_id].locked_geometry
```
Route a straight net, then use its polygons as keepouts in a second routing problem. The second net has to detour around one end of the fixed route.
Route a straight net, then reserve it while routing another net on the same layer. The second net has to detour around one end of the fixed route.
```python
from inire import (
NetSpec, Port, RoutingOptions,
RoutingProblem, SearchOptions, route,
)
from dataclasses import replace
from inire import NetSpec, Port, RefinementOptions, RoutingOptions, RoutingProblem, SearchOptions, route
from inire.layout import route_profiles, verify_export_grid
bounds = (0, -50, 100, 50)
options = RoutingOptions(search=SearchOptions(bend_radii=(10,)))
first = RoutingProblem(
bounds=bounds,
nets=(NetSpec("fixed", Port(10, 0, 0), Port(90, 0, 0)),),
)
fixed = route(first, options=options).results_by_net["fixed"]
fixed_net = NetSpec("fixed", Port(10, 0, 0), Port(90, 0, 0))
detour_net = NetSpec("detour", Port(50, -20, 90), Port(50, 20, 90))
problem = RoutingProblem(bounds=bounds, nets=(fixed_net, detour_net), clearance=0)
fixed = route(replace(problem, nets=(fixed_net,)), options=options).results_by_net["fixed"]
assert fixed.is_valid
second = RoutingProblem(
bounds=bounds,
nets=(NetSpec("detour", Port(50, -20, 90), Port(50, 20, 90)),),
static_obstacles=fixed.locked_geometry,
replay_options = replace(
options, search=replace(options.search, node_limit=0), refinement=RefinementOptions(enabled=False),
)
detour = route(second, options=options).results_by_net["detour"]
assert detour.is_valid
problem = replace(problem, initial_paths={"fixed": fixed.as_seed()})
results = route_profiles(problem, [(("fixed",), replay_options), (("detour",), options)])
export = verify_export_grid(problem, results, grid=1.0)
if not export.is_valid:
raise ValueError(export.reports_by_net)
```
To compare the two paths on a plot, see the [fixed-route example](../../examples/README.md#route-around-fixed-geometry).