Window re-route: time budget, window cap, smallest first, window boards
A window's board now holds every pin and piece of copper of the nets it reroutes and, of the rest, only items near the window, instead of the whole board rebuilt per window. The smallest windows go first, at most --window-cap per round (40), and no window starts once --window-budget of the routing's own time is spent (0.25). On th-eda's flight controller the stage had taken 12x the routing time for no gain.
This commit is contained in:
@@ -50,9 +50,9 @@ def _slot(gap: int = 640, far: bool = False) -> str:
|
||||
"""
|
||||
|
||||
|
||||
def _route(text: str, rounds: int):
|
||||
def _route(text: str, rounds: int, **window):
|
||||
exact, _scale, _layers = route_dsn_board_exact(
|
||||
parse_dsn(text), resolution=1, window_reroute=rounds, window_resolution=4,
|
||||
parse_dsn(text), resolution=1, window_reroute=rounds, window_resolution=4, **window,
|
||||
)
|
||||
return exact.result
|
||||
|
||||
@@ -93,3 +93,20 @@ def test_a_router_limited_to_some_nets_and_a_box_builds_only_those():
|
||||
assert {c.net_no for c in whole._build_connections()} == {1, 2}
|
||||
assert {c.net_no for c in part._build_connections()} == {2}
|
||||
assert part.cols * part.rows < whole.cols * whole.rows
|
||||
|
||||
|
||||
def test_a_spent_budget_starts_no_window():
|
||||
assert len(_route(_slot(), 1, window_budget=0.0).failed) == 1
|
||||
assert _route(_slot(), 1, window_budget=1000.0).failed == []
|
||||
|
||||
|
||||
def test_window_board_keeps_far_items_of_the_rerouted_nets_only():
|
||||
from freeroute.route.window import _item_box, _window_board
|
||||
|
||||
board = build_board(parse_dsn(_slot(far=True)))
|
||||
items = [(item, _item_box(item)) for item in board.get_items()]
|
||||
view = IntBox(80000, -60000, 120000, -40000) # around the slot, far from Q1/Q2
|
||||
sub = _window_board(board, items, view, {1}, {}, set(), {}, 100, 300, 300, [0], "via")
|
||||
refs = {p.component_ref for p in sub.get_pins()}
|
||||
assert {"P1", "P2"} <= refs # net N's pins, though outside the view
|
||||
assert not refs & {"Q1", "Q2"} # net M's, far away, left out
|
||||
|
||||
Reference in New Issue
Block a user