From 2e433fcd0d1afadd8ab786dd30d7d4546bdee43d Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 11 Nov 2026 10:08:41 +0100 Subject: hw-toolchain: placer, routers and KiCad helpers for agent-driven hardware work Rust placer (simulated annealing) and negotiated-congestion router for 2-layer KiCad boards, pnr.sh to place, route, DRC-check and install candidates, Python KiCad helpers, repo conventions (AGENTS.md) and the tool documentation under knowledge/. Konnect (KiCad MCP, AGPL) as a submodule. Co-Authored-By: Claude Opus 5.5 --- knowledge/topics/netclasses.md | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 knowledge/topics/netclasses.md (limited to 'knowledge/topics/netclasses.md') diff --git a/knowledge/topics/netclasses.md b/knowledge/topics/netclasses.md new file mode 100644 index 0000000..d3f290f --- /dev/null +++ b/knowledge/topics/netclasses.md @@ -0,0 +1,47 @@ +# Net classes + +Use one net-class table for every board in a repo, kept in one file and written into each project by `tools/netclasses.py`. Modules are pasted onto shared base boards as design blocks, so their classes must not drift or clash. The router takes its track widths from these classes too. + +## Use + +``` sh +python3 tools/netclasses.py modules/*/*.kicad_pro libraries/templates/*/*.kicad_pro # write +python3 tools/netclasses.py --check modules/*/*.kicad_pro # report drift +python3 tools/netclasses.py --table other.json board.kicad_pro +``` + +The table is `netclasses.json` at the repo root. Without it the script uses a small generic default (Ethernet, USB, Power, Ground, Default 0.2 mm). Format: + +``` json +{ + "clearance": 0.2, "via": 0.6, "drill": 0.3, "default_width": 0.2, + "track_widths": [0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0], + "classes": { + "Ethernet": [0.25, 0.25, 0.2, ["*/ETH_TX?", "*/ETH_RX?"]], + "Bus": [1.0, null, null, ["+3V3", "+5V", "+24V"]], + "Power": [0.5, null, null, ["*/3V3", "*/VBUS", "Net-(*-SW)"]], + "Ground": [0.4, null, null, ["GND"]] + } +} +``` + +Each class is `[track width, diff-pair width, diff-pair gap, patterns]`, listed in priority order. The script writes `net_settings.classes`, `netclass_patterns`, and the track-width, via and diff-pair palettes. All other project settings stay as they are. `tools/din_template.py` applies the table to new templates. + +Close the project in KiCad first. An open editor writes its own copy back on save, and reverting the board does not reload net classes. + +## Rules + +- **One source.** Edit the table, then write it into every project. +- **Sheet-independent patterns:** `*/RTD_COM`, not `/My Sheet/RTD_COM`. The same list then works in a module's test project and on the base board under any sheet name. + - Global power nets (`+3V3`, `GND`) match by name. + - Auto-named nets use wildcards for the reference, e.g. `Net-(*-SW)` for any buck switch node. Better still, give such nets a label. +- **Names are reserved repo-wide.** Module-specific classes live in the same table. A pattern that matches nothing does no harm, and no other module can reuse a name with other widths. +- **Widths are defaults, not minimums.** Short, narrower escapes (e.g. 0.2 mm out of a small pad) stay legal. Keep a margin over the fab's minimum: 0.2 mm on two layers, where 0.10 mm is a typical minimum. +- **Pattern matching:** KiCad matches patterns against the whole net name. When several match, the lower `priority` (earlier in the table) wins. + +## Sizing hints + +- **Supply bus** carrying about 2 A: 1.0 mm of 35 µm outer copper carries about 2 A at 10 °C rise (IPC-2221). +- **Local rails** of a few hundred mA: 0.5 mm keeps the drop and inductance low. +- **Field lines at screw terminals** (0–10 V, tach, digital outputs, RS-485): about 0.4 mm. The signals are small, but ESD and surge currents run from the terminal to the TVS. +- **Ethernet 10/100 and full-speed USB** on short runs (< 20 mm) need no impedance control on a 2-layer board. The classes exist so that the pairs route together. -- cgit v1.3