Loading...
Searching...
No Matches
Go to the documentation of this file.
2_HKI(
"### Top-level Clauses\n"
6" (rule <rule_name> <rule_clause> ...)\n"
12" (constraint <constraint_type> ...)\n"
14" (condition \"<expression>\")\n"
16" (layer \"<layer_name>\")\n"
18" (severity <severity_name>)\n"
25"| Constraint type | Argument type | Description |\n"
26"|---------------------------|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n"
27"| `annular_width` | min/opt/max | Checks the width of annular rings on vias.<br> |\n"
28"| `assertion` | \"<expression>\" | Checks the given expression.<br> |\n"
29"| `clearance` | min | Specifies the **electrical** clearance between copper objects of different nets. (See `physical_clearance` if you wish to specify clearance between objects regardless of net.)<br><br>To allow copper objects to overlap (collide), create a `clearance` constraint with the `min` value less than zero (for example, `-1`).<br> |\n"
30"| `courtyard_clearance` | min | Checks the clearance between footprint courtyards and generates an error if any two courtyards are closer than the `min` distance. If a footprint does not have a courtyard shape, no errors will be generated from this constraint.<br> |\n"
31"| `diff_pair_gap` | min/opt/max | Checks the gap between coupled tracks in a differential pair. Coupled tracks are segments that are parallel to each other. Differential pair gap is not tested on uncoupled portions of a differential pair (for example, the fanout from a component).<br> |\n"
32"| `diff_pair_uncoupled` | max | Checks the distance that a differential pair track is routed uncoupled from the other polarity track in the pair (for example, where the pair fans out from a component, or becomes uncoupled to pass around another object such as a via).<br> |\n"
33"| `disallow` | `track`<br>`via`<br>`micro_via`<br>`buried_via`<br>`pad`<br>`zone`<br>`text`<br>`graphic`<br>`hole`<br>`footprint`<br> | Specify one or more object types to disallow, separated by spaces. For example, `(constraint disallow track)` or `(constraint disallow track via pad)`. If an object of this type matches the rule condition, a DRC error will be created.<br><br>This constraint is essentially the same as a keepout rule area, but can be used to create more specific keepout restrictions.<br> |\n"
34"| `edge_clearance` | min/opt/max | Checks the clearance between objects and the board edge.<br><br>This can also be thought of as the \"milling tolerance\" as the board edge will include all graphical items on the `Edge.Cuts` layer as well as any *oval* pad holes. (See `physical_hole_clearance` for the drilling tolerance.)<br> |\n"
35"| `length` | min/max | Checks the total routed length for the nets that match the rule condition and generates an error for each net that is below the `min` value (if specified) or above the `max` value (if specified) of the constraint.<br> |\n"
36"| `hole` | min/max | Checks the size (diameter) of a drilled hole in a pad or via. For oval holes, the smaller (minor) diameter will be tested against the `min` value (if specified) and the larger (major) diameter will be tested against the `max` value (if specified).<br> |\n"
37"| `hole_clearance` | min | Checks the clearance between a drilled hole in a pad or via and copper objects on a different net. The clearance is measured from the diameter of the hole, not its center.<br> |\n"
38"| `hole_to_hole` | min | Checks the clearance between mechanically-drilled holes in pads and vias. The clearance is measured between the diameters of the holes, not between their centers.<br><br>This constraint is soley for the protection of drill bits. The clearance between **laser-drilled** (microvias) and other non-mechanically-drilled holes is not checked, nor is the clearance between **milled** (oval-shaped) and other non-mechanically-drilled holes.<br> |\n"
39"| `physical_clearance` | min | Checks the clearance between two objects on a given layer (including non-copper layers).<br><br>While this can perform more general-purpose checks than `clearance`, it is much slower. Use `clearance` where possible.<br> |\n"
40"| `physical_hole_clearance` | min | Checks the clearance between a drilled hole in a pad or via and another object, regardless of net. The clearance is measured from the diameter of the hole, not its center.<br><br>This can also be thought of as the \"drilling tolerance\" as it only includes **round** holes (see `edge_clearance` for the milling tolerance).<br> |\n"
41"| `silk_clearance` | min/opt/max | Checks the clearance between objects on silkscreen layers and other objects.<br> |\n"
42"| `skew` | max | Checks the total skew for the nets that match the rule condition, that is, the difference between the length of each net and the average of all the lengths of each net that is matched by the rule. If the absolute value of the difference between that average and the length of any one net is above the constraint `max` value, an error will be generated.<br> |\n"
43"| `thermal_relief_gap` | min | Specifies the width of the gap between a pad and a zone with a thermal-relief connection.<br> |\n"
44"| `thermal_spoke_width` | opt | Specifies the width of the spokes connecting a pad to a zone with a thermal-relief connection.<br> |\n"
45"| `track_width` | min/opt/max | Checks the width of track and arc segments. An error will be generated for each segment that has a width below the `min` value (if specified) or above the `max` value (if specified).<br> |\n"
46"| `via_count` | max | Counts the number of vias on every net matched by the rule condition. If that number exceeds the constraint `max` value on any matched net, an error will be generated for that net.<br> |\n"
47"| `zone_connection` | `solid`<br>`thermal_reliefs`<br>`none` | Specifies the connection to be made between a zone and a pad.<br> |\n"
52" * `A` _the first (or only) item under test_\n"
53" * `B` _the second item under test (for binary tests)_\n"
54" * `L` _the layer currently under test_\n"
72" (constraint clearance (min 1.5mm))\n"
73" (condition \"A.NetClass == 'HV'\"))\n"
78" (constraint clearance (min 1.5mm))\n"
79" (condition \"A.NetClass == 'HV'\"))\n"
83" # wider clearance between HV tracks\n"
84" (constraint clearance (min \"1.5mm + 2.0mm\"))\n"
85" (condition \"A.NetClass == 'HV' && B.NetClass == 'HV'\"))\n"
88" (rule HV_unshielded\n"
89" (constraint clearance (min 2mm))\n"
90" (condition \"A.NetClass == 'HV' && !A.enclosedByArea('Shield*')\"))\n"
93" (rule heavy_thermals\n"
94" (constraint thermal_spoke_width (min 0.5mm))\n"
95" (condition \"A.NetClass == 'HV'\"))\n"
100"Version clause must be the first clause. It indicates the syntax version of the file so that \n"
101"future rules parsers can perform automatic updates. It should be\n"
104"Rules should be ordered by specificity. Later rules take\n"
105"precedence over earlier rules; once a matching rule is found\n"
106"no further rules will be checked.\n"
108"Use Ctrl+/ to comment or uncomment line(s).\n"
111"### Expression functions\n"
113"All function parameters support simple wildcards (`*` and `?`).\n"
116" A.intersectsCourtyard('<footprint_refdes>')\n"
117"True if any part of `A` lies within the given footprint's principal courtyard.\n"
120" A.intersectsFrontCourtyard('<footprint_refdes>')\n"
121"True if any part of `A` lies within the given footprint's front courtyard.\n"
124" A.intersectsBackCourtyard('<footprint_refdes>')\n"
125"True if any part of `A` lies within the given footprint's back courtyard.\n"
128" A.intersectsArea('<zone_name>')\n"
129"True if any part of `A` lies within the given zone's outline.\n"
132" A.enclosedByArea('<zone_name>')\n"
133"True if all of `A` lies within the given zone's outline.\n"
135"NB: this is potentially a more expensive call than `intersectsArea()`. Use `intersectsArea()`\n"
139" A.getField('<field_name>')\n"
140"The value of the given field. Only footprints have fields, so a field is only returned if\n"
141"`A` is a footprint.\n"
145"True if `A` has a hole which is plated.\n"
148" A.inDiffPair('<net_name>')\n"
149"True if `A` has a net that is part of the specified differential pair.\n"
150"`<net_name>` is the base name of the differential pair. For example, `inDiffPair('/CLK')`\n"
151"matches items in the `/CLK_P` and `/CLK_N` nets.\n"
154" AB.isCoupledDiffPair()\n"
155"True if `A` and `B` are members of the same diff pair.\n"
158" A.memberOfGroup('<group_name>')\n"
159"True if `A` is a member of the given group. The name can contain wildcards.\n"
160"Includes nested membership.\n"
163" A.memberOfFootprint('<footprint_reference>|<footprint_id>')\n"
164"True if `A` is a member of a footprint matching the given reference designator or footprint\n"
165"ID. The parameter can contain wildcards.\n"
167"NB: If matching against a footprint ID is desired, the parameter must contain a ':'.\n"
170" A.memberOfSheet('<sheet_path>')\n"
171"True if `A` is a member of the given schematic sheet. The sheet path can contain wildcards.\n"
174" A.existsOnLayer('<layer_name>')\n"
175"True if `A` exists on the given layer. The layer name can be\n"
176"either the name assigned in Board Setup > Board Editor Layers or\n"
177"the canonical name (ie: `F.Cu`).\n"
179"NB: this returns true if `A` is on the given layer, independently\n"
180"of whether or not the rule is being evaluated for that layer.\n"
181"For the latter use a `(layer \"layer_name\")` clause in the rule.\n"
184" A.hasNetclass('<netclass_name>')\n"
185"True if `A` has had the given netclass assigned to it, either by an explicit netclass label \n"
186"or through a pattern match assignment.\n"
191" (rule \"copper keepout\"\n"
192" (constraint disallow track via zone)\n"
193" (condition \"A.intersectsArea('zone3')\"))\n"
196" (rule \"BGA neckdown\"\n"
197" (constraint track_width (min 0.2mm) (opt 0.25mm))\n"
198" (constraint clearance (min 0.05mm) (opt 0.08mm))\n"
199" (condition \"A.intersectsCourtyard('U3')\"))\n"
202" # prevent silk over tented vias\n"
203" (rule silk_over_via\n"
204" (constraint silk_clearance (min 0.2mm))\n"
205" (condition \"A.Type == '*Text' && B.Type == 'Via'\"))\n"
208" (rule \"Distance between Vias of Different Nets\"\n"
209" (constraint hole_to_hole (min 0.254mm))\n"
210" (condition \"A.Type == 'Via' && B.Type == 'Via' && A.Net != B.Net\"))\n"
212" (rule \"Clearance between Pads of Different Nets\"\n"
213" (constraint clearance (min 3.0mm))\n"
214" (condition \"A.Type == 'Pad' && B.Type == 'Pad' && A.Net != B.Net\"))\n"
217" (rule \"Via Hole to Track Clearance\"\n"
218" (constraint hole_clearance (min 0.254mm))\n"
219" (condition \"A.Type == 'Via' && B.Type == 'Track'\"))\n"
221" (rule \"Pad to Track Clearance\"\n"
222" (constraint clearance (min 0.2mm))\n"
223" (condition \"A.Type == 'Pad' && B.Type == 'Track'\"))\n"
226" (rule \"clearance-to-1mm-cutout\"\n"
227" (constraint edge_clearance (min 0.8mm))\n"
228" (condition \"A.Layer == 'Edge.Cuts' && A.Line_Width == 1.0mm\"))\n"
231" (rule \"Max Drill Hole Size Mechanical\"\n"
232" (constraint hole_size (max 6.3mm))\n"
233" (condition \"A.Pad_Type == 'NPTH, mechanical'\"))\n"
235" (rule \"Max Drill Hole Size PTH\"\n"
236" (constraint hole_size (max 6.35mm))\n"
237" (condition \"A.Pad_Type == 'Through-hole'\"))\n"
240" # Specify an optimal gap for a particular diff-pair\n"
241" (rule \"dp clock gap\"\n"
242" (constraint diff_pair_gap (opt \"0.8mm\"))\n"
243" (condition \"A.inDiffPair('/CLK')\"))\n"
245" # Specify a larger clearance around any diff-pair\n"
246" (rule \"dp clearance\"\n"
247" (constraint clearance (min \"1.5mm\"))\n"
248" (condition \"A.inDiffPair('*') && !AB.isCoupledDiffPair()\"))\n"
251" # Don't use thermal reliefs on heatsink pads\n"
252" (rule heat_sink_pad\n"
253" (constraint zone_connection solid)\n"
254" (condition \"A.Fabrication_Property == 'Heatsink pad'\"))\n"
256" # Require all four thermal relief spokes to connect to parent zone\n"
257" (rule fully_spoked_pads\n"
258" (constraint min_resolved_spokes 4))\n"
260" # Set thermal relief gap & spoke width for all zones\n"
261" (rule defined_relief\n"
262" (constraint thermal_relief_gap (min 10mil))\n"
263" (constraint thermal_spoke_width (min 12mil)))\n"
265" # Override thermal relief gap & spoke width for GND and PWR zones\n"
266" (rule defined_relief_pwr\n"
267" (constraint thermal_relief_gap (min 10mil))\n"
268" (constraint thermal_spoke_width (min 12mil))\n"
269" (condition \"A.Name == 'zone_GND' || A.Name == 'zone_PWR'\"))\n"
271" # Prevent copper fills under the courtyards of capacitors\n"
272" (rule no_copper_under_caps\n"
273" (constraint physical_clearance (min 0mm))\n"
274" (condition \"A.Type == 'Zone' && B.Reference == 'C*'\"))\n"
277" # Prevent solder wicking from SMD pads\n"
278" (rule holes_in_pads\n"
279" (constraint physical_hole_clearance (min 0.2mm))\n"
280" (condition \"B.Pad_Type == 'SMD'\"))\n"
282" # Disallow solder mask margin overrides\n"
283" (rule \"disallow solder mask margin overrides\"\n"
284" (constraint assertion \"A.Soldermask_Margin_Override == 0mm\")\n"
285" (condition \"A.Type == 'Pad'\"))\n"
288" # Enforce a mechanical clearance between components and board edge\n"
289" (rule front_mechanical_board_edge_clearance\n"
290" (layer \"F.Courtyard\")\n"
291" (constraint physical_clearance (min 3mm))\n"
292" (condition \"B.Layer == 'Edge.Cuts'\"))\n"
295" # Check current-carrying capacity\n"
296" (rule high-current\n"
297" (constraint track_width (min 1.0mm))\n"
298" (constraint connection_width (min 0.8mm))\n"
299" (condition \"A.NetClass == 'Power'\"))\n"
302" # Separate drill bit and milling cutter size constraints\n"
303" (rule \"Plated through-hole size\"\n"
304" (constraint hole_size (min 0.2mm) (max 6.35mm))\n"
305" (condition \"A.isPlated() && A.Hole_Size_X == A.Hole_Size_Y\"))\n"
306" (rule \"Plated slot size\"\n"
307" (constraint hole_size (min 0.5mm))\n"
308" (condition \"A.isPlated() && A.Hole_Size_X != A.Hole_Size_Y\"))\n"
311" # Allow blind/buried to micro-via hole-to-hole violations when it is known that\n"
312" # the fab will mechanically drill blind/buried via holes -before- laser drilling \n"
314" (rule hole_to_hole_uvia_exclusion\n"
315" (condition \"A.Via_Type == 'Blind/buried' && B.Via_Type == 'Micro'\")\n"
316" (constraint hole_to_hole)\n"
317" (severity ignore))\n"
321"For the full documentation see [https://docs.kicad.org](https://docs.kicad.org/GetMajorMinorVersion/en/pcbnew/pcbnew.html#custom_design_rules)." );