pcb_calc_length_match
Convert a timing or skew budget into a length-match tolerance and per-net serpentine compensation for PCB buses or differential pairs, using routed lengths to report mismatch and skew.
Instructions
Length-match tolerance and serpentine compensation for a bus / pair.
Turns a timing budget into the length-match window the routing must hold,
and -- given the routed lengths -- the serpentine copper each net needs.
The complement of Altium's pcb_tune_length (which executes the
meander) and pcb_get_trace_lengths (which reads lengths back). Pure
math, no Altium. Rests on the ns/in == ps/mil identity, so skew maps to
length exactly; propagation speed uses the effective dielectric constant
(stripline = Er, the usual inner-layer bus case; microstrip reduced).
The skew budget is taken from skew_budget_ps if > 0, else from
match_fraction * rise_time_ns (the "match to within 10-20 % of the
edge" rule).
Args:
lengths: Optional {net: length_mils} of routed lengths; when
given, returns a per-net match report targeting the longest net.
skew_budget_ps: Allowed skew in ps (e.g. a DDR byte-lane budget).
rise_time_ns: Edge rate, used with match_fraction if no ps budget.
match_fraction: Fraction of the rise time allowed as skew (default 0.1).
dielectric_constant: er (default 4.2 FR-4).
geometry: stripline (default) or microstrip.
width_mils, dielectric_height_mils: Microstrip geometry for the
Hammerstad Er_eff (optional).
Returns:
{"ok": True, "er_eff", "t_pd_ps_per_mil", "skew_budget_ps", "tolerance_mils", "members"?: [{net, length_mils, mismatch_mils, skew_ps, compensation_mils, within_tolerance}], "target_length_mils"?, "worst_skew_ps"?, "all_matched"?, "summary"}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lengths | No | ||
| geometry | No | stripline | |
| width_mils | No | ||
| rise_time_ns | No | ||
| match_fraction | No | ||
| skew_budget_ps | No | ||
| dielectric_constant | No | ||
| dielectric_height_mils | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||