layout_qfn_escape module#

Step a power trace down to fit a QFN pad, with the width read from the pad.

Use this pattern when a power trace is wider than the pads it reaches. A 0.8 mm trace centred on a 0.17 mm QFN pad at 0.5 mm pitch reaches 0.4 mm to each side, and the next pads start 0.415 mm from that centre: a 0.015 mm gap, under the 0.127 mm fab floor of the sample substrate. So the last stretch into the pad is a separate escape segment at a narrower width.

Three pieces compose, on the priority ladder of the layout-constraints skill (net-tag rules at 2, escape segments at 4):

  1. A rule on the net’s tag: design_constraint(PowerTag(), priority=2).trace_width(0.8).

  2. A transition. The net is routed as two code routes that meet at a RoutePoint 1.0 mm outside the pad: the trunk from the source to the transition and the escape from the transition into the pad.

  3. A rule on a tag assigned to the escape Route object, at a higher priority: design_constraint(QfnEscapeTag(), priority=4) .trace_width(escape_width). Both rules match the escape segment and the higher priority wins there; the trunk keeps the PowerTag width.

The escape width is derived, not typed. derive_escape() reads the placed QFN’s pad geometry and the substrate’s fab constraints, and takes the escape clearance s_e the caller chose: the clearance that governs the net, or a lower one at or above min_copper_copper_space. It finds:

  • the pad width across the escape direction, and the pad gap: the smallest distance from the pad’s copper to any other pad’s copper. It raises if that gap is below min_copper_copper_space;

  • c, the smallest distance from the escape’s centreline (pad centre to transition) to any other pad. The escape leaves along the pad’s long axis, so c is half the pad width plus the gap to the adjacent pad;

  • the escape width, from escape_width(): below the pad width by ESCAPE_PAD_INSET (0.02 mm), at most 2·(c - s_e), rounded down to WIDTH_GRID (0.01 mm), and at or above min_copper_width. Wherever the pad gap is at or above s_e, the pad bound decides: a trace narrower than the pad and running straight out of it is never closer to a neighbouring pad than the pads are to each other.

For this placeholder QFN on jitx.sample.SampleSubstrate, the generator’s pads come out 0.17 mm wide (0.25 mm leads, density level C), the gap between pads is 0.33 mm, c is 0.415 mm, and with s_e at the 0.127 mm fab floor (the design writes no clearance rule) the pad bound gives a 0.15 mm escape.

Measured on jitx 4.6, building layout_qfn_escape_design: the escape realized 0.15 mm wide and the trunk 0.8 mm, the escape’s copper came no closer than 0.34 mm to any of the other 15 QFN pads (0.33 mm between the pads, plus half the 0.02 mm the escape is narrower than its pad), and the design’s issues listed routing as satisfied.

A Route.Config(trace_width=...) on the escape would also set its width. Measured on jitx 4.6, a Route.Config won over a width rule and a clearance rule, both at the default priority. That puts a number on one route, out of reach of those rules; prefer the tag.

The test, tests/test_layout_qfn_escape.py, checks the derivation and the rules offline. With JITX_PATTERN_RUNTIME=1 and a runtime started at the project root, it builds the design and measures each segment’s width and the escape’s distance to the neighbouring pads.

POWER_WIDTH = 0.8#

The power nets’ trace width (the PowerTag width), in mm.

ESCAPE_PAD_INSET = Decimal('0.02')#

How much narrower than the pad the escape is, before rounding, in mm.

WIDTH_GRID = Decimal('0.01')#

The grid the escape width is rounded down to, in mm.

ESCAPE_RUN = 1.0#

From the pad’s outer edge to the transition, in mm.

class PowerTag[source]#

Bases: Tag

Power nets: routed at POWER_WIDTH.

class QfnEscapeTag[source]#

Bases: Tag

Escape segments into a QFN pad.

class PlaceholderQfn16[source]#

Bases: Component

A placeholder 16-lead, 0.5 mm pitch QFN. Not an orderable part.

Pad 1 is VDD; the rest are unused.

manufacturer: str | None = 'Fictional'#

Manufacturer for this component.

mpn: str | None = 'EXAMPLE-QFN16'#

Manufacturer part number for this component.

reference_designator_prefix: str | None = 'U'#

Reference designator prefix for this component. This will be used to generate a unique reference designator for each component of the same type.

Note

This field is a required data point for matching components between builds. If this value changes (including changing from unset to set), it will be treated as a new component, even if nothing else changes.

VDD = Port()#
NC = [Port(), Port(), Port(), Port(), Port(), Port(), Port(), Port(), Port(), Port(), Port(), Port(), Port(), Port(), Port()]#
landpattern = QFN(num_leads=16).lead_profile(LeadProfile(span=Toleranced(3, 0, 0), pitch=0.5, type=QFNLead(length=Toleranced(0.4, 0, 0), width=Toleranced(0.25, 0, 0), lead_type=LeadProtrusion(name='QuadFlatNoLeads', fillets={<DensityLevel.A: 'A'>: LeadFillets(toe=0.4, heel=0.0, side=-0.04, courtyard_excess=0.5), <DensityLevel.B: 'B'>: LeadFillets(toe=0.3, heel=0.0, side=-0.04, courtyard_excess=0.25), <DensityLevel.C: 'C'>: LeadFillets(toe=0.2, heel=0.0, side=-0.04, courtyard_excess=0.1)})))).package_body(RectanglePackage(height=Toleranced(0.9, 0, 0), width=Toleranced(3, 0, 0), length=Toleranced(3, 0, 0))).density_level(<DensityLevel.C: 'C'>)#
symbol = BoxSymbol()#
class SourcePad(*args, **kwargs)[source]#

Bases: Pad

shape: Shape | PadShape = Polygon(elements=((0.5, 0.5), (-0.5, 0.5), (-0.5, -0.5), (0.5, -0.5)), holes=())#

The geometric shape of the pad or a PadShape to specify the regular shape and the shape when non-functional pads are removed. Can be overridden on a per-layer basis by shapes. When using a PadShape with nfp, the nfp removal does not apply to surface layers, to have surface nfp removal, use the shapes mapping to declare top and bottom explicitly.

soldermask = Soldermask(shape=Polygon(elements=((0.55, 0.55), (-0.55, 0.55), (-0.55, -0.55), (0.55, -0.55)), holes=()), side=<Side.Top: 0>)#
class SourceLandpattern(*args, **kwargs)[source]#

Bases: Landpattern

pad = SourcePad().at(0, 0)#
class PowerSource[source]#

Bases: Component

A fictional one-pin power source. Not a real product.

manufacturer: str | None = 'Fictional'#

Manufacturer for this component.

mpn: str | None = 'EXAMPLE-PWR-PAD'#

Manufacturer part number for this component.

reference_designator_prefix: str | None = 'J'#

Reference designator prefix for this component. This will be used to generate a unique reference designator for each component of the same type.

Note

This field is a required data point for matching components between builds. If this value changes (including changing from unset to set), it will be treated as a new component, even if nothing else changes.

out = Port()#
landpattern = SourceLandpattern()#
symbol = BoxSymbol()#
pad_geometry(pad)[source]#

The pad’s copper in its landpattern’s frame.

Return type:

BaseGeometry

Parameters:

pad (Pad)

class Escape(pad_width, pad_gap, centreline_clearance, escape_clearance, width, pad_center, outward, transition)[source]#

Bases: object

The derived escape for one QFN pad, in the landpattern’s frame.

Parameters:
pad_width: float#
pad_gap: float#
centreline_clearance: float#

the smallest distance from the escape’s centreline to another pad.

Type:

c

escape_clearance: float#

the clearance the escape keeps to the other pads.

Type:

s_e

width: float#
pad_center: tuple[float, float]#
outward: tuple[float, float]#
transition: tuple[float, float]#
strictly_inside_width(pad_width, floor)[source]#

pad_width less the inset, rounded down to the grid; checked against the pad and the fab floor.

Return type:

float

Parameters:
escape_width(pad_width, centreline_clearance, escape_clearance, fab, *, grid=Decimal('0.01'))[source]#

The width of an escape segment that leaves a pad past other pads.

pad_width is the narrowest pad the escape rule selects, measured across the escape; centreline_clearance is c, the smallest distance from the escape’s centreline (pad centre to transition) to any other pad; escape_clearance is s_e, the clearance the escape keeps, either the clearance that governs the net or a lower one at or above the fab’s min_copper_copper_space. The width is:

  • strictly below pad_width, by ESCAPE_PAD_INSET before rounding;

  • at most 2 * (c - s_e), so the escape’s edge keeps s_e from every other pad;

  • rounded down to grid, and at or above min_copper_width.

Raises ValueError when escape_clearance is below min_copper_copper_space or the width that results is below min_copper_width. On a BGA at 1.0 pitch with 0.5 balls, the channel between the balls is 0.5 and c 0.25, so the escape is 0.3 at s_e 0.1 and 0.26 at s_e 0.12.

Return type:

float

Parameters:
derive_escape(landpattern, target, fab, *, escape_clearance)[source]#

Read the pads of landpattern and derive the escape for target.

The escape leaves along the pad’s long axis, away from the body centre, to a transition ESCAPE_RUN past the pad’s outer edge. Its width is escape_width() of the pad width across that axis, c (the smallest distance from the centreline to another pad) and escape_clearance. Raises ValueError if two pads sit closer than min_copper_copper_space, or as escape_width() does.

Return type:

Escape

Parameters:
class QfnPowerEscape[source]#

Bases: Circuit

A power source feeding the QFN’s VDD pad: a trunk at the PowerTag width and a derived escape.

class layout_qfn_escape_design(*args, **kwargs)[source]#

Bases: SampleDesign

The QFN power escape on the sample board.

circuit: Circuit = QfnPowerEscape()#