layout_stitched_pour module#
Stitch a ground pour with vias from a design rule.
A stitch_via rule fills a pour with vias on a grid, so nobody places them
by hand and the grid follows the pour when its outline changes. Three pieces
compose:
A tag on the pour.
StitchedPourTagis assigned to the top-layer GND pour, anddesign_constraint(StitchedPourTag()).stitch_via(via, grid)asks for vias of classviaongridinside every pour that carries the tag. The vias take the pour’s net (measured on jitx 4.6: the 32 generated vias here are onGND).A pitch checked against the substrate.
checked_stitch_gridrefuses a pitch below one via pad, or one at which neighbouring drills would sit closer thanmin_hole_to_hole, read from the fabrication constraints of the substrate of the design that uses the circuit (jitx.current.substrate). The pads need no copper spacing: clearance is not enforced between copper of the same net, and the stitch vias take the pour’s net. JITX does not check this: on jitx 4.6 a pitch below the via pad is thinned to every other site and a pitch that breaksmin_hole_to_holeis placed as asked, both with no design issue (measured with the sample substrate’s 0.45 mm via: pitch 0.4 kept a checkerboard, pitch 0.5 put drills 0.2 mm apart).A same-net anchor. A pour with no pad or via of its own net inside it comes back empty, and the rule’s own stitch vias do not hold it. The runtime still places every stitch via on the removed pour’s footprint, and reports no issue (measured on jitx 4.6, on a 10 mm square pour with a 2.0 mm grid: an empty pour and 25 vias).
gnd_anchoris a code-placed GND via inside the pour.
What the runtime does with the grid, measured on jitx 4.6:
The grid is absolute. Sites are multiples of the pitch from the board origin (0, 0), not from the pour, so moving a pour by less than a pitch moves its outline across a fixed lattice. The pour here is centred off the lattice on purpose.
insetis measured from the via pad edge, not the via centre, to the computed pour boundary. That boundary already includes the pour’s pullback from other-net copper, so a site is kept when a circle of radiuspad / 2 + insetaround it fits inside the computed pour copper.A site that fails is dropped. No via is moved or shrunk, and nothing is reported. The SIG route that crosses the pour here clears a band of sites.
The bottom-layer GND plane is not tagged. The through vias join it to the top pour, which is what stitching is for.
To check a build, expected_stitch_sites() derives the sites a rule
must fill from the captured pours, and every one of them should hold a
generated via.
- STITCH_VIA#
The stitch via: the sample substrate’s through via, pad 0.45 mm, drill 0.3 mm.
- STITCH_PITCH = 1.5#
Centre-to-centre spacing of the stitch grid, mm.
- STITCH_INSET = 0.4#
Via pad edge to computed pour boundary, mm.
- POUR_CENTER = (2.3, 1.1)#
Centre of the stitched pour, deliberately off the 1.5 mm lattice.
- min_stitch_pitch(via, fab)[source]#
Smallest pitch the runtime fills without thinning and the fab can drill.
Pads: one pad diameter, since the runtime thins a pitch below the pad to a checkerboard; same-net pads need no copper spacing, because clearance is not enforced between copper of the same net. Drills: one hole diameter plus
min_hole_to_hole, an edge-to-edge spacing.- Return type:
- Parameters:
fab (FabricationConstraints)
- checked_stitch_grid(via, fab, pitch, inset)[source]#
A square stitch grid, refused when
pitchis belowmin_stitch_pitch.- Return type:
- Parameters:
fab (FabricationConstraints)
pitch (float)
inset (float)
- INSET_SLACK = 0.02#
Extra clearance, in mm, past
insetbefore a stitch site is required.Measured on jitx 4.6 by moving a row of sites toward the pour edge in 0.01 to 0.03 steps: the predicted threshold (pad radius plus inset, plus any pullback) fell inside each keep or drop window. The nearest kept row sat at most 0.018 past the predicted threshold, in two windows: drop at 0.86, keep at 0.88, against 0.862; and drop at 0.55, keep at 0.58, against 0.562. Where inside a window a site starts to hold was not measured, so a site within 0.02 of the threshold is not required.
- expected_stitch_sites(pours, via, grid, fab, *, pads=(), placed_vias=(), leave_out=None)[source]#
The lattice sites a square
stitch_viarule must fill, in board frame.poursis the computed copper of every pour the rule stitches, eachPour.shapeafter capture in board frame; a through via crosses them all, so a site has to fit in each.padsis the pad copper near the pours,placed_viasthe centres of the vias the design places in code, andleave_outa region whose sites are not required, such as the band a fence on the same pour displaces (measured on jitx 4.6: an inward fence 0.6 in removed the stitch ring 1.0 in).A site is required when all of these hold, from what was measured on jitx 4.6:
it sits on a multiple of the pitch from the board origin (0, 0), not from the pour;
the via pad grown by
grid.insetand byINSET_SLACKlies inside every pour’s computed copper, whose outline already includes the pullback from other-net copper; a site that fails is dropped, never moved or shrunk. A site that clears by less than the slack is not required either way;its via pad comes no closer than
min_copper_copper_spaceto a pad. Sites over pads were dropped on every layer; where a site near a pad starts to drop was not measured, so this is a margin for that edge, not a pitch requirement;its centre is at least one via pad plus
min_copper_copper_spacefrom a code-placed via. Sites 0.5 or closer to a code-placed via were dropped with 0.5 via pads, and the threshold between that and the next lattice site was not measured, so the same margin applies. The margin assumes each code-placed via has the stitch via’s pad; for a larger code-placed via, pass its pad amongpadsinstead;its centre is outside
leave_out.
A generated via that is not in the returned set is not a failure: the runtime may fill a site this derivation leaves out. Raises
ValueErrorfor a grid that is not aSquareViaStitchGrid(only the square lattice was measured), for no pours or an empty one, which would leave nothing to check, and for a pitch belowmin_stitch_pitch(), where the runtime thins the grid instead of filling it.
- class StitchedPour[source]#
Bases:
CircuitA 12 mm by 9 mm GND pour on the top layer, stitched by rule, with a GND plane on the bottom layer and a SIG route crossing the pour.
- class layout_stitched_pour_design(*args, **kwargs)[source]#
Bases:
SampleDesignThe stitched pour on the sample board and substrate.