4.8 KiB
Route a layout
Start with the first route, then replace the example ports and add your layout's constraints.
Define the inputs
- 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.
- Set source and target headings. Heading 0 points east and 90 points north. The source heading points along the launch. The target heading points along the arrival. If your device library labels the target port with its outward heading, reverse it by 180 degrees.
- Add a net for each connection. Give each
NetSpeca unique ID and the guide width. Set your process limits throughSearchOptionsand choose the required clearance onRoutingProblem. - Add keepouts. Supply Shapely polygons in
static_obstaclesand useboundsfor the board rectangle. Leave enough access at the ports for the guide and its permitted bends. - Run and check. Call
route(problem, options=options). Start with automatic mode for general layouts and check each net before export.
For the constructor signatures and field defaults, see the layout input reference.
Route between placed crossings
- 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.
- 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 the exported layout.
- 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.
Dashed outlines show the complete device footprints. Shading shows the keepouts passed to Inire. The external route connects the two port markers. The arrow at each marker shows the heading.
Inire applies clearance around the supplied keepout polygons. A straight approach of width w between two keepout edges needs at least w + 2 * clearance of open width. Leave room for any turn near the port and check the opening after snapping the port to the grid.
from shapely.geometry import box
from inire import (
NetSpec, Port, RoutingOptions,
RoutingProblem, SearchOptions,
route,
)
# Example footprints and access openings in board coordinates.
a = box(30, 50, 80, 100)
b = box(260, 90, 310, 140)
a_access = box(74, 69, 82, 81)
b_access = box(258, 109, 266, 121)
a_keepout = a.difference(a_access)
b_keepout = b.difference(b_access)
net_id = "A_east_to_B_west"
link = NetSpec(
net_id,
Port(80, 75, 0),
Port(260, 115, 0),
width=2,
)
problem = RoutingProblem(
bounds=(0, 0, 340, 180),
nets=(link,),
static_obstacles=(a_keepout, b_keepout),
clearance=4,
)
search = SearchOptions(
bend_radii=(25,), sbend_radii=(25,),
)
opts = RoutingOptions(search=search)
run = route(problem, options=opts)
result = run.results_by_net[net_id]
assert result.is_valid
Before export, check the port joins and clearance against the actual placed-cell geometry. Inire verifies the external route against the keepouts you supplied.
Reuse an existing route
- Give the router a route it can move. Put
result.as_seed()ininitial_pathsunder the net's ID. A seed uses the current start port, width, and geometry settings. A partial seed can suggest an approach. To build a hint from turns and straights, see the path seed reference. - Hold a route fixed. Add
result.locked_geometrytostatic_obstacleswhile routing other nets. The next run applies its own clearance.
To reuse the verified routes from a first problem as fixed obstacles, add them to a second problem that contains the remaining nets.
from dataclasses import replace
from inire import route
first = route(first_problem)
locked = tuple(
polygon
for result in first.results_by_net.values()
if result.is_valid
for polygon in result.locked_geometry
)
obstacles = (
next_problem.static_obstacles
+ locked
)
second = route(replace(
next_problem,
static_obstacles=obstacles,
))
To see the second route detour around a fixed path, run the locked-path example.
