kicad-skew
Checks length matching on a KiCad board using the lengths KiCad itself reports, against JSON rules, and flags pairs whose legs run on different layers.
The skew rules built into KiCad check the spread inside a single group. A memory layout, however, also requires every data line to be checked against its strobe, command and address against the clock, and the strobes against the clock. kicad-skew is designed to check these relations from a short JSON rules file.
Length is taken from KiCad rather than modelled by the tool. In a scratch copy of the board, each selected net is given an impossible maximum length, kicad-cli pcb drc is run, and the real length is read from the resulting violation. This is the same number that is shown by the length tuner of KiCad, including the via barrel between the layers that are actually used and any pad-to-die lengths that are set on the pads.
Length alone is insufficient to show every problem, since the two legs of a pair are able to match in millimetres while they run on different layers. In that case, one leg is a microstrip and the other is a stripline, which means that the pair is uncoupled and out of step in picoseconds. Such pairs are reported by --layers.
Install
pip install git+https://github.com/firedanceio/kicad-skew
kicad-skew board.kicad_pcb rules.json
kicad-cli from KiCad 8 or newer is required, and it is found through --kicad-cli, KICAD_CLI, the PATH or the usual install folders. The pcbnew module of KiCad is also required for the --layers check, so that check has to be run with the Python that is shipped with KiCad. On macOS:
"/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/python3" -m kicad_skew board.kicad_pcb rules.json --layers
When pcbnew is missing, the tool states that the layer check was skipped and gives the reason, rather than reporting zero split pairs. With --map out.png, the measured nets are drawn on the board in the colour of their worst relation, for which Pillow is required.
Rules
Lengths are given in mm, or in mil when "unit": "mil" is set in the file. Net selectors are regular expressions, and they are matched against the full net name.
| Type | Checks |
|---|---|
pairs | Each net matching match is checked against its partner, as N minus P. |
group | Each member is checked against the mean of the reference nets, for example DQ against its strobe pair. |
spread | The maximum minus the minimum is taken over the members. |
between | The mean of one set minus the mean of another is checked, for example strobe against clock. |
A net that is selected but has not been routed is counted as a failure and never as a pass. The exit status is 0 when everything is within tolerance, 1 for a failure or a split pair, and 2 for an error.
Example: a 72-bit DDR4 channel
The open-source DDR4 RDIMM tester by Antmicro is a 12-layer board that drives a registered DDR4 module with 64 data bits plus 8 check bits, and each nibble has its own strobe. The rules file in the repository holds every nibble within 1 mm of its strobe, command and address within 1 mm of CK0, and every pair within 12 mil.
kicad-skew data-center-rdimm-ddr4-tester.kicad_pcb examples/antmicro-ddr4-rdimm-tester.json --layers --map skew.png
measured 136 nets (KiCad lengths: tracks + via barrels between the layers used)
PASS: 0 of 116 relations out of tolerance; 0 pairs split across layers
Every relation on the board passes. No nibble is more than 0.06 mm from its strobe, and 25 % of its limit is used by the worst pair, DQS10. The measured lengths include the package of the FPGA, 9.6 to 25.7 mm per net, since those lengths were entered on the pads by Antmicro. A check based on track length alone would therefore have been off by up to 16 mm.

Limits
Only board copper is measured, which means that package delays are counted only when they have been entered on the pads as pad-to-die lengths.
Matched length is no guarantee of matched timing. Legs on different layers, or nets on layers with different dielectrics, therefore require a time-domain check, and the places where this applies are shown by --layers. The sample LPDDR4 limits in examples/lpddr4-rockchip.json are taken from the RK3568 high-speed PCB guide by Rockchip, so the limits for a real design should be taken from the guide for the SoC in use.
Licence
Apache 2.0. The unit tests and the two Antmicro boards on which the tool was checked are described in VALIDATION.md in the repository.
Read the announcement: kicad-skew: making sure memory signals arrive together.