TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
router.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3// TraceMaker's detailed router, version 1 (roadmap M4; design doc 05 §2, §5).
4//
5// Octilinear A* on a fine lattice (optimal under its cost model), with legality decided lazily by exact
6// clearance tests against the DRC's rule engine, then exact verification of every committed segment and via.
7#include <array>
8#include <atomic>
9#include <cstdint>
10#include <string>
11#include <vector>
12
13#include "core/events.hpp"
14#include "model/board.hpp"
15#include "model/rules.hpp"
17
18namespace tmk::route {
19
20// The copper of one routed connection, keyed by its two pads: what a later run can start from (RouterOptions::warm).
21struct ConnRoute {
22 int pad_a = -1, pad_b = -1;
23 std::vector<model::Track> tracks;
24 std::vector<model::Via> vias;
25};
26
28 Coord pitch = 0; // lattice pitch; 0 = automatic from net-class widths and clearances
29 // Auto pitch multiplier on small lattices (< 1M points per layer): a finer lattice finds fan-outs the default one
30 // misses and small boards have the time for it (doc 05 §25).
31 double pitch_scale_small = 1.0;
32 bool fine_variant = true; // portfolio: the cheap-vias variant routes small boards at half pitch
33 double pitch_scale = 1.0; // auto pitch multiplier, applied only on large lattices (>= 3M points per layer)
34 double time_limit_s = 120; // wall-clock safety limit for the whole run
35 // Portfolio with more variants than threads: successive halving (Jamieson and Talwalkar, AISTATS 2016) instead of
36 // running only `threads` variants. Every variant runs on a small budget, the better half runs again on twice as
37 // much, until `threads` variants are left; each rung takes an equal share of the wall time (or work) that
38 // `threads` variants would have used. Runs restart from scratch at each rung (a router run cannot be resumed).
39 bool halving = false;
40 long work_budget = 0; // deterministic budget in search expansions (0 = none): same input + seed => same output
41 // Per search attempt. One variant at a fixed budget prefers 1M (10 hard boards: 3M / 2M / 1M / 750k / 500k routed
42 // 8,285 / 8,309 / 8,381 / 8,371 / 8,363), but the 8-variant 120 s tiers did not confirm it (tier B 5,167 -> 5,161,
43 // tier C 9,523 -> 9,512 and 63.3 % -> 60.0 % clean), so it stays 3M (doc 05 §13; --max-expansions to experiment).
44 long max_expansions = 3'000'000;
45 bool reach_verify = false; // test only: run the A* even where the pre-check proved no path, count mismatches
46 int reach_check = 1; // flood-fill reachability check before strict searches (exact): 0 off, 1 likely failures, 2 all
47 bool bend_states = true; // direction in the A* state (exact bend costs) vs. parent-direction approximation
48 double heuristic_weight = 1.0;
49 // Plane-aware routing of all-SMD boards (doc 05 §26), all opt-in:
50 bool soft_zones = false; // zone fills do not block other nets (refilled afterwards); unused fills become plane targets
51 bool via_in_pad = false; // inner balls / enclosed SMD pads may take a minimum-size via in the pad
52 bool vias_off_pads = false; // vias keep clear of SMD pads narrower than vias_off_pads_below_mm (except via-in-pad)
54 bool field_heuristic = true; // GPU cost-to-go field as the A* heuristic on large windows
55 int field_min_cells = 60'000; // window size (lattice points x layers) from which the field is used
56 int gpu_device = 0; // GPU backend device for fields (-1 = CPU reference)
57 int max_attempts = 4; // per connection (window growth and learned blocks between attempts)
58 int soft_attempts = 3; // window sizes tried by negotiated searches
59 double via_cost_mm = 3.0; // equivalent track length of one via
60 bool allow_vias = true;
61 double polish_fraction = 0; // share of the budget reserved for rebuilding the open connections of the best state (doc 16)
62 int polish_trials = 20; // seeded orders tried per open connection in the polish
63 int lns_open_trials = 0; // regional rebuild of open connections: seeded orders tried per open connection (0 = off, doc 16 F4)
64 double lns_open_radius_mm = 2.5; // copper within this distance of the open connection's first pad is lifted
65 double layer_dir_pen = -1; // negative = automatic (-1: 0.3; otherwise the strength is the absolute value) on breakout boards only, else 0; extra cost (pitches per orthogonal step) against a layer's preferred direction: even layers horizontal, odd vertical (doc 16)
66 bool layer_dir_swap = false; // preferred directions the other way round: even layers vertical, odd horizontal
67 double package_pen = -1; // -1 = automatic (3 on a two-layer board with a ball-grid package, else 0); pitches per lattice step for tracks on the pad layer inside a ball-grid package (doc 16 F3; 0 = off)
68 bool layer_assign_angle = false; // layer preference by chord direction instead of by crossings (uses layer_assign_pen)
69 bool layer_assign = false; // doc 16 F2: prefer, per connection, the layer that leaves the fewest crossings (two-layer boards)
70 double layer_assign_pen = 0.4; // pitches per lattice step on the other layer
71 bool strict_first = true; // the first pass is strict (no crossing of routed copper); off: negotiate from the first pass
72 bool rip_up = true; // negotiated rip-up and reroute (design doc 05 §6 rung R2, doc 06 §3)
73 double history_weight = 2.0; // PathFinder history: pitches of cost per recorded conflict on a cell
74 int max_victims = 0; // a negotiated route may rip at most this many connections at once (0 = no limit)
75 double txn_temp = -1; // transactional negotiation: a route that loses k connections net is kept with probability exp(-k / txn_temp) (0 = never, -1 = automatic: 1.5 on a breakout board)
76 int txn_cool = 0; // 1: the temperature falls linearly to zero over the work budget (simulated-annealing schedule)
77 int stall_passes = 0; // > 0: a restart begins when this many passes in a row set no new best for the run since its last restart
78 long txn_cap = 0; // transactional negotiation: expansion cap of each victim's re-route search (0 = none)
79 int txn_depth = 0; // transactional negotiation: victims that cannot be re-routed strictly get a nested transaction of their own, this deep
80 int txn_nested = 4; // nested transactions allowed per top-level transaction
81 int field_cache_mb = 0; // > 0: cost-to-go fields are kept (this many MB per router) and reused when every input is identical; results are unchanged
82 int flood_work_pct = 100; // reachability-flood cells count this percent of an expansion against the work budget (a flood cell costs far less time)
83 int field_prefill = 0; // 1: fill a class's fixed-copper cache for the whole board before its first field, so fields depend on nothing learned later (and can be cached)
84 int tidy = 0; // > 0: every this many passes, with connections still open, each routed connection is re-routed alone and kept if shorter (frees room)
85 int txn_orders = 1; // transactional negotiation: orders tried for re-routing the victims (the ones that failed go first in the next try)
86 int breakout_profile = 1; // 1: a breakout board (D98) also gets reach_check 2, flood_work_pct 25, field prefill and cache (when those are at their defaults)
87 const std::vector<ConnRoute>* warm = nullptr; // start from these routes (a previous result's conn_routes): they are kept, negotiation starts at once
88 std::string state_out; // portfolio: after every round the best routes so far are written here (atomically), so an interrupted or out-of-time run can be resumed
89 std::string state_in; // portfolio: start from the routes saved in this file (written by state_out); a missing file is ignored
90 bool relax_late = false; // with relax: plain rounds under the board's rules first; when they stall, start the stages afresh (not from the stalled state), and keep the best legal result of all
91 bool relax = false; // portfolio: relax, route, legalise: ramp stages at 60 % and 80 % of the board's clearance with legalisation and breathing between (D104); needs round_work (20 M by default)
92 double ramp_from_mm = 0; // portfolio: > 0 starts at this clearance (every class and the board minimum lowered by the difference) and raises it by ramp_step_mm per stage up to the board's own; each stage warm-starts from the last one's routes that are still legal (clearance continuation, doc 16 §12.3)
93 double ramp_step_mm = 0.005; // clearance added per stage
94 int ramp_rounds = 2; // a ramp stage ends after this many rounds in a row without gain over the best round of the stage (or when complete)
95 int ramp_cycle = 0; // > 0: when the final stage (the board's rules) has not improved for ramp_stall rounds, go back this many stages and climb again ("breathing"); the best result under the board's rules is returned
96 bool ramp_late = false; // start at the board's rules and use the ramp (with ramp_cycle) only once those stall
97 int ramp_fresh = 0; // > 0: every n-th breathing cycle starts from nothing instead of the best state (a new topology; the best result under the board's rules is kept)
98 int ramp_stall = 3; // rounds without improvement at the final stage before breathing
99 int island_slack = -1; // portfolio rounds: >= 0 lets every variant continue the next round from its own final state when that routes at least (best - island_slack) connections, instead of all from the best (islands; the best state ever seen is returned)
100 bool keep_final = false; // also return the live state at the end of the run (RouteResult::final_routes)
101 std::vector<model::Track> warm_tracks; // copper of a routed board (--warm-pcb) to start from: a net with one connection takes all of its tracks and vias; only what is legal under this board's rules is kept
102 std::vector<model::Via> warm_vias;
103 double legalize_subdivide_mm = 0; // > 0 with legalize: route tracks are cut into pieces of at most this length so they can bend (route/legalize.hpp)
104 bool legalize = false; // warm start: first move the vertices of the taken-over routes until the board's clearances hold (route/legalize.hpp), then keep what is legal
105 bool state_recheck = false; // warm start: take over only the routes that are legal under this board's rules (continuation from looser rules)
106 int breakout_portfolio = 1; // 1: with more than one variant, a board that looks like a ball-grid breakout gets the breakout portfolio (D101) instead of the designed eight
107 long round_work = 0; // portfolio: > 0 gives every round this work budget (instead of splitting the total), and rounds continue until the board is complete, `rounds` is reached or `time_limit_s` of the whole portfolio is used (--until-complete)
108 int rounds = 0; // portfolio: the work budget is split into this many rounds; after each, every variant continues from the best result so far (0 = automatic: 4 with the breakout portfolio, else 1)
109 int txn = -1; // transactional negotiation (doc 16 §12): a route that rips victims is kept only if the victims can be re-routed
110 // without ripping: 0 = off, 1 = keep ties (net 0), 2 = strict gain only, -1 = automatic (1 on a breakout board, else 0)
111 int max_rips_per_connection = 40; // was 8: at 50 M work on dense breakouts 33 % -> 54 % clean (doc 16 §4)
112 int max_passes = 40; // passes over still-unrouted connections (was 12)
113 // Micro vias (outer layer to the next one, the net class's microvia size) where a through via is blocked, on
114 // boards whose rules allow them (doc 05 §21).
115 bool micro_vias = false;
116 bool blind_vias = false; // use blind/buried vias where a through via is blocked, if the board allows them
117 bool diff_pairs = false; // route P/N pairs together as coupled tracks first (falls back to single routing)
118 // Component rules (doc 15 P3): these net pairs only are routed coupled first when diff_pairs is off (e.g. USB 2.0
119 // D+/D- bound by tm::crules, whose names need not end in P/N or +/-). Empty = none.
120 std::vector<std::pair<model::NetId, model::NetId>> pair_nets;
121 // Intra-pair skew limit for pairs routed coupled (0 = only KiCad custom `skew` rules): the shorter half gets meanders
122 // in the clean-up until the halves differ by at most half of it (length tuning code, doc 05 §15).
123 // Coupled pairs may twist: change layer one half after the other and cross in between, so that a pair whose
124 // pin order is mirrored between its ends can still be routed coupled (doc 05 §24).
125 bool pair_twists = true;
127 // Per-pair limits for RouterOptions::pair_nets (same index; 0 or missing = pair_skew): component rules give each
128 // interface its own limit (USB 2.0 1.27 mm, doc 15 USB2-02).
129 std::vector<Coord> pair_net_skew;
130 bool global_route = false; // plan every connection on a coarse tile graph first; detailed search follows the corridors
131 // Global router v2 (M6): the first search of each connection is confined to its corridor (cells outside are
132 // blocked, window cropped to the corridor); only if that fails do the usual unconfined windows run.
133 bool global_confine = false;
134 // Strict pass with corridors: a connection that cannot be routed inside its corridor goes straight to
135 // negotiation instead of flooding the wide strict windows (on logicbone those failed floods were 76 % of all
136 // search expansions; doc 05 §13).
138 // Global congestion map (M6, doc 05 §16): plan on the tile graph, then charge detailed steps through tiles the
139 // plan fills beyond global_congestion_from eighths of capacity, except near the connection's own ends. No corridors.
140 bool global_congestion = false;
142 double global_congestion_pen = 0.5; // pitches per lattice step, per eighth of capacity above the threshold
143 // Connection planning measures pad copper to pad copper instead of centre to centre (doc 05 §17).
144 bool plan_gap = true;
145 bool optimize = true; // post-routing clean-up: re-route connections to save vias and length
146 bool escape_plan = false; // reserve escape corridors for the pins of dense packages (route/escape.hpp, M9)
147 // Corridors of the review of the EtherCAT shield (reports/realworld/ethercat_qfn_analysis.md, doc 05 §47). All off by default: no change without them.
148 double escape_length_mm = 0; // > 0: perimeter corridors run this far past the package edge (2 mm by default), as far as no fixed copper is in the way (bundles of parallel straight escapes)
149 bool escape_stubs = false; // with the escape plan: a pin offers the end of its (long, straight) corridor as a start point, reached by one exact off-lattice segment at a discount: parallel escapes at the pad pitch, which the lattice cannot draw
150 bool soft_mask_graphics = false; // net-less solder-mask openings drawn as footprint graphics (solder jumpers, MEMS microphones) do not keep tracks and vias out; KiCad flags what lies in them
151 bool soft_copper_graphics = false; // board copper graphics (polygons on a copper layer) take the net of the pads, tracks and vias of the one net they touch (a manual pour), so that net's pins inside are not enclosed and no other net may touch them
152 bool via_drops = false; // pins of dense packages may drop to a via 0.7-1.5 mm out, off the lattice, between the neighbours' tracks (the designer's supply vias), then go on on the other layer
153 bool bundle_escape = false; // doc 05 §50: the connections that leave one side of a dense package for one side of another part are placed first as a block of parallel straight lanes in pin order (route/bundle.hpp); the rest is routed as usual and may not rip the lanes
154 int bundle_min_lanes = 3; // fewer connections than this in a group are left to the ordinary router
155 bool package_tunnels = false; // doc 05 §52: a connection between two perimeter pins of one dense package on one net gets a stub and a via at each pin and its run between them on the other layer (the core rail's tunnel under the package), placed before the search
156 bool supply_first = false; // doc 05 §51: nets with 2+ perimeter pins on one dense package (supply and core nets: +3V3, a core rail) and no pour are routed before everything else and may not be ripped (as --first-nets); the bundles of --bundle-escape are still placed first (placing them after the supply nets was worse: 20 against 13 unrouted on the EtherCAT shield)
157 bool escape_persist = false; // a ripped-up connection gets its pins' corridors back; a corridor is kept while the net has other open connections at that package
158 bool radial_supply = false; // spanning tree: no edge between two pins of one dense package for a net with 3+ pins there (each pin goes to a capacitor or via; the trunk forms outside the escape band)
159 double radial_penalty_mm = 10; // what such an edge costs in the spanning tree
160 bool escape_second_ring = false; // second-ring balls escape between two outer balls instead of by dog-bone
161 // Escape planning version 2 (route/escape_flow.hpp): deep ball-grid arrays get min-cost-flow channel and layer
162 // assignment; other dense packages keep version 1's corridors. Implies escape_plan.
163 bool escape_flow = false;
164 // R6 cut proofs (doc 05 §20): measure every straight line across the board (capacity past fixed copper against
165 // the nets that must cross) and fill RouteResult::over_cuts / tightest_cut. Costs the global router's set-up.
166 bool cut_report = false;
167 bool escape_report = false; // fill RouteResult::escape_rings (pins of deep arrays per ring, and how many connected)
168 int max_restarts = 6; // full restarts (hardest first, history kept) when negotiation stalls
169 double soft_growth = 0.0; // crossing cost grows by this fraction of soft_cost_mm per negotiation pass (PathFinder, doc 16)
170 double soft_cost_mm = 1.0; // base cost of crossing another net's routed copper (before history)
171 std::uint64_t seed = 1;
172 int order = 0; // connection order: 0 shortest first, 1 longest first, 2 shortest first with seeded jitter
173 // Connections to route first ("REF.NUM" pairs, either orientation): learned from earlier failures (doc 06 T3).
174 std::vector<std::pair<std::string, std::string>> priority;
175 std::vector<std::string> first_nets; // routed first, also after restarts; other nets do not rip them (crystal lines)
176 bool first_nets_ordered = false; // route the --first-nets in the order of the list (default: the router's own order within the group)
177 // Nets that are never narrowed below their class width nor given the neck-down via (power nets in a rule-relaxed routing: they have the least margin,
178 // so the relaxation is spent on signals only). Empty = every net may be necked down.
179 std::vector<std::string> no_neck_nets;
180 // Buses (doc 05 §38): groups of nets routed lane by lane. The connections of a group between two components are
181 // routed one after the other in the order of their pins, each steered along the neighbour routed before it, on
182 // the same layers; nets outside the groups do not rip them. `skew` > 0: meanders in the clean-up bring the
183 // members' lengths (tracks and via height, as KiCad's skew check) within it. Empty = off.
184 struct Bus {
185 std::string name;
186 std::vector<model::NetId> nets; // in bus order
188 };
189 std::vector<Bus> buses;
190 bool bus_first = false; // the groups' connections before all others (after first_nets), also after restarts
191 // Path guidance (doc 16 F1): a preferred path for a connection, found by matching its two pad centres. Cells off
192 // the guide cost `guide_pen` pitches per lattice step in every search of that connection (a preference, never a
193 // block), so a guide that does not pass the exact checks only costs search effort. `--guide FILE` fills it
194 // from JSON (experiments); the breakout planner fills it itself.
195 struct GuidePath {
196 geom::Point a{}, b{}; // pad centres of the two ends
197 std::vector<std::array<geom::Point, 2>> segs; // track segments
198 std::vector<int> seg_layer; // copper layer index of each segment
199 std::vector<geom::Point> vias; // through vias (all layers)
200 };
201 std::vector<GuidePath> guides;
202 double guide_pen = 0.1; // pitches per lattice step off the guide
203 double guide_radius = 1.5; // pitches around the guide that count as on it
204 std::string only_net; // debugging: route only this net
205 // Plan the connections and stop: RouteResult::connections and ::unrouted list every connection that is open (reason `not_attempted`), nothing is
206 // searched or committed. A board session (doc 19) lists the open connections of a state this way. Off by default: a run is what it was.
207 bool plan_only = false;
208 std::vector<std::string> skip_nets; // experiments: leave these nets unrouted (e.g. nets a designer would pour)
209 // Layer limits (doc 05 §29; route/layer_limits.hpp turns layer names into these). Layers in no_track_layers get
210 // no new tracks: vias still pass through them and still connect into zone fills there, and pads that exist only
211 // on such layers stay unrouted. layer_cost_pm[l] is the cost of a track on copper layer l per mille of its
212 // length (1000 = normal, never less; missing entries are 1000).
214 std::vector<std::int32_t> layer_cost_pm;
215 // Critical nets (issue #24, doc 05 §44; route_job fills these from --critical-nets and the component rules' roles). `critical` is net name and tier
216 // (1 = most critical). With `critical_first` they are routed before all other nets, tier by tier (after first_nets), also after restarts. A via
217 // costs them `critical_via_mult` times as much (>= 1). A track of theirs over a void of the adjacent reference plane (route/ref_map.hpp) costs
218 // `split_cost` pitches more per lattice step; `split_hard` closes those cells to them instead. All off by default: a run without these options is
219 // the run it was.
220 std::vector<std::pair<std::string, int>> critical;
221 bool critical_first = false;
222 double critical_via_mult = 1.0;
223 double split_cost = 0;
224 bool split_hard = false;
225 double split_min_coverage = 0.3; // a layer is a reference plane when its zone fills cover this share of the board
226 // The board with its zones refilled by the engine, for the reference map: made once by the caller when the file's zones have no fills (every portfolio variant
227 // would otherwise refill the whole board itself). Null = use the board's own fills, refilling here if it has none.
228 std::shared_ptr<const model::Board> reference_fills;
229 // Rule areas and custom rules that exist only in this router's working copy of the board and rules (advice regions, doc 17
230 // §4): never written to the output, judged by the same exact checks as the board's own positional rules (doc 05 §34).
231 std::vector<model::Zone> extra_zones;
232 std::vector<model::CustomRule> extra_rules;
233 // Hints from an advice file (src/advice, doc 17). They are not applied to the variants the portfolio would run
234 // anyway: route_portfolio adds `variants` extra variants that carry them (the next ones of its list, the variants a plain run
235 // with that many more would have added), so the winner of the total order can only be better than without advice,
236 // never worse (rule 4).
237 struct AdviceSet {
238 std::string source; // the advice file, for messages
239 std::vector<std::pair<std::string, std::string>> priority; // "REF.NUM" pairs routed first (as RouterOptions::priority)
240 std::vector<std::string> first_nets; // as RouterOptions::first_nets
241 model::LayerMask no_track_layers = 0; // added to RouterOptions::no_track_layers
242 std::vector<std::int32_t> layer_cost_pm; // per copper layer, per mille (1000 or more); replaces entries that are lower
243 std::vector<model::Zone> zones; // regions: rule areas (no keep-out flags) ...
244 std::vector<model::CustomRule> rules; // ... and the disallow rules that name them and their nets
245 int variants = 4; // advised variants added to the portfolio (at most the variants that run)
246 bool active() const {
247 return !priority.empty() || !first_nets.empty() || no_track_layers != 0 || !layer_cost_pm.empty() || !zones.empty() || !rules.empty();
248 }
250 events::Sink* sink = nullptr;
251 // Shared by portfolio variants (wall-clock mode only): when one variant has routed everything at time T, the
252 // others may continue until 2T + 5 s; a variant that is complete always finishes its clean-up.
253 std::atomic<double>* deadline = nullptr;
254 // Recording: every variant buffers its events and only the winning variant's are forwarded to `sink`
255 // (each message gains a leading "t" field, seconds since that variant started).
256 bool buffer_events = false;
257};
258
261 int pad_a = -1, pad_b = -1; // board pad indices (pad_b = -1 when the target is a zone fill)
262 int zone_b = -1; // copper item index of a zone fill (plane) to connect into, or -1
263 Coord length = 0; // straight-line distance
264};
265
266// Work profile (doc 10 §2, D88): how many of each costly operation a run did, per phase. The counts depend only on
267// the board, the options and the work budget, so the same job gives the same profile on any machine and at any
268// thread count. The --work budget charges expansions and flood cells; the other counts are what it does not charge.
270 long expansions = 0; // A* states expanded (strict, negotiated and coupled-pair searches)
271 long flood_cells = 0; // cells visited by the reachability pre-check
272 long searches = 0; // A* searches and pre-checks started
273 long cell_checks = 0; // lattice points whose legality a search evaluated (per-search cache misses)
274 long fixed_checks = 0; // fixed-copper legality computations (per-class cache misses, tracks and vias)
275 long field_cells = 0; // cost-to-go field cells computed (window x layers per field)
276 long fields = 0;
277 long commits = 0; // found paths checked exactly before committing
278 long rips = 0; // routed connections ripped up by negotiation
280};
281enum class WorkPhase { Setup, FirstPass, Negotiation, Cleanup }; // setup: plan, escape reservations, coupled pairs
282inline constexpr int kWorkPhases = 4;
285 std::array<WorkCounts, kWorkPhases> phase{};
287};
288
290 std::vector<model::Track> tracks; // new copper, in commit order
291 std::vector<model::Via> vias;
292 std::vector<ConnRoute> conn_routes; // the same copper per connection (best state), for a warm start
293 std::vector<ConnRoute> final_routes; // the state the search ended in (RouterOptions::keep_final): legal, perhaps worse than the best
295 int connections = 0, routed = 0;
296 long expansions = 0;
297 long pair_work = 0; // the part of `expansions` spent in coupled pair searches (closed states and leg checks)
298 int rips = 0, passes = 0;
299 int enclosed = 0; // searches that proved the source boxed in (no larger window tried)
300 long nogood_skips = 0; // attempts skipped because an identical attempt already failed
301 int necked = 0; // connections routed at the neck-down width
302 int restarts = 0;
303 int lns_fixed = 0; // open connections closed by the regional rebuild (doc 16 F4)
304 int tidied = 0; // connections shortened by tidy sweeps
305 int txn_tried = 0, txn_kept = 0; // transactional negotiation: routes with victims tried, and kept
306 int optimized = 0;
307 int pairs = 0;
309 // Buses: connections routed as a lane of their group (leaders and the members that followed one), and connections
310 // of a group routed otherwise ("left the bus"), in the state returned.
311 int bus_lanes = 0, bus_left = 0;
312 // Bundle escapes (--bundle-escape): groups found, groups with a spine, connections in them, lanes placed (in the state returned).
314 int tunnels = 0; // package tunnels placed (--package-tunnels)
315 int micro_vias = 0; // micro vias placed
316 int blind_vias = 0; // blind/buried vias placed
317 double escape_corridor_mm = 0; // total length of the corridors reserved (centrelines, version 1)
318 int package_pin_edges = 0; // spanning-tree edges between two pins of one dense package, for nets with 3+ pins there (--radial-supply makes them rarer)
319 int escape_reclaimed = 0; // --escape-persist: corridors given back to the pins of a ripped-up connection
320 int escape_corridors = 0; // escape corridors reserved (M9) // nets brought into their custom length range by meanders // differential pairs routed coupled // connections improved by the clean-up pass
321 // With escape_report: per ring of the deep arrays (index 0 = perimeter), {pins to route, pins with every
322 // connection routed}.
323 std::vector<std::pair<int, int>> escape_rings;
324 // With cut_report: lines across the board that more nets must cross than tracks fit, and the tightest line.
325 std::vector<CutLine> over_cuts;
327 double seconds = 0;
330 std::vector<std::string> failures; // one line per unrouted connection
331 // One unrouted connection of the state returned, structured for the stuck report (doc 17 §3): where it is, why the
332 // last attempt failed (a code, and the search's own words), how often it was ripped or failed, and which nets stood in the way.
333 struct Unrouted {
334 std::string net, a, b; // "REF.NUM" (b = "zone" for plane connections)
335 std::string reason; // code: boxed_in, exact_check, rip_limit, ripped_not_rerouted, layer_limit, out_of_budget, rolled_back, not_attempted, no_legal_path
336 std::string why; // the last explanation as the router wrote it (net and pad names are the board's)
337 int rips = 0, fails = 0;
338 int pad_a = -1, pad_b = -1; // board pad indices (pad_b = -1: a zone fill)
339 geom::Point pos_a{}, pos_b{}; // pad centres (pos_b = pos_a for a zone)
340 std::vector<std::string> blockers; // nets whose routed copper the last rejected route would have had to rip (at most 6)
341 };
342 std::vector<Unrouted> unrouted;
343};
344
345// The reason code of a failure explanation (RouteResult::Unrouted::reason). The text is matched, not parsed: the
346// router's explanations are sentences, and the code is only the class of the cause.
347std::string failure_reason_code(const std::string& why);
348
349// Runs several differently configured routers (portfolio variants) and keeps the best result. Variant i is a pure
350// function of (base options, i): it never depends on the thread count, and with a work budget each variant's result
351// is deterministic. The variants are scheduled on `threads` worker threads (0 = one per variant) in index order and
352// the winner is the minimum of a total order (most connections routed, then fewest vias, then shortest copper, then
353// the lowest variant index), so with `base.work_budget` > 0 the output is the same for any `threads` (requirement
354// N3, decision D47). Only the first variant streams events live.
357 int best_variant = 0; // position in `variants`
358 std::vector<int> indices; // portfolio variant index per position
359 std::vector<std::string> variants; // description per variant
360 std::vector<int> routed; // routed count per variant
361 std::vector<double> seconds; // wall time per variant (its own clock)
362 std::vector<WorkProfile> work; // work profile per variant
363};
364// `variants`: how many variants to run (the first `variants` of the portfolio); `pick`: which variant indices to
365// run instead (non-empty: overrides `variants`). `threads`: concurrency only (0 = one thread per variant).
366PortfolioResult route_portfolio(const model::Board& board, const model::DesignRules& rules, const RouterOptions& base, int variants,
367 const std::vector<int>& pick = {}, int threads = 0);
369// The portfolio's total order on results: true when `a` beats `b` (more routed, then fewer connections off their bus lanes, then
370// fewer vias, then shorter copper). Ties are not "better": the caller keeps the earlier result.
372// Variant indices from here up are the advised copies the portfolio adds when RouterOptions::advice is active (position
373// k of the advice's variants has index kAdvisedIndex + k).
374inline constexpr int kAdvisedIndex = 1000;
375
376class Router {
377 public:
378 Router(const model::Board& board, const model::DesignRules& rules, RouterOptions opt);
380
381 private:
382 struct Impl;
383 const model::Board& in_;
384 const model::DesignRules& rules_;
385 RouterOptions opt_;
386};
387
388} // namespace tmk::route
The board model (design doc 02 §3): every object TraceMaker reads from a .kicad_pcb,...
Router(const model::Board &board, const model::DesignRules &rules, RouterOptions opt)
RouteResult run()
Event sink for live visualisation and replay (design doc 02 §7, protocol in docs/13-viewer-protocol....
Global routing on a coarse 3-D tile graph (design doc 05 §4 and §19, roadmap M6; CPU,...
std::int32_t NetId
0 = no net
Definition board.hpp:21
std::uint64_t LayerMask
bit i = copper layer i in stack order (0 = F.Cu, last = B.Cu)
Definition board.hpp:22
constexpr int kWorkPhases
Definition router.hpp:282
constexpr int kAdvisedIndex
Variant indices from here up are the advised copies the portfolio adds when RouterOptions::advice is ...
Definition router.hpp:374
std::string failure_reason_code(const std::string &why)
The reason code of a failure explanation (RouteResult::Unrouted::reason).
PortfolioResult route_portfolio(const model::Board &board, const model::DesignRules &rules, const RouterOptions &base, int variants, const std::vector< int > &pick={}, int threads=0)
variants: how many variants to run (the first variants of the portfolio); pick: which variant indices...
bool route_result_better(const RouteResult &a, const RouteResult &b)
The portfolio's total order on results: true when a beats b (more routed, then fewer connections off ...
int portfolio_size()
const char * work_phase_name(WorkPhase p)
std::int64_t Coord
Engine coordinate: signed 64-bit nanometres.
Definition units.hpp:12
Design rules as KiCad defines them (design doc 08 §3–4): board minimums and net classes from the ....
The copper of one routed connection, keyed by its two pads: what a later run can start from (RouterOp...
Definition router.hpp:21
std::vector< model::Via > vias
Definition router.hpp:24
std::vector< model::Track > tracks
Definition router.hpp:23
int zone_b
copper item index of a zone fill (plane) to connect into, or -1
Definition router.hpp:262
int pad_b
board pad indices (pad_b = -1 when the target is a zone fill)
Definition router.hpp:261
Coord length
straight-line distance
Definition router.hpp:263
A straight line across the whole board and what has to cross it (escalation rung R6,...
Runs several differently configured routers (portfolio variants) and keeps the best result.
Definition router.hpp:355
std::vector< int > indices
portfolio variant index per position
Definition router.hpp:358
int best_variant
position in variants
Definition router.hpp:357
std::vector< WorkProfile > work
work profile per variant
Definition router.hpp:362
std::vector< std::string > variants
description per variant
Definition router.hpp:359
std::vector< double > seconds
wall time per variant (its own clock)
Definition router.hpp:361
std::vector< int > routed
routed count per variant
Definition router.hpp:360
One unrouted connection of the state returned, structured for the stuck report (doc 17 §3): where it ...
Definition router.hpp:333
std::string reason
code: boxed_in, exact_check, rip_limit, ripped_not_rerouted, layer_limit, out_of_budget,...
Definition router.hpp:335
std::string b
"REF.NUM" (b = "zone" for plane connections)
Definition router.hpp:334
std::vector< std::string > blockers
nets whose routed copper the last rejected route would have had to rip (at most 6)
Definition router.hpp:340
std::string why
the last explanation as the router wrote it (net and pad names are the board's)
Definition router.hpp:336
geom::Point pos_b
pad centres (pos_b = pos_a for a zone)
Definition router.hpp:339
int pad_b
board pad indices (pad_b = -1: a zone fill)
Definition router.hpp:338
int tunnels
package tunnels placed (–package-tunnels)
Definition router.hpp:314
double escape_corridor_mm
total length of the corridors reserved (centrelines, version 1)
Definition router.hpp:317
int package_pin_edges
spanning-tree edges between two pins of one dense package, for nets with 3+ pins there (–radial-suppl...
Definition router.hpp:318
int bundle_groups
Bundle escapes (–bundle-escape): groups found, groups with a spine, connections in them,...
Definition router.hpp:313
int micro_vias
micro vias placed
Definition router.hpp:315
int tidied
connections shortened by tidy sweeps
Definition router.hpp:304
long pair_work
the part of expansions spent in coupled pair searches (closed states and leg checks)
Definition router.hpp:297
std::vector< model::Track > tracks
new copper, in commit order
Definition router.hpp:290
std::vector< std::string > failures
one line per unrouted connection
Definition router.hpp:330
int lns_fixed
open connections closed by the regional rebuild (doc 16 F4)
Definition router.hpp:303
int txn_kept
transactional negotiation: routes with victims tried, and kept
Definition router.hpp:305
int escape_reclaimed
–escape-persist: corridors given back to the pins of a ripped-up connection
Definition router.hpp:319
std::vector< std::pair< int, int > > escape_rings
With escape_report: per ring of the deep arrays (index 0 = perimeter), {pins to route,...
Definition router.hpp:323
long nogood_skips
attempts skipped because an identical attempt already failed
Definition router.hpp:300
std::vector< CutLine > over_cuts
With cut_report: lines across the board that more nets must cross than tracks fit,...
Definition router.hpp:325
int bus_lanes
Buses: connections routed as a lane of their group (leaders and the members that followed one),...
Definition router.hpp:311
int blind_vias
blind/buried vias placed
Definition router.hpp:316
std::vector< ConnRoute > conn_routes
the same copper per connection (best state), for a warm start
Definition router.hpp:292
std::vector< ConnRoute > final_routes
the state the search ended in (RouterOptions::keep_final): legal, perhaps worse than the best
Definition router.hpp:293
int escape_corridors
escape corridors reserved (M9) // nets brought into their custom length range by meanders // differen...
Definition router.hpp:320
int enclosed
searches that proved the source boxed in (no larger window tried)
Definition router.hpp:299
std::vector< Unrouted > unrouted
Definition router.hpp:342
int necked
connections routed at the neck-down width
Definition router.hpp:301
std::vector< model::Via > vias
Definition router.hpp:291
Hints from an advice file (src/advice, doc 17).
Definition router.hpp:237
std::vector< std::int32_t > layer_cost_pm
per copper layer, per mille (1000 or more); replaces entries that are lower
Definition router.hpp:242
model::LayerMask no_track_layers
added to RouterOptions::no_track_layers
Definition router.hpp:241
std::vector< model::CustomRule > rules
... and the disallow rules that name them and their nets
Definition router.hpp:244
std::string source
the advice file, for messages
Definition router.hpp:238
std::vector< model::Zone > zones
regions: rule areas (no keep-out flags) ...
Definition router.hpp:243
int variants
advised variants added to the portfolio (at most the variants that run)
Definition router.hpp:245
std::vector< std::string > first_nets
as RouterOptions::first_nets
Definition router.hpp:240
std::vector< std::pair< std::string, std::string > > priority
"REF.NUM" pairs routed first (as RouterOptions::priority)
Definition router.hpp:239
Buses (doc 05 §38): groups of nets routed lane by lane.
Definition router.hpp:184
std::vector< model::NetId > nets
in bus order
Definition router.hpp:186
Path guidance (doc 16 F1): a preferred path for a connection, found by matching its two pad centres.
Definition router.hpp:195
std::vector< std::array< geom::Point, 2 > > segs
track segments
Definition router.hpp:197
std::vector< geom::Point > vias
through vias (all layers)
Definition router.hpp:199
std::vector< int > seg_layer
copper layer index of each segment
Definition router.hpp:198
geom::Point b
pad centres of the two ends
Definition router.hpp:196
std::vector< std::int32_t > layer_cost_pm
Definition router.hpp:214
int txn
transactional negotiation (doc 16 §12): a route that rips victims is kept only if the victims can be ...
Definition router.hpp:109
int ramp_cycle
> 0: when the final stage (the board's rules) has not improved for ramp_stall rounds,...
Definition router.hpp:95
bool bundle_escape
doc 05 §50: the connections that leave one side of a dense package for one side of another part are p...
Definition router.hpp:153
bool layer_dir_swap
preferred directions the other way round: even layers vertical, odd horizontal
Definition router.hpp:66
double polish_fraction
share of the budget reserved for rebuilding the open connections of the best state (doc 16)
Definition router.hpp:61
bool soft_copper_graphics
board copper graphics (polygons on a copper layer) take the net of the pads, tracks and vias of the o...
Definition router.hpp:151
bool soft_zones
Plane-aware routing of all-SMD boards (doc 05 §26), all opt-in:
Definition router.hpp:50
double package_pen
-1 = automatic (3 on a two-layer board with a ball-grid package, else 0); pitches per lattice step fo...
Definition router.hpp:67
int soft_attempts
window sizes tried by negotiated searches
Definition router.hpp:58
std::vector< std::pair< model::NetId, model::NetId > > pair_nets
Component rules (doc 15 P3): these net pairs only are routed coupled first when diff_pairs is off (e....
Definition router.hpp:120
double txn_temp
transactional negotiation: a route that loses k connections net is kept with probability exp(-k / txn...
Definition router.hpp:75
model::LayerMask no_track_layers
Layer limits (doc 05 §29; route/layer_limits.hpp turns layer names into these).
Definition router.hpp:213
double soft_cost_mm
base cost of crossing another net's routed copper (before history)
Definition router.hpp:170
bool halving
Portfolio with more variants than threads: successive halving (Jamieson and Talwalkar,...
Definition router.hpp:39
long txn_cap
transactional negotiation: expansion cap of each victim's re-route search (0 = none)
Definition router.hpp:78
int txn_depth
transactional negotiation: victims that cannot be re-routed strictly get a nested transaction of thei...
Definition router.hpp:79
bool global_confine
Global router v2 (M6): the first search of each connection is confined to its corridor (cells outside...
Definition router.hpp:133
bool optimize
post-routing clean-up: re-route connections to save vias and length
Definition router.hpp:145
std::vector< std::string > no_neck_nets
Nets that are never narrowed below their class width nor given the neck-down via (power nets in a rul...
Definition router.hpp:179
int field_prefill
1: fill a class's fixed-copper cache for the whole board before its first field, so fields depend on ...
Definition router.hpp:83
bool buffer_events
Recording: every variant buffers its events and only the winning variant's are forwarded to sink (eac...
Definition router.hpp:256
bool plan_gap
Connection planning measures pad copper to pad copper instead of centre to centre (doc 05 §17).
Definition router.hpp:144
bool global_route
plan every connection on a coarse tile graph first; detailed search follows the corridors
Definition router.hpp:130
double ramp_step_mm
clearance added per stage
Definition router.hpp:93
bool via_in_pad
inner balls / enclosed SMD pads may take a minimum-size via in the pad
Definition router.hpp:51
bool fine_variant
portfolio: the cheap-vias variant routes small boards at half pitch
Definition router.hpp:32
bool cut_report
R6 cut proofs (doc 05 §20): measure every straight line across the board (capacity past fixed copper ...
Definition router.hpp:166
std::vector< Coord > pair_net_skew
Per-pair limits for RouterOptions::pair_nets (same index; 0 or missing = pair_skew): component rules ...
Definition router.hpp:129
int field_cache_mb
> 0: cost-to-go fields are kept (this many MB per router) and reused when every input is identical; r...
Definition router.hpp:81
int max_restarts
full restarts (hardest first, history kept) when negotiation stalls
Definition router.hpp:168
int max_attempts
per connection (window growth and learned blocks between attempts)
Definition router.hpp:57
bool layer_assign
doc 16 F2: prefer, per connection, the layer that leaves the fewest crossings (two-layer boards)
Definition router.hpp:69
double guide_radius
pitches around the guide that count as on it
Definition router.hpp:203
std::vector< model::Zone > extra_zones
Rule areas and custom rules that exist only in this router's working copy of the board and rules (adv...
Definition router.hpp:231
bool relax
portfolio: relax, route, legalise: ramp stages at 60 % and 80 % of the board's clearance with legalis...
Definition router.hpp:91
bool global_strict_corridor_only
Strict pass with corridors: a connection that cannot be routed inside its corridor goes straight to n...
Definition router.hpp:137
bool field_heuristic
GPU cost-to-go field as the A* heuristic on large windows.
Definition router.hpp:54
std::vector< Bus > buses
Definition router.hpp:189
bool pair_twists
Intra-pair skew limit for pairs routed coupled (0 = only KiCad custom skew rules): the shorter half g...
Definition router.hpp:125
bool blind_vias
use blind/buried vias where a through via is blocked, if the board allows them
Definition router.hpp:116
double lns_open_radius_mm
copper within this distance of the open connection's first pad is lifted
Definition router.hpp:64
bool keep_final
also return the live state at the end of the run (RouteResult::final_routes)
Definition router.hpp:100
std::vector< std::string > skip_nets
experiments: leave these nets unrouted (e.g.
Definition router.hpp:208
bool rip_up
negotiated rip-up and reroute (design doc 05 §6 rung R2, doc 06 §3)
Definition router.hpp:72
int breakout_portfolio
1: with more than one variant, a board that looks like a ball-grid breakout gets the breakout portfol...
Definition router.hpp:106
double guide_pen
pitches per lattice step off the guide
Definition router.hpp:202
int txn_orders
transactional negotiation: orders tried for re-routing the victims (the ones that failed go first in ...
Definition router.hpp:85
bool escape_plan
reserve escape corridors for the pins of dense packages (route/escape.hpp, M9)
Definition router.hpp:146
double pitch_scale
auto pitch multiplier, applied only on large lattices (>= 3M points per layer)
Definition router.hpp:33
double layer_dir_pen
negative = automatic (-1: 0.3; otherwise the strength is the absolute value) on breakout boards only,...
Definition router.hpp:65
std::vector< GuidePath > guides
Definition router.hpp:201
bool escape_second_ring
second-ring balls escape between two outer balls instead of by dog-bone
Definition router.hpp:160
long work_budget
deterministic budget in search expansions (0 = none): same input + seed => same output
Definition router.hpp:40
double layer_assign_pen
pitches per lattice step on the other layer
Definition router.hpp:70
double radial_penalty_mm
what such an edge costs in the spanning tree
Definition router.hpp:159
int txn_cool
1: the temperature falls linearly to zero over the work budget (simulated-annealing schedule)
Definition router.hpp:76
std::vector< model::CustomRule > extra_rules
Definition router.hpp:232
std::string state_in
portfolio: start from the routes saved in this file (written by state_out); a missing file is ignored
Definition router.hpp:89
int order
connection order: 0 shortest first, 1 longest first, 2 shortest first with seeded jitter
Definition router.hpp:172
int max_victims
a negotiated route may rip at most this many connections at once (0 = no limit)
Definition router.hpp:74
const std::vector< ConnRoute > * warm
start from these routes (a previous result's conn_routes): they are kept, negotiation starts at once
Definition router.hpp:87
std::string only_net
debugging: route only this net
Definition router.hpp:204
int field_min_cells
window size (lattice points x layers) from which the field is used
Definition router.hpp:55
bool strict_first
the first pass is strict (no crossing of routed copper); off: negotiate from the first pass
Definition router.hpp:71
double via_cost_mm
equivalent track length of one via
Definition router.hpp:59
double split_min_coverage
a layer is a reference plane when its zone fills cover this share of the board
Definition router.hpp:225
bool first_nets_ordered
route the –first-nets in the order of the list (default: the router's own order within the group)
Definition router.hpp:176
int reach_check
flood-fill reachability check before strict searches (exact): 0 off, 1 likely failures,...
Definition router.hpp:46
bool package_tunnels
doc 05 §52: a connection between two perimeter pins of one dense package on one net gets a stub and a...
Definition router.hpp:155
bool escape_persist
a ripped-up connection gets its pins' corridors back; a corridor is kept while the net has other open...
Definition router.hpp:157
double pitch_scale_small
Auto pitch multiplier on small lattices (< 1M points per layer): a finer lattice finds fan-outs the d...
Definition router.hpp:31
double legalize_subdivide_mm
> 0 with legalize: route tracks are cut into pieces of at most this length so they can bend (route/le...
Definition router.hpp:103
bool layer_assign_angle
layer preference by chord direction instead of by crossings (uses layer_assign_pen)
Definition router.hpp:68
int max_rips_per_connection
was 8: at 50 M work on dense breakouts 33 % -> 54 % clean (doc 16 §4)
Definition router.hpp:111
bool plan_only
Plan the connections and stop: RouteResult::connections and unrouted list every connection that is op...
Definition router.hpp:207
bool diff_pairs
route P/N pairs together as coupled tracks first (falls back to single routing)
Definition router.hpp:117
int lns_open_trials
regional rebuild of open connections: seeded orders tried per open connection (0 = off,...
Definition router.hpp:63
int ramp_stall
rounds without improvement at the final stage before breathing
Definition router.hpp:98
std::vector< std::pair< std::string, std::string > > priority
Connections to route first ("REF.NUM" pairs, either orientation): learned from earlier failures (doc ...
Definition router.hpp:174
bool state_recheck
warm start: take over only the routes that are legal under this board's rules (continuation from loos...
Definition router.hpp:105
double soft_growth
crossing cost grows by this fraction of soft_cost_mm per negotiation pass (PathFinder,...
Definition router.hpp:169
bool legalize
warm start: first move the vertices of the taken-over routes until the board's clearances hold (route...
Definition router.hpp:104
int ramp_fresh
> 0: every n-th breathing cycle starts from nothing instead of the best state (a new topology; the be...
Definition router.hpp:97
int max_passes
passes over still-unrouted connections (was 12)
Definition router.hpp:112
std::shared_ptr< const model::Board > reference_fills
The board with its zones refilled by the engine, for the reference map: made once by the caller when ...
Definition router.hpp:228
bool escape_stubs
with the escape plan: a pin offers the end of its (long, straight) corridor as a start point,...
Definition router.hpp:149
std::vector< model::Track > warm_tracks
copper of a routed board (–warm-pcb) to start from: a net with one connection takes all of its tracks...
Definition router.hpp:101
double escape_length_mm
Corridors of the review of the EtherCAT shield (reports/realworld/ethercat_qfn_analysis....
Definition router.hpp:148
bool ramp_late
start at the board's rules and use the ramp (with ramp_cycle) only once those stall
Definition router.hpp:96
bool micro_vias
Micro vias (outer layer to the next one, the net class's microvia size) where a through via is blocke...
Definition router.hpp:115
bool reach_verify
test only: run the A* even where the pre-check proved no path, count mismatches
Definition router.hpp:45
bool escape_report
fill RouteResult::escape_rings (pins of deep arrays per ring, and how many connected)
Definition router.hpp:167
int txn_nested
nested transactions allowed per top-level transaction
Definition router.hpp:80
int rounds
portfolio: the work budget is split into this many rounds; after each, every variant continues from t...
Definition router.hpp:108
std::vector< model::Via > warm_vias
Definition router.hpp:102
int breakout_profile
1: a breakout board (D98) also gets reach_check 2, flood_work_pct 25, field prefill and cache (when t...
Definition router.hpp:86
std::vector< std::pair< std::string, int > > critical
Critical nets (issue #24, doc 05 §44; route_job fills these from –critical-nets and the component rul...
Definition router.hpp:220
int ramp_rounds
a ramp stage ends after this many rounds in a row without gain over the best round of the stage (or w...
Definition router.hpp:94
double time_limit_s
wall-clock safety limit for the whole run
Definition router.hpp:34
double global_congestion_pen
pitches per lattice step, per eighth of capacity above the threshold
Definition router.hpp:142
Coord pitch
lattice pitch; 0 = automatic from net-class widths and clearances
Definition router.hpp:28
bool bend_states
direction in the A* state (exact bend costs) vs. parent-direction approximation
Definition router.hpp:47
bool radial_supply
spanning tree: no edge between two pins of one dense package for a net with 3+ pins there (each pin g...
Definition router.hpp:158
events::Sink * sink
Definition router.hpp:250
std::vector< std::string > first_nets
routed first, also after restarts; other nets do not rip them (crystal lines)
Definition router.hpp:175
bool via_drops
pins of dense packages may drop to a via 0.7-1.5 mm out, off the lattice, between the neighbours' tra...
Definition router.hpp:152
int stall_passes
> 0: a restart begins when this many passes in a row set no new best for the run since its last resta...
Definition router.hpp:77
std::string state_out
portfolio: after every round the best routes so far are written here (atomically),...
Definition router.hpp:88
double history_weight
PathFinder history: pitches of cost per recorded conflict on a cell.
Definition router.hpp:73
int island_slack
portfolio rounds: >= 0 lets every variant continue the next round from its own final state when that ...
Definition router.hpp:99
int flood_work_pct
reachability-flood cells count this percent of an expansion against the work budget (a flood cell cos...
Definition router.hpp:82
bool relax_late
with relax: plain rounds under the board's rules first; when they stall, start the stages afresh (not...
Definition router.hpp:90
bool escape_flow
Escape planning version 2 (route/escape_flow.hpp): deep ball-grid arrays get min-cost-flow channel an...
Definition router.hpp:163
bool soft_mask_graphics
net-less solder-mask openings drawn as footprint graphics (solder jumpers, MEMS microphones) do not k...
Definition router.hpp:150
bool supply_first
doc 05 §51: nets with 2+ perimeter pins on one dense package (supply and core nets: +3V3,...
Definition router.hpp:156
long round_work
portfolio: > 0 gives every round this work budget (instead of splitting the total),...
Definition router.hpp:107
double ramp_from_mm
portfolio: > 0 starts at this clearance (every class and the board minimum lowered by the difference)...
Definition router.hpp:92
int tidy
> 0: every this many passes, with connections still open, each routed connection is re-routed alone a...
Definition router.hpp:84
bool global_congestion
Global congestion map (M6, doc 05 §16): plan on the tile graph, then charge detailed steps through ti...
Definition router.hpp:140
int bundle_min_lanes
fewer connections than this in a group are left to the ordinary router
Definition router.hpp:154
int gpu_device
GPU backend device for fields (-1 = CPU reference).
Definition router.hpp:56
bool bus_first
the groups' connections before all others (after first_nets), also after restarts
Definition router.hpp:190
bool vias_off_pads
vias keep clear of SMD pads narrower than vias_off_pads_below_mm (except via-in-pad)
Definition router.hpp:52
std::atomic< double > * deadline
Shared by portfolio variants (wall-clock mode only): when one variant has routed everything at time T...
Definition router.hpp:253
int polish_trials
seeded orders tried per open connection in the polish
Definition router.hpp:62
long max_expansions
Per search attempt.
Definition router.hpp:44
Work profile (doc 10 §2, D88): how many of each costly operation a run did, per phase.
Definition router.hpp:269
WorkCounts & operator+=(const WorkCounts &o)
long cell_checks
lattice points whose legality a search evaluated (per-search cache misses)
Definition router.hpp:273
long expansions
A* states expanded (strict, negotiated and coupled-pair searches).
Definition router.hpp:270
long field_cells
cost-to-go field cells computed (window x layers per field)
Definition router.hpp:275
long rips
routed connections ripped up by negotiation
Definition router.hpp:278
long searches
A* searches and pre-checks started.
Definition router.hpp:272
long fixed_checks
fixed-copper legality computations (per-class cache misses, tracks and vias)
Definition router.hpp:274
long commits
found paths checked exactly before committing
Definition router.hpp:277
long flood_cells
cells visited by the reachability pre-check
Definition router.hpp:271
WorkCounts total() const
std::array< WorkCounts, kWorkPhases > phase
Definition router.hpp:285