24 std::vector<model::Via>
vias;
87 const std::vector<ConnRoute>*
warm =
nullptr;
120 std::vector<std::pair<model::NetId, model::NetId>>
pair_nets;
174 std::vector<std::pair<std::string, std::string>>
priority;
186 std::vector<model::NetId>
nets;
197 std::vector<std::array<geom::Point, 2>>
segs;
239 std::vector<std::pair<std::string, std::string>>
priority;
244 std::vector<model::CustomRule>
rules;
285 std::array<WorkCounts, kWorkPhases>
phase{};
367 const std::vector<int>& pick = {},
int threads = 0);
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)
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
std::uint64_t LayerMask
bit i = copper layer i in stack order (0 = F.Cu, last = B.Cu)
constexpr int kWorkPhases
constexpr int kAdvisedIndex
Variant indices from here up are the advised copies the portfolio adds when RouterOptions::advice is ...
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 ...
const char * work_phase_name(WorkPhase p)
std::int64_t Coord
Engine coordinate: signed 64-bit nanometres.
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...
std::vector< model::Via > vias
std::vector< model::Track > tracks
int zone_b
copper item index of a zone fill (plane) to connect into, or -1
int pad_b
board pad indices (pad_b = -1 when the target is a zone fill)
Coord length
straight-line distance
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.
std::vector< int > indices
portfolio variant index per position
int best_variant
position in variants
std::vector< WorkProfile > work
work profile per variant
std::vector< std::string > variants
description per variant
std::vector< double > seconds
wall time per variant (its own clock)
std::vector< int > routed
routed count per variant
One unrouted connection of the state returned, structured for the stuck report (doc 17 §3): where it ...
std::string reason
code: boxed_in, exact_check, rip_limit, ripped_not_rerouted, layer_limit, out_of_budget,...
std::string b
"REF.NUM" (b = "zone" for plane connections)
std::vector< std::string > blockers
nets whose routed copper the last rejected route would have had to rip (at most 6)
std::string why
the last explanation as the router wrote it (net and pad names are the board's)
geom::Point pos_b
pad centres (pos_b = pos_a for a zone)
int pad_b
board pad indices (pad_b = -1: a zone fill)
int tunnels
package tunnels placed (–package-tunnels)
double escape_corridor_mm
total length of the corridors reserved (centrelines, version 1)
int package_pin_edges
spanning-tree edges between two pins of one dense package, for nets with 3+ pins there (–radial-suppl...
int bundle_groups
Bundle escapes (–bundle-escape): groups found, groups with a spine, connections in them,...
int micro_vias
micro vias placed
int tidied
connections shortened by tidy sweeps
long pair_work
the part of expansions spent in coupled pair searches (closed states and leg checks)
std::vector< model::Track > tracks
new copper, in commit order
std::vector< std::string > failures
one line per unrouted connection
int lns_fixed
open connections closed by the regional rebuild (doc 16 F4)
int txn_kept
transactional negotiation: routes with victims tried, and kept
int escape_reclaimed
–escape-persist: corridors given back to the pins of a ripped-up connection
std::vector< std::pair< int, int > > escape_rings
With escape_report: per ring of the deep arrays (index 0 = perimeter), {pins to route,...
long nogood_skips
attempts skipped because an identical attempt already failed
std::vector< CutLine > over_cuts
With cut_report: lines across the board that more nets must cross than tracks fit,...
int bus_lanes
Buses: connections routed as a lane of their group (leaders and the members that followed one),...
int blind_vias
blind/buried vias placed
std::vector< ConnRoute > conn_routes
the same copper per connection (best state), for a warm start
std::vector< ConnRoute > final_routes
the state the search ended in (RouterOptions::keep_final): legal, perhaps worse than the best
int escape_corridors
escape corridors reserved (M9) // nets brought into their custom length range by meanders // differen...
int enclosed
searches that proved the source boxed in (no larger window tried)
std::vector< Unrouted > unrouted
int necked
connections routed at the neck-down width
std::vector< model::Via > vias
Hints from an advice file (src/advice, doc 17).
std::vector< std::int32_t > layer_cost_pm
per copper layer, per mille (1000 or more); replaces entries that are lower
model::LayerMask no_track_layers
added to RouterOptions::no_track_layers
std::vector< model::CustomRule > rules
... and the disallow rules that name them and their nets
std::string source
the advice file, for messages
std::vector< model::Zone > zones
regions: rule areas (no keep-out flags) ...
int variants
advised variants added to the portfolio (at most the variants that run)
std::vector< std::string > first_nets
as RouterOptions::first_nets
std::vector< std::pair< std::string, std::string > > priority
"REF.NUM" pairs routed first (as RouterOptions::priority)
Buses (doc 05 §38): groups of nets routed lane by lane.
std::vector< model::NetId > nets
in bus order
Path guidance (doc 16 F1): a preferred path for a connection, found by matching its two pad centres.
std::vector< std::array< geom::Point, 2 > > segs
track segments
std::vector< geom::Point > vias
through vias (all layers)
std::vector< int > seg_layer
copper layer index of each segment
geom::Point b
pad centres of the two ends
double vias_off_pads_below_mm
std::vector< std::int32_t > layer_cost_pm
int txn
transactional negotiation (doc 16 §12): a route that rips victims is kept only if the victims can be ...
int ramp_cycle
> 0: when the final stage (the board's rules) has not improved for ramp_stall rounds,...
bool bundle_escape
doc 05 §50: the connections that leave one side of a dense package for one side of another part are p...
bool layer_dir_swap
preferred directions the other way round: even layers vertical, odd horizontal
double polish_fraction
share of the budget reserved for rebuilding the open connections of the best state (doc 16)
bool soft_copper_graphics
board copper graphics (polygons on a copper layer) take the net of the pads, tracks and vias of the o...
bool soft_zones
Plane-aware routing of all-SMD boards (doc 05 §26), all opt-in:
double package_pen
-1 = automatic (3 on a two-layer board with a ball-grid package, else 0); pitches per lattice step fo...
int soft_attempts
window sizes tried by negotiated searches
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....
double txn_temp
transactional negotiation: a route that loses k connections net is kept with probability exp(-k / txn...
model::LayerMask no_track_layers
Layer limits (doc 05 §29; route/layer_limits.hpp turns layer names into these).
double soft_cost_mm
base cost of crossing another net's routed copper (before history)
bool halving
Portfolio with more variants than threads: successive halving (Jamieson and Talwalkar,...
long txn_cap
transactional negotiation: expansion cap of each victim's re-route search (0 = none)
int txn_depth
transactional negotiation: victims that cannot be re-routed strictly get a nested transaction of thei...
bool global_confine
Global router v2 (M6): the first search of each connection is confined to its corridor (cells outside...
bool optimize
post-routing clean-up: re-route connections to save vias and length
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...
int global_congestion_from
int field_prefill
1: fill a class's fixed-copper cache for the whole board before its first field, so fields depend on ...
bool buffer_events
Recording: every variant buffers its events and only the winning variant's are forwarded to sink (eac...
bool plan_gap
Connection planning measures pad copper to pad copper instead of centre to centre (doc 05 §17).
bool global_route
plan every connection on a coarse tile graph first; detailed search follows the corridors
double ramp_step_mm
clearance added per stage
bool via_in_pad
inner balls / enclosed SMD pads may take a minimum-size via in the pad
bool fine_variant
portfolio: the cheap-vias variant routes small boards at half pitch
bool cut_report
R6 cut proofs (doc 05 §20): measure every straight line across the board (capacity past fixed copper ...
std::vector< Coord > pair_net_skew
Per-pair limits for RouterOptions::pair_nets (same index; 0 or missing = pair_skew): component rules ...
int field_cache_mb
> 0: cost-to-go fields are kept (this many MB per router) and reused when every input is identical; r...
int max_restarts
full restarts (hardest first, history kept) when negotiation stalls
int max_attempts
per connection (window growth and learned blocks between attempts)
bool layer_assign
doc 16 F2: prefer, per connection, the layer that leaves the fewest crossings (two-layer boards)
double guide_radius
pitches around the guide that count as on it
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...
bool relax
portfolio: relax, route, legalise: ramp stages at 60 % and 80 % of the board's clearance with legalis...
bool global_strict_corridor_only
Strict pass with corridors: a connection that cannot be routed inside its corridor goes straight to n...
bool field_heuristic
GPU cost-to-go field as the A* heuristic on large windows.
bool pair_twists
Intra-pair skew limit for pairs routed coupled (0 = only KiCad custom skew rules): the shorter half g...
bool blind_vias
use blind/buried vias where a through via is blocked, if the board allows them
double lns_open_radius_mm
copper within this distance of the open connection's first pad is lifted
bool keep_final
also return the live state at the end of the run (RouteResult::final_routes)
std::vector< std::string > skip_nets
experiments: leave these nets unrouted (e.g.
bool rip_up
negotiated rip-up and reroute (design doc 05 §6 rung R2, doc 06 §3)
int breakout_portfolio
1: with more than one variant, a board that looks like a ball-grid breakout gets the breakout portfol...
double guide_pen
pitches per lattice step off the guide
int txn_orders
transactional negotiation: orders tried for re-routing the victims (the ones that failed go first in ...
bool escape_plan
reserve escape corridors for the pins of dense packages (route/escape.hpp, M9)
double pitch_scale
auto pitch multiplier, applied only on large lattices (>= 3M points per layer)
double layer_dir_pen
negative = automatic (-1: 0.3; otherwise the strength is the absolute value) on breakout boards only,...
std::vector< GuidePath > guides
bool escape_second_ring
second-ring balls escape between two outer balls instead of by dog-bone
long work_budget
deterministic budget in search expansions (0 = none): same input + seed => same output
double layer_assign_pen
pitches per lattice step on the other layer
double radial_penalty_mm
what such an edge costs in the spanning tree
int txn_cool
1: the temperature falls linearly to zero over the work budget (simulated-annealing schedule)
std::vector< model::CustomRule > extra_rules
std::string state_in
portfolio: start from the routes saved in this file (written by state_out); a missing file is ignored
int order
connection order: 0 shortest first, 1 longest first, 2 shortest first with seeded jitter
int max_victims
a negotiated route may rip at most this many connections at once (0 = no limit)
const std::vector< ConnRoute > * warm
start from these routes (a previous result's conn_routes): they are kept, negotiation starts at once
std::string only_net
debugging: route only this net
int field_min_cells
window size (lattice points x layers) from which the field is used
bool strict_first
the first pass is strict (no crossing of routed copper); off: negotiate from the first pass
double via_cost_mm
equivalent track length of one via
double split_min_coverage
a layer is a reference plane when its zone fills cover this share of the board
bool first_nets_ordered
route the –first-nets in the order of the list (default: the router's own order within the group)
int reach_check
flood-fill reachability check before strict searches (exact): 0 off, 1 likely failures,...
bool package_tunnels
doc 05 §52: a connection between two perimeter pins of one dense package on one net gets a stub and a...
bool escape_persist
a ripped-up connection gets its pins' corridors back; a corridor is kept while the net has other open...
double pitch_scale_small
Auto pitch multiplier on small lattices (< 1M points per layer): a finer lattice finds fan-outs the d...
double legalize_subdivide_mm
> 0 with legalize: route tracks are cut into pieces of at most this length so they can bend (route/le...
bool layer_assign_angle
layer preference by chord direction instead of by crossings (uses layer_assign_pen)
int max_rips_per_connection
was 8: at 50 M work on dense breakouts 33 % -> 54 % clean (doc 16 §4)
bool plan_only
Plan the connections and stop: RouteResult::connections and unrouted list every connection that is op...
bool diff_pairs
route P/N pairs together as coupled tracks first (falls back to single routing)
int lns_open_trials
regional rebuild of open connections: seeded orders tried per open connection (0 = off,...
int ramp_stall
rounds without improvement at the final stage before breathing
std::vector< std::pair< std::string, std::string > > priority
Connections to route first ("REF.NUM" pairs, either orientation): learned from earlier failures (doc ...
bool state_recheck
warm start: take over only the routes that are legal under this board's rules (continuation from loos...
double soft_growth
crossing cost grows by this fraction of soft_cost_mm per negotiation pass (PathFinder,...
bool legalize
warm start: first move the vertices of the taken-over routes until the board's clearances hold (route...
int ramp_fresh
> 0: every n-th breathing cycle starts from nothing instead of the best state (a new topology; the be...
int max_passes
passes over still-unrouted connections (was 12)
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 ...
bool escape_stubs
with the escape plan: a pin offers the end of its (long, straight) corridor as a start point,...
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...
double escape_length_mm
Corridors of the review of the EtherCAT shield (reports/realworld/ethercat_qfn_analysis....
bool ramp_late
start at the board's rules and use the ramp (with ramp_cycle) only once those stall
bool micro_vias
Micro vias (outer layer to the next one, the net class's microvia size) where a through via is blocke...
bool reach_verify
test only: run the A* even where the pre-check proved no path, count mismatches
bool escape_report
fill RouteResult::escape_rings (pins of deep arrays per ring, and how many connected)
int txn_nested
nested transactions allowed per top-level transaction
int rounds
portfolio: the work budget is split into this many rounds; after each, every variant continues from t...
std::vector< model::Via > warm_vias
int breakout_profile
1: a breakout board (D98) also gets reach_check 2, flood_work_pct 25, field prefill and cache (when t...
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...
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...
double time_limit_s
wall-clock safety limit for the whole run
double global_congestion_pen
pitches per lattice step, per eighth of capacity above the threshold
Coord pitch
lattice pitch; 0 = automatic from net-class widths and clearances
bool bend_states
direction in the A* state (exact bend costs) vs. parent-direction approximation
bool radial_supply
spanning tree: no edge between two pins of one dense package for a net with 3+ pins there (each pin g...
std::vector< std::string > first_nets
routed first, also after restarts; other nets do not rip them (crystal lines)
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...
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...
std::string state_out
portfolio: after every round the best routes so far are written here (atomically),...
double history_weight
PathFinder history: pitches of cost per recorded conflict on a cell.
int island_slack
portfolio rounds: >= 0 lets every variant continue the next round from its own final state when that ...
int flood_work_pct
reachability-flood cells count this percent of an expansion against the work budget (a flood cell cos...
bool relax_late
with relax: plain rounds under the board's rules first; when they stall, start the stages afresh (not...
bool escape_flow
Escape planning version 2 (route/escape_flow.hpp): deep ball-grid arrays get min-cost-flow channel an...
bool soft_mask_graphics
net-less solder-mask openings drawn as footprint graphics (solder jumpers, MEMS microphones) do not k...
bool supply_first
doc 05 §51: nets with 2+ perimeter pins on one dense package (supply and core nets: +3V3,...
long round_work
portfolio: > 0 gives every round this work budget (instead of splitting the total),...
double ramp_from_mm
portfolio: > 0 starts at this clearance (every class and the board minimum lowered by the difference)...
int tidy
> 0: every this many passes, with connections still open, each routed connection is re-routed alone a...
bool global_congestion
Global congestion map (M6, doc 05 §16): plan on the tile graph, then charge detailed steps through ti...
int bundle_min_lanes
fewer connections than this in a group are left to the ordinary router
int gpu_device
GPU backend device for fields (-1 = CPU reference).
bool bus_first
the groups' connections before all others (after first_nets), also after restarts
bool vias_off_pads
vias keep clear of SMD pads narrower than vias_off_pads_below_mm (except via-in-pad)
std::atomic< double > * deadline
Shared by portfolio variants (wall-clock mode only): when one variant has routed everything at time T...
int polish_trials
seeded orders tried per open connection in the polish
long max_expansions
Per search attempt.
Work profile (doc 10 §2, D88): how many of each costly operation a run did, per phase.
WorkCounts & operator+=(const WorkCounts &o)
long cell_checks
lattice points whose legality a search evaluated (per-search cache misses)
long expansions
A* states expanded (strict, negotiated and coupled-pair searches).
long field_cells
cost-to-go field cells computed (window x layers per field)
long rips
routed connections ripped up by negotiation
long searches
A* searches and pre-checks started.
long fixed_checks
fixed-copper legality computations (per-class cache misses, tracks and vias)
long commits
found paths checked exactly before committing
long flood_cells
cells visited by the reachability pre-check
std::array< WorkCounts, kWorkPhases > phase