layout_default_rules module#

A board’s default layout rules, and tagged nets whose rules override them.

Rules sit at three levels, and each level has its own home:

  1. Fab floors live on the substrate. SampleSubstrate.constraints holds the fabricator’s minimums (min_copper_width, min_copper_copper_space and the rest). They are limits, not choices: the rules below must not go under them, and check_against_fab refuses a rule that would.

  2. Board defaults live on the Design. layout_default_rules_design sets a 0.2 mm trace width for every trace (IsTrace), a 0.2 mm clearance between any two copper objects (IsCopper, IsCopper) and a thermal relief for every pad (IsPad).

  3. Rules on tags assigned to nets override the defaults at a higher priority. PowerTag is assigned to the power net and GroundTag to the ground net, and a priority-2 rule gives the nets carrying either tag a 0.5 mm trace. Nets tagged PowerTag also get a 0.3 mm clearance to any object.

The default relief is part of the defaults, not an extra. On jitx 4.6 a pad that no thermal_relief rule matches is joined to its pour with no relief at all: the pour meets the pad on every side. IsPad gives every pad a relief, here four 0.25 mm spokes across a 0.25 mm gap. A relief rule at a higher priority than the IsPad rule overrides it where it matches. Keyed on a net tag, it relieves every pad on the net. Keyed on a tag on a pad, a landpattern or a component, it picks out some of a net’s pads; layout_thermal_classes shows such tags, one relief class per pad size. Here GroundTag carries a width rule only, so the GND pads take the IsPad relief.

The circuit has one power route, one signal route and two GND pads inside a GND pour. GND is not routed, so the GroundTag width rule has nothing to act on in this design. Measured on jitx 4.6:

  • the SIG route is 0.2 mm wide and the pour stops 0.21 mm from it, the default clearance plus 0.01 mm;

  • the VCC route is 0.5 mm wide and the pour stops 0.31 mm from it, the PowerTag clearance plus 0.01 mm;

  • each GND pad meets the pour through four spokes 0.25 mm wide across a 0.25 mm gap.

Here the tag rules’ values are also the larger ones, so these numbers alone do not show whether priority or the larger value decided. A separate run with the tag rules’ values set below the defaults (0.15 mm width and clearance) gave a 0.15 mm VCC route with the pour 0.16 mm from it: the higher-priority tag rule applied.

DEFAULT_WIDTH = 0.2#

Trace width for any trace no tag rule covers, mm.

DEFAULT_CLEARANCE = 0.2#

Clearance between any two copper objects, mm.

RELIEF_GAP = 0.25#

Gap between a pad and its pour, mm.

RELIEF_SPOKE = 0.25#

Width of each thermal spoke, mm.

RELIEF_SPOKES = 4#

Spokes per pad.

POWER_WIDTH = 0.5#

Trace width for power and ground nets, mm.

POWER_CLEARANCE = 0.3#

Clearance from power copper to any other object, mm.

class PowerTag[source]#

Bases: Tag

Power nets.

class GroundTag[source]#

Bases: Tag

Ground nets.

check_against_fab(rules, fab)[source]#

Return rules unchanged, or raise if one goes under a fab floor.

Widths are checked against min_copper_width; clearances and relief gaps and spokes against min_copper_copper_space and min_copper_width.

Return type:

list[DesignConstraint]

Parameters:
class TwoPad[source]#

Bases: Component

A fictional part: two 1 mm square pads 3 mm apart.

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.

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

Manufacturer part number for this component.

manufacturer: str | None = 'Example'#

Manufacturer for this component.

class DefaultRulesCircuit[source]#

Bases: Circuit

A VCC route and a SIG route through a GND pour, and two GND pads in it.

class layout_default_rules_design[source]#

Bases: SampleDesign

The circuit on the sample board, with the board defaults and the power and ground tag rules on the design.

circuit: Circuit = DefaultRulesCircuit()#