Skip to content

Sort netlists according to block traversal ordering#454

Merged
ducky64 merged 3 commits intomasterfrom
sorted-netlist
Mar 16, 2026
Merged

Sort netlists according to block traversal ordering#454
ducky64 merged 3 commits intomasterfrom
sorted-netlist

Conversation

@ducky64
Copy link
Collaborator

@ducky64 ducky64 commented Mar 16, 2026

Makes netlists more deterministic and less sensitive to the ordering of connects.

Updates reference netlists to match new order.

@ducky64 ducky64 requested a review from Copilot March 16, 2026 01:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make generated KiCad netlists deterministic by ordering nets (and pin entries within each net) based on block/link traversal order, and updates the example/reference .net files to match the new stable output.

Changes:

  • Track block/link traversal order during netlist generation and sort nets accordingly.
  • Sort pins within each net deterministically.
  • Update example/reference netlists to reflect the new ordering.

Reviewed changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
edg/electronics_model/NetlistGenerator.py Implements traversal-based ordering for nets and deterministic pin ordering within nets.
examples/UsbUart/UsbUart.net Updated reference netlist ordering to match new deterministic generation.
examples/UsbKey/UsbKey.net Updated reference netlist ordering to match new deterministic generation.
examples/UsbFpgaProgrammer/UsbFpgaProgrammer.net Updated reference netlist ordering to match new deterministic generation.
examples/TestLed/TestLed.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyWithSchematicImport/TestBlinkyWithSchematicImport.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyWithModeledSchematicImport/TestBlinkyWithModeledSchematicImport.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyWithLibraryExport/TestBlinkyWithLibraryExport.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyWithLibrary/TestBlinkyWithLibrary.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyPacked/TestBlinkyPacked.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyMicro/TestBlinkyMicro.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyImplicit/TestBlinkyImplicit.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyExpanded/TestBlinkyExpanded.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyComplete/TestBlinkyComplete.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyChain/TestBlinkyChain.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyBasicBattery/TestBlinkyBasicBattery.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyBasic/TestBlinkyBasic.net Updated reference netlist ordering to match new deterministic generation.
examples/TestBlinkyArray/TestBlinkyArray.net Updated reference netlist ordering to match new deterministic generation.
examples/SwdDebugger/SwdDebugger.net Updated reference netlist ordering to match new deterministic generation.
examples/Simon/Simon.net Updated reference netlist ordering to match new deterministic generation.
examples/RobotOwl/RobotOwl.net Updated reference netlist ordering to match new deterministic generation.
examples/ProtectedCharger/ProtectedCharger.net Updated reference netlist ordering to match new deterministic generation.
examples/PicoProbe/PicoProbe.net Updated reference netlist ordering to match new deterministic generation.
examples/LedMatrix/LedMatrix.net Updated reference netlist ordering to match new deterministic generation.
examples/Keyboard/Keyboard.net Updated reference netlist ordering to match new deterministic generation.
examples/JacdacKeyswitch/JacdacKeyswitch.net Updated reference netlist ordering to match new deterministic generation.
examples/IotRollerBlinds/IotRollerBlinds.net Updated reference netlist ordering to match new deterministic generation.
examples/IotCurtainCrawler/IotCurtainCrawler.net Updated reference netlist ordering to match new deterministic generation.
examples/EspProgrammer/EspProgrammer.net Updated reference netlist ordering to match new deterministic generation.
examples/CanAdapter/CanAdapter.net Updated reference netlist ordering to match new deterministic generation.
examples/BleJoystick/BleJoystick.net Updated reference netlist ordering to match new deterministic generation.
examples/BasicKeyboard/BasicKeyboard.net Updated reference netlist ordering to match new deterministic generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


named_nets = sorted(
[(self.name_net(net), net) for net in nets],
key=lambda pair: path_ordering[pair[0].link_component(must_have_link=False)],

named_nets = sorted(
[(self.name_net(net), net) for net in nets],
key=lambda pair: path_ordering[pair[0].link_component(must_have_link=False)],
@ducky64 ducky64 merged commit 50f0eca into master Mar 16, 2026
12 checks passed
@ducky64 ducky64 deleted the sorted-netlist branch March 16, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants