Schematic and layout
Autorouting
agentee route, tie, tune and neck: grid routing that keeps class widths, clearances and vias, plane ties, length matching and neck-downs.
agentee route NAME --nets 'FX_D*,SPI_*' --layers F.Cu,In2.Cu,B.Cu (MCP route) routes the ratsnest of the named nets with the layout engine's detail router (see docs/layout-engine-2.md) and appends the tracks and vias to the layout file as ordinary [[tracks]] and [[vias]], so they are yours to edit afterwards. The named nets negotiate for room together on a grid (--grid, default 0.05 mm) over up to 30 rounds, routed in parallel, ripping up only the pieces that overlap, so the order they are named in does not matter. --layers keeps tracks to those layers, apart from a short stub out of a pad that sits on none of them; --via limits layer changes to the named vias, otherwise a net takes its class vias first and the board's others after. --via-cost, --bend-cost and --via-in-pad work as below. Each net's new copper is checked against the rules before it is written; the tracks and vias that break one are dropped with the rule named under failed, and the rest of the net is kept. A via the net is joined without is dropped.
A pair whose class has a diff_gap at least its clearance, with one connection per net, is routed coupled: a centreline as wide as both tracks and the gap is searched on one layer from near the middle of one pair of pads to near the middle of the other, offset into two tracks at exactly the pair gap, and each net then joins its pads to its track with an ordinary breakout. The centreline negotiates like any net, so a pair that overlaps another net is laid again in the next round; between the two nets of a pair only the plain clearance holds, so the breakouts may run beside the coupled tracks. A pair left with an open connection is tried once more uncoupled and kept that way if it joins more. --pairs is accepted and does nothing more. A net in an interface with max_vias gets its share of the lane's remaining vias (the lane less the vias it already has, split over the lane's nets being routed); a connection that takes more is searched again with dearer vias (four times, sixteen when no via is left), and the second route is kept only if it fits. Otherwise the first stands and check reports interface-vias, since holding every lane to its budget cost more connections than it saved errors.
The viewer's single-connection route goes through the older grid router. The grid router keeps each net class's width, clearance and layers against every pad, track, via, hole and the board edge, sizes the room for each class via by its own pad, drill and layers (a microvia fits where a through via does not, and a microvia may sit beside a buried via on other layers), keeps new vias min_hole_to_hole from every drill whose span shares a dielectric with theirs and their holes min_via_hole_to_copper from other nets' pads, tracks and vias, keeps them off SMD pads of every net, its own too (the via copper may not touch one, via-cuts-pad, and the hole stays min_hole_to_smd_pad from it, hole-to-smd-pad, unless --via-in-pad, MCP via_in_pad, lets it sit wholly inside an SMD pad of its net with a drill of at most max_filled_via_drill), uses the class vias to change layer, the cheapest whose span holds both layers (--via uv-top,core or MCP via to choose from other names instead, --via-cost in mm of track, default 3, times the via's cost), charges --bend-cost mm of track for each 45 degree bend (default 0.1, three times that for 90), and never moves what is already there unless --reroute is given, which deletes the named nets' tracks and vias first. A connection that finds no free path rips up the routed nets it would cross or whose via holes it would bring within min_hole_to_hole of its own (holes whose spans share a dielectric), remembers the spot as congested, and those nets go back in the queue. The search steps in 45 degree directions and charges for every bend, so paths come out as straight runs with 45 degree bends; afterwards runs are pulled tight with two-segment 45 degree doglegs and any 90 degree corner left is chamfered where it clears. Only the stub into an off-grid pad centre may sit at another angle. Where the class width does not fit into an end pad (wider than the pad's smaller side, or too close to the neighbouring pads to keep clearance), the route necks down: the class width track stops short of the pad and a separate [[tracks]] entry with an explicit width runs straight into the pad centre, at most the class neckdown long and no narrower than min_track_width. Its width is the smallest of the class width, the pad's smaller side and the widest that keeps clearance, rounded down to 0.01 mm (or exactly min_track_width where rounding would drop under it and the unrounded width does not); the wide track starts at the first spot out from the pad where its full width keeps clearance (and, for a pad narrower than the track, outside the pad). Pads of one net that touch, like a thermal pad built from several pad entries, count as one wide pad. Pairs routed with --pairs do not neck down. A connection of a net that already has fresh copper starts from that copper. A connection that finds no path even through the nets it could rip up waits for the other connections of its net and tries once more from the copper they add. Classes route one after another, the tightest first (fewest allowed layers, then the widest track plus clearance), each held fixed for the next. Once a class is in, every net of it with vias is ripped up and routed again with vias four times dearer and the rest held fixed, and the new route stays when it has fewer vias (or joins more), pass after pass while one saves a via. Then each routed connection that uses vias is tried again on one layer at a time with the rest held fixed, and the one-layer route replaces it when it is at most 25% plus 1 mm longer. Then the vias of neighbouring parallel connections that change layer near each other are slid along their own tracks onto a common row or column on the grid, where the spot is legal and the connection keeps its length (pair legs held by --pairs and nets with several connections stay put). A net in an interface with max_vias keeps the trace (every net of the lane, through series parts) within it: a route with too many vias is tried again with dearer vias, then on one layer, and fails with the reason if neither fits. The second net of a pair is drawn toward its partner at the pair gap; --pairs tries to route both halves together as one coupled track first. When connections fail, the whole route runs again, up to four times in all, with the failed nets first in their class and their class first, and a cost on the path they would take through the copper of earlier classes so those classes leave it free; the run with the fewest failures, then the fewest vias, then the least track is written. A new via the net is joined without (its pads stay together through the other copper and the pours) is dropped with the stub that only led to it before anything is written; a via that drops a track to a pour on a layer the track does not reach stays. When a few connections fail, route them again together with the nets around them and --reroute, so the router can rip up and reorder the whole area, or drop to --grid 0.025. --dry-run reports without writing. Route the nets that matter by hand first, then let the router fill in the rest, a class at a time.
A net with a [[zones]] entry is a plane net. A glob in --nets never matches it, so --nets '*' routes every signal and supply that has no pour and leaves ground to the planes; name the net exactly to route it with tracks anyway. Vias placed by [[stitching]] rules are not obstacles to the router: the rule places them again around the new copper.
agentee tie NAME [--nets GND] [--dry-run] (MCP tie) connects each SMD pad of a plane net to the nearest layer its zone covers with a short stub and a via beside the pad, which is how ground and supply pads join a plane instead of tracks between them. The via goes straight out from the side of the part the pad sits on, so a row of pins gets a row of vias, as close as it can: its copper clear of every SMD pad (its own too, so no via-in-pad), its hole min_hole_to_smd_pad from them, min_hole_to_hole from other holes, min_via_hole_to_copper and the class clearance from other nets, min_copper_to_edge in from the outline, and the stub clear of other nets on the pad's layer. The stub starts where it leaves the pad, not at its centre, so a fine-pitch part's other pad is not in its way. It tries 16 directions, nearest the outward one first, up to 1.2 mm past the pad. A pad already joined to the main body of its net's zone on another layer is left alone, through whatever copper of its net does it: the pour on its own layer, tracks, vias and plated holes, so a pad in a ground pour that reaches the plane anywhere needs nothing, and running tie again adds nothing. Once tie puts a via on a pad in a pour island, the other pads in that island count as joined, so an island takes one via. Pads of a decoupling capacitor (a capacitor with a pin on a supply net) and of a part on an RF class net are the exception: they want the short return path, so each gets its own via unless a plated hole of its net is within 0.8 mm of its edge, a via of its net within 0.8 mm sits in the same pour island, or its own tracks already run to a via on the plane layer within reach of a tie. Through-hole pads and BGA balls (escape handles those) are skipped, and a pad with no legal spot is listed under failed. The stubs and vias are appended as ordinary [[tracks]] and [[vias]].
agentee neck NAME [--nets 'VBUS,RF_*'] [--taper] [--dry-run] (MCP neck) necks down copper that is already there. It looks at both ends of every track of the named nets (default all) that end inside a pad of their net on their layer, and takes the ones that are wider than the pad's smaller side, or whose full width breaks clearance within the class neckdown length (plus one track width) of the pad. Such an end is cut: the track keeps its width from the cut outward and a new [[tracks]] entry with an explicit width runs from the old end point in the pad to the cut, along the old path. The neck width is the smallest of the track width, the pad's smaller side and the widest that keeps clearance along the neck, rounded down to 0.01 mm (or exactly min_track_width as above). The cut is the first spot, in 0.01 mm steps, where the full width keeps clearance for the next neckdown plus one track width (and, for a pad narrower than the track, lies outside the pad); a neck is never longer than neckdown and never under min_track_width, otherwise the end is listed under failed with the reason and left alone. A pad built from several same-net pad entries that touch counts as one wide pad. --taper steps the width back up over a short chain instead of one neck: past the narrow neck come up to two more entries, each a third of the way from the neck width to the track width, together no longer than neckdown (three times the neck, at most). The copper only ever gets narrower, so no new clearance error can appear; the file is edited in place (every other line is kept) and stored zone fills are refreshed. The report lists each neck (track index, net, pad, why, width, length, entries) and counts the tracks changed and added.
Pairs and length rules live in the layout too:
[[pairs]] # optional: nets ending _P/_N, _DP/_DN, +/-, P/N in a class
p = "USB_DP" # with diff_gap are paired on their own
n = "USB_DN"
max_skew = "0.1mm" # or `max_skew` on the net class
[[match_groups]]
name = "ddr-dq0"
nets = ["DQ?", "DQS0_*"] # * and ? globs
tolerance = "0.5mm"
# target = "42mm" # default the longest memberCheck reports each pair's skew in mm and ps (from the layer's effective permittivity), a stretch of the pair run at the wrong gap, and pairs that spend less than 80% of their length side by side. Match groups say which net is short or over and by how much. A pair that runs through series two-pin parts, like the AC caps on a USB lane, is measured end to end: its skew is the sum over every pair it joins, reported as FX_TX1_P+SS_TX1_P/FX_TX1_N+SS_TX1_N.