Limit exact S-bend span searches by lateral room

This commit is contained in:
Jan Petykiewicz 2026-11-30 09:52:16 -08:00
commit 5c8306c636

View file

@ -118,6 +118,8 @@ def _assign_shifts(
pitch: int,
floor_lane: int,
search: SearchOptions,
*,
max_offset: int,
) -> tuple[dict[str, list[_Shift]], int]:
short, lower, upper = layout.short, layout.lower, layout.upper
middle, *ascending, shelf = upper
@ -158,7 +160,7 @@ def _assign_shifts(
first_top = ceil(last_upper[3] + margin + 0.1)
top_lanes = [first_top + i * pitch for i in range(len(ascending))]
max_span = int(max(net.target.x for net in upper) - short.start.x)
offsets = tuple(exact_sbend_spans(radius, max_span=max_span, offsets=search.sbend_offsets))
offsets = tuple(exact_sbend_spans(radius, max_span=max_span, max_offset=max_offset, offsets=search.sbend_offsets))
shelf_options = [
int(shelf.target.y) + offset
for offset in offsets
@ -237,7 +239,8 @@ def plan_ordered_bundle(problem: RoutingProblem, search: SearchOptions, *, infer
# destination and of the first barrier, so the bundle launches east.
problem = _eastbound_launches(problem)
layout = _identify_layout(problem, margin)
shifts, launch = _assign_shifts(layout, radius, margin, pitch, floor_lane, search)
max_offset = floor(problem.bounds[3]) - ceil(problem.bounds[1])
shifts, launch = _assign_shifts(layout, radius, margin, pitch, floor_lane, search, max_offset=max_offset)
seeds = {}
updated_nets = []