Skip to content

D149 โ€” Differential pairs named as KiCad's MatchDpSuffix names them

Context

The engine paired nets by their last character only (P/N, +/โˆ’). For inDiffPair() it matched the whole name minus that character, or the whole name. KiCad 10.0.6 (DRC_ENGINE::MatchDpSuffix, inDiffPairFunc) does it differently: - It skips trailing digits and underscores before the polarity character, so DQS_P0 pairs with DQS_N0. - It matches inDiffPair against the base before that character, or against the base without a trailing underscore.

Doc 05 ยง59 listed this as not done. vme-wren's DDR4 strobes are such pairs, and KiCad reports coupling-gap errors on them that the engine could not see.

Decision

  • drc::match_dp_suffix ports MatchDpSuffix exactly, including counting the polarity character in the suffix. The rule engine pairs every net through it, keeping the partner, the polarity and the base.
  • inDiffPair('x') matches the base, or the base without a trailing underscore, by wildcard as KiCad does.
  • Pair routing, the gap relaxation between pair halves, the DRC's coupling check and the router's coupling test all take polarity and partner from the rule engine. They no longer read the last character themselves.

Alternatives

  • Keep the last-character rule and add a digits special case. Its rules would still differ from KiCad's, and the inDiffPair base would still be wrong for names like D_P. In KiCad that base is D_, so inDiffPair('D') matches it through the underscore rule.

Consequences

  • Rule parity has two new cases, diff_pair_suffix and diff_pair_suffix_base, judged by KiCad 10.0.6. All 231 match. The build before this change fails diff_pair_suffix.
  • Among 4,143 fixture boards, two pair differently:
  • vme-wren (DQS_P0..3/DQS_N0..3);
  • a freerouting fixture (/N1//P1 and others).

Neither board is in a bench set or a test, so the bench tiers are unchanged. - A net whose name happens to fit the rule and whose complement exists is now a pair, as it is in KiCad. - On vme-wren, our DRC now finds the DQS0 pair's coupling-gap errors at 1.5173 mm, as KiCad does. It still misses the pair at 1.8573 mm and reports DQS1โ€“3 uncoupled lengths that KiCad does not. Both look like the visibility test, which sees via rings that KiCad has removed on unconnected layers (remove_unused_layers, not modelled). The CK and WR_CLK uncoupled differences were there before.