2020-10-06 18:09:24 +00:00
|
|
|
### Top-level Clauses
|
2020-10-04 11:25:59 +00:00
|
|
|
|
|
|
|
(version <number>)
|
|
|
|
|
|
|
|
(rule <rule_name> <rule_clause> ...)
|
|
|
|
|
|
|
|
|
2021-08-08 13:37:14 +00:00
|
|
|
<br>
|
2021-03-20 20:09:57 +00:00
|
|
|
|
2020-10-06 18:09:24 +00:00
|
|
|
### Rule Clauses
|
2020-10-04 11:25:59 +00:00
|
|
|
|
|
|
|
(constraint <constraint_type> ...)
|
|
|
|
|
|
|
|
(condition "<expression>")
|
|
|
|
|
|
|
|
(layer "<layer_name>")
|
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
(severity <severity_name>)
|
|
|
|
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2021-08-08 13:37:14 +00:00
|
|
|
<br>
|
2021-03-20 20:09:57 +00:00
|
|
|
|
2020-10-06 18:09:24 +00:00
|
|
|
### Constraint Types
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2021-08-13 15:18:56 +00:00
|
|
|
* annular\_width
|
2022-11-04 20:02:16 +00:00
|
|
|
* assertion
|
2020-10-04 11:25:59 +00:00
|
|
|
* clearance
|
2022-07-31 15:02:04 +00:00
|
|
|
* connection\_width
|
2020-10-11 10:51:23 +00:00
|
|
|
* courtyard_clearance
|
2020-10-20 19:44:20 +00:00
|
|
|
* diff\_pair\_gap
|
|
|
|
* diff\_pair\_uncoupled
|
2020-10-04 11:25:59 +00:00
|
|
|
* disallow
|
2021-08-13 15:18:56 +00:00
|
|
|
* edge\_clearance
|
2020-10-11 10:51:23 +00:00
|
|
|
* length
|
2021-08-13 15:18:56 +00:00
|
|
|
* hole\_clearance
|
|
|
|
* hole\_size
|
2021-08-09 10:10:09 +00:00
|
|
|
* min\_resolved\_spokes
|
2022-05-06 13:46:24 +00:00
|
|
|
* physical\_clearance
|
|
|
|
* physical\_hole\_clearance
|
2021-08-13 15:18:56 +00:00
|
|
|
* silk\_clearance
|
2020-10-11 10:51:23 +00:00
|
|
|
* skew
|
2021-07-11 15:12:28 +00:00
|
|
|
* text\_height
|
|
|
|
* text\_thickness
|
2021-08-08 13:37:14 +00:00
|
|
|
* thermal\_relief\_gap
|
|
|
|
* thermal\_spoke\_width
|
2021-08-13 15:18:56 +00:00
|
|
|
* track\_width
|
|
|
|
* via\_count
|
2021-08-26 23:43:11 +00:00
|
|
|
* via\_diameter
|
2021-08-08 13:37:14 +00:00
|
|
|
* zone\_connection
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2022-05-06 13:46:24 +00:00
|
|
|
Note: `clearance` and `hole_clearance` rules are not run against items of the same net; `physical_clearance` and `physical_hole_clearance` rules are.
|
2022-09-16 13:13:34 +00:00
|
|
|
<br><br>
|
|
|
|
|
|
|
|
### Items
|
|
|
|
|
|
|
|
* `A` _the first (or only) item under test_
|
|
|
|
* `B` _the second item under test (for binary tests)_
|
|
|
|
* `L` _the layer currently under test_
|
|
|
|
|
2021-08-08 13:37:14 +00:00
|
|
|
<br>
|
2021-03-20 20:09:57 +00:00
|
|
|
|
2020-10-06 18:09:24 +00:00
|
|
|
### Item Types
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2021-08-08 13:37:14 +00:00
|
|
|
* buried\_via
|
2020-10-04 11:25:59 +00:00
|
|
|
* graphic
|
|
|
|
* hole
|
2021-08-08 13:37:14 +00:00
|
|
|
* micro\_via
|
2020-10-04 11:25:59 +00:00
|
|
|
* pad
|
|
|
|
* text
|
|
|
|
* track
|
|
|
|
* via
|
|
|
|
* zone
|
|
|
|
|
2021-03-20 20:09:57 +00:00
|
|
|
<br>
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2021-08-08 13:37:14 +00:00
|
|
|
### Zone Connections
|
|
|
|
|
|
|
|
* solid
|
|
|
|
* thermal\_reliefs
|
|
|
|
* none
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
### Severity Names
|
|
|
|
|
|
|
|
* warning
|
|
|
|
* error
|
|
|
|
* exclusion
|
|
|
|
* ignore
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
2020-10-06 18:09:24 +00:00
|
|
|
### Examples
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2021-04-15 08:51:56 +00:00
|
|
|
(version 1)
|
|
|
|
|
2020-10-04 11:25:59 +00:00
|
|
|
(rule HV
|
|
|
|
(constraint clearance (min 1.5mm))
|
|
|
|
(condition "A.NetClass == 'HV'"))
|
|
|
|
|
|
|
|
|
|
|
|
(rule HV
|
|
|
|
(layer outer)
|
|
|
|
(constraint clearance (min 1.5mm))
|
|
|
|
(condition "A.NetClass == 'HV'"))
|
|
|
|
|
|
|
|
|
|
|
|
(rule HV_HV
|
|
|
|
# wider clearance between HV tracks
|
|
|
|
(constraint clearance (min "1.5mm + 2.0mm"))
|
|
|
|
(condition "A.NetClass == 'HV' && B.NetClass == 'HV'"))
|
|
|
|
|
|
|
|
|
|
|
|
(rule HV_unshielded
|
|
|
|
(constraint clearance (min 2mm))
|
2022-08-28 16:41:39 +00:00
|
|
|
(condition "A.NetClass == 'HV' && !A.enclosedByArea('Shield*')"))
|
2021-08-08 13:37:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
(rule heavy_thermals
|
|
|
|
(constraint thermal_spoke_width (min 0.5mm))
|
2021-12-23 22:35:24 +00:00
|
|
|
(condition "A.NetClass == 'HV'"))
|
2021-03-20 20:09:57 +00:00
|
|
|
<br><br>
|
2020-10-13 09:17:33 +00:00
|
|
|
|
2020-10-06 18:09:24 +00:00
|
|
|
### Notes
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2021-04-15 08:51:56 +00:00
|
|
|
Version clause must be the first clause. It indicates the syntax version of the file so that
|
|
|
|
future rules parsers can perform automatic updates. It should be
|
|
|
|
set to "1".
|
2020-10-04 11:25:59 +00:00
|
|
|
|
|
|
|
Rules should be ordered by specificity. Later rules take
|
|
|
|
precedence over earlier rules; once a matching rule is found
|
|
|
|
no further rules will be checked.
|
|
|
|
|
|
|
|
Use Ctrl+/ to comment or uncomment line(s).
|
2021-03-20 20:09:57 +00:00
|
|
|
<br><br><br>
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2020-10-06 18:09:24 +00:00
|
|
|
### Expression functions
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2020-10-06 18:09:24 +00:00
|
|
|
All function parameters support simple wildcards (`*` and `?`).
|
2021-03-20 20:09:57 +00:00
|
|
|
<br><br>
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2022-08-28 16:41:39 +00:00
|
|
|
A.intersectsCourtyard('<footprint_refdes>')
|
2021-03-20 20:09:57 +00:00
|
|
|
True if any part of `A` lies within the given footprint's principal courtyard.
|
|
|
|
<br><br>
|
|
|
|
|
2022-08-28 16:41:39 +00:00
|
|
|
A.intersectsFrontCourtyard('<footprint_refdes>')
|
2021-03-20 20:09:57 +00:00
|
|
|
True if any part of `A` lies within the given footprint's front courtyard.
|
|
|
|
<br><br>
|
|
|
|
|
2022-08-28 16:41:39 +00:00
|
|
|
A.intersectsBackCourtyard('<footprint_refdes>')
|
2021-03-20 20:09:57 +00:00
|
|
|
True if any part of `A` lies within the given footprint's back courtyard.
|
|
|
|
<br><br>
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2022-08-28 16:41:39 +00:00
|
|
|
A.intersectsArea('<zone_name>')
|
2021-02-27 19:20:48 +00:00
|
|
|
True if any part of `A` lies within the given zone's outline.
|
2022-08-25 12:20:36 +00:00
|
|
|
<br><br>
|
|
|
|
|
2022-08-28 16:41:39 +00:00
|
|
|
A.enclosedByArea('<zone_name>')
|
2022-08-25 12:20:36 +00:00
|
|
|
True if all of `A` lies within the given zone's outline.
|
|
|
|
|
2022-08-28 16:41:39 +00:00
|
|
|
NB: this is potentially a more expensive call than `intersectsArea()`. Use `intersectsArea()`
|
|
|
|
where possible.
|
2021-03-20 20:09:57 +00:00
|
|
|
<br><br>
|
2020-10-04 11:25:59 +00:00
|
|
|
|
|
|
|
A.isPlated()
|
2021-02-27 19:20:48 +00:00
|
|
|
True if `A` has a hole which is plated.
|
2021-03-20 20:09:57 +00:00
|
|
|
<br><br>
|
2021-02-28 00:54:55 +00:00
|
|
|
|
|
|
|
A.inDiffPair('<net_name>')
|
2022-08-28 16:41:39 +00:00
|
|
|
True if `A` has a net that is part of the specified differential pair.
|
2022-02-13 18:47:18 +00:00
|
|
|
`<net_name>` is the base name of the differential pair. For example, `inDiffPair('/CLK')`
|
|
|
|
matches items in the `/CLK_P` and `/CLK_N` nets.
|
2021-03-20 23:03:34 +00:00
|
|
|
<br><br>
|
|
|
|
|
2021-03-25 00:34:57 +00:00
|
|
|
AB.isCoupledDiffPair()
|
2021-03-20 23:03:34 +00:00
|
|
|
True if `A` and `B` are members of the same diff pair.
|
|
|
|
<br><br>
|
2021-02-28 00:54:55 +00:00
|
|
|
|
2020-10-04 11:25:59 +00:00
|
|
|
A.memberOf('<group_name>')
|
2021-02-27 19:20:48 +00:00
|
|
|
True if `A` is a member of the given group. Includes nested membership.
|
2021-03-20 20:09:57 +00:00
|
|
|
<br><br>
|
2020-10-04 11:25:59 +00:00
|
|
|
|
2021-02-27 19:20:48 +00:00
|
|
|
A.existsOnLayer('<layer_name>')
|
2020-10-06 18:09:24 +00:00
|
|
|
True if `A` exists on the given layer. The layer name can be
|
2020-10-04 11:25:59 +00:00
|
|
|
either the name assigned in Board Setup > Board Editor Layers or
|
2020-10-06 18:09:24 +00:00
|
|
|
the canonical name (ie: `F.Cu`).
|
2020-10-04 11:25:59 +00:00
|
|
|
|
|
|
|
NB: this returns true if `A` is on the given layer, independently
|
|
|
|
of whether or not the rule is being evaluated for that layer.
|
|
|
|
For the latter use a `(layer "layer_name")` clause in the rule.
|
2022-08-28 16:41:39 +00:00
|
|
|
<br><br>
|
|
|
|
|
|
|
|
!!! A.insideCourtyard('<footprint_refdes>') !!!
|
|
|
|
Deprecated; use `intersectsCourtyard()` instead.
|
|
|
|
<br><br>
|
|
|
|
|
|
|
|
!!! A.insideFrontCourtyard('<footprint_refdes>') !!!
|
|
|
|
Deprecated; use `intersectsFrontCourtyard()` instead.
|
|
|
|
<br><br>
|
|
|
|
|
|
|
|
!!! A.insideBackCourtyard('<footprint_refdes>') !!!
|
|
|
|
Deprecated; use `intersectsBackCourtyard()` instead.
|
|
|
|
<br><br>
|
|
|
|
|
|
|
|
!!! A.insideArea('<zone_name>') !!!
|
|
|
|
Deprecated; use `intersectsArea()` instead.
|
2021-03-20 20:09:57 +00:00
|
|
|
<br><br><br>
|
2021-02-27 19:20:48 +00:00
|
|
|
|
|
|
|
### More Examples
|
|
|
|
|
|
|
|
(rule "copper keepout"
|
|
|
|
(constraint disallow track via zone)
|
2022-08-28 16:41:39 +00:00
|
|
|
(condition "A.intersectsArea('zone3')"))
|
2021-02-27 19:20:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
(rule "BGA neckdown"
|
|
|
|
(constraint track_width (min 0.2mm) (opt 0.25mm))
|
|
|
|
(constraint clearance (min 0.05mm) (opt 0.08mm))
|
2022-08-28 16:41:39 +00:00
|
|
|
(condition "A.intersectsCourtyard('U3')"))
|
2021-02-27 19:20:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
# prevent silk over tented vias
|
|
|
|
(rule silk_over_via
|
|
|
|
(constraint silk_clearance (min 0.2mm))
|
|
|
|
(condition "A.Type == '*Text' && B.Type == 'Via'"))
|
|
|
|
|
|
|
|
|
2022-02-13 18:47:18 +00:00
|
|
|
(rule "Distance between Vias of Different Nets"
|
2021-02-27 19:20:48 +00:00
|
|
|
(constraint hole_to_hole (min 0.254mm))
|
2021-09-22 21:20:18 +00:00
|
|
|
(condition "A.Type == 'Via' && B.Type == 'Via' && A.Net != B.Net"))
|
2021-02-27 19:20:48 +00:00
|
|
|
|
2022-02-13 18:47:18 +00:00
|
|
|
(rule "Clearance between Pads of Different Nets"
|
2021-02-27 19:20:48 +00:00
|
|
|
(constraint clearance (min 3.0mm))
|
2021-09-22 21:20:18 +00:00
|
|
|
(condition "A.Type == 'Pad' && B.Type == 'Pad' && A.Net != B.Net"))
|
2021-02-27 19:20:48 +00:00
|
|
|
|
|
|
|
|
2022-02-13 18:47:18 +00:00
|
|
|
(rule "Via Hole to Track Clearance"
|
2021-02-27 19:20:48 +00:00
|
|
|
(constraint hole_clearance (min 0.254mm))
|
2021-09-22 21:20:18 +00:00
|
|
|
(condition "A.Type == 'Via' && B.Type == 'Track'"))
|
2022-02-13 18:47:18 +00:00
|
|
|
|
|
|
|
(rule "Pad to Track Clearance"
|
2021-02-27 19:20:48 +00:00
|
|
|
(constraint clearance (min 0.2mm))
|
2021-09-22 21:20:18 +00:00
|
|
|
(condition "A.Type == 'Pad' && B.Type == 'Track'"))
|
2021-02-27 19:20:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
(rule "clearance-to-1mm-cutout"
|
|
|
|
(constraint clearance (min 0.8mm))
|
2021-09-22 21:20:18 +00:00
|
|
|
(condition "A.Layer == 'Edge.Cuts' && A.Thickness == 1.0mm"))
|
2021-02-27 19:20:48 +00:00
|
|
|
|
|
|
|
|
2022-02-13 18:47:18 +00:00
|
|
|
(rule "Max Drill Hole Size Mechanical"
|
2021-08-13 15:18:56 +00:00
|
|
|
(constraint hole_size (max 6.3mm))
|
2021-02-27 19:20:48 +00:00
|
|
|
(condition "A.Pad_Type == 'NPTH, mechanical'"))
|
2022-02-13 18:47:18 +00:00
|
|
|
|
|
|
|
(rule "Max Drill Hole Size PTH"
|
2021-08-13 15:18:56 +00:00
|
|
|
(constraint hole_size (max 6.35mm))
|
2021-02-27 19:20:48 +00:00
|
|
|
(condition "A.Pad_Type == 'Through-hole'"))
|
2021-02-27 19:44:06 +00:00
|
|
|
|
|
|
|
|
2021-03-25 00:34:57 +00:00
|
|
|
# Specify an optimal gap for a particular diff-pair
|
|
|
|
(rule "dp clock gap"
|
|
|
|
(constraint diff_pair_gap (opt "0.8mm"))
|
2022-02-13 18:47:18 +00:00
|
|
|
(condition "A.inDiffPair('/CLK')"))
|
2021-02-27 19:44:06 +00:00
|
|
|
|
|
|
|
# Specify a larger clearance around any diff-pair
|
|
|
|
(rule "dp clearance"
|
|
|
|
(constraint clearance (min "1.5mm"))
|
2021-03-25 00:34:57 +00:00
|
|
|
(condition "A.inDiffPair('*') && !AB.isCoupledDiffPair()"))
|
2021-08-08 13:37:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Don't use thermal reliefs on heatsink pads
|
|
|
|
(rule heat_sink_pad
|
|
|
|
(constraint zone_connection solid)
|
2021-08-09 10:10:09 +00:00
|
|
|
(condition "A.Fabrication_Property == 'Heatsink pad'"))
|
|
|
|
|
|
|
|
# Require all four thermal relief spokes to connect to parent zone
|
|
|
|
(rule fully_spoked_pads
|
2021-08-13 19:10:30 +00:00
|
|
|
(constraint min_resolved_spokes 4))
|
|
|
|
|
2022-01-09 11:09:18 +00:00
|
|
|
# Set thermal relief gap & spoke width for all zones
|
|
|
|
(rule defined_relief
|
|
|
|
(constraint thermal_relief_gap (min 10mil))
|
|
|
|
(constraint thermal_spoke_width (min 12mil)))
|
|
|
|
|
|
|
|
# Override thermal relief gap & spoke width for GND and PWR zones
|
|
|
|
(rule defined_relief_pwr
|
|
|
|
(constraint thermal_relief_gap (min 10mil))
|
|
|
|
(constraint thermal_spoke_width (min 12mil))
|
|
|
|
(condition "A.Name == 'zone_GND' || A.Name == 'zone_PWR'"))
|
2022-02-13 18:47:18 +00:00
|
|
|
|
2022-01-09 11:09:18 +00:00
|
|
|
|
2021-08-13 19:10:30 +00:00
|
|
|
# Prevent solder wicking from SMD pads
|
|
|
|
(rule holes_in_pads
|
2022-05-06 13:46:24 +00:00
|
|
|
(constraint physical_hole_clearance (min 0.2mm))
|
2021-09-22 21:20:18 +00:00
|
|
|
(condition "B.Pad_Type == 'SMD'"))
|
|
|
|
|
|
|
|
# Disallow solder mask margin overrides
|
|
|
|
(rule "disallow solder mask margin overrides"
|
|
|
|
(constraint assertion "A.Soldermask_Margin_Override == 0mm")
|
2022-02-13 18:47:18 +00:00
|
|
|
(condition "A.Type == 'Pad'"))
|
2022-05-10 22:01:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Enforce a mechanical clearance between components and board edge
|
|
|
|
(rule front_mechanical_board_edge_clearance
|
|
|
|
(layer "F.Courtyard")
|
|
|
|
(constraint physical_clearance (min 3mm))
|
|
|
|
(condition "B.Layer == 'Edge.Cuts'"))
|
2022-07-31 15:02:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Check current-carrying capacity
|
|
|
|
(rule high-current
|
|
|
|
(constraint track_width (min 1.0mm))
|
|
|
|
(constraint connection_width (min 0.8mm))
|
2023-02-10 23:33:03 +00:00
|
|
|
(condition "A.NetClass == 'Power'"))
|