Unify .connected(...) with DummyBlocks and TestPoints#511
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR standardizes the “single-port utility block” API across Dummy* blocks and TestPoint blocks by introducing a shared .connected(...) helper and unifying the primary port name to io, while refactoring call sites and updating example netlist references accordingly.
Changes:
- Introduces a typed
BaseDummyBlock[...]with a.connected(...)helper and updates Dummy blocks to use a unifiedioport (with deprecation accessors for older names like.gnd/.pwr). - Refactors typed TestPoint implementations around shared generic base classes and provides a unified
.connected(...)helper. - Updates tests/examples and reference netlists to match the new connection patterns and net naming behavior.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/TestLed/TestLed.svgpcb.js | Updates expected net names after Dummy* connection changes. |
| examples/TestLed/TestLed.net.ref | Updates expected netlist reference names to match new net naming. |
| examples/test_usb_key.py | Migrates DummyPassive usage to .connected(...). |
| examples/test_multimeter.py | Migrates DummyPassive usage to .connected(...). |
| examples/test_iot_led_driver.py | Migrates DummyPassive usage to .connected(...). |
| examples/test_blinky.py | Migrates DummyGround/DummyDigitalSource usage to .connected(...) and new net naming. |
| edg/vendor_parts/jlc/test_JlcResistor.py | Replaces chain(...) with DummyPassive .connected(...). |
| edg/vendor_parts/jlc/test_JlcCapacitor.py | Replaces chain(...) with DummyPassive .connected(...). |
| edg/vendor_parts/jlc/test_inductor.py | Replaces chain(...) with DummyPassive .connected(...). |
| edg/vendor_parts/generic/test_resistor_generic.py | Replaces chain(...) with DummyPassive .connected(...) and simplifies instantiation formatting. |
| edg/vendor_parts/generic/test_capacitor_generic.py | Replaces chain(...) with DummyPassive .connected(...). |
| edg/parts/microcontroller/test_mcu_wrapper.py | Updates implicit connects and dummy IO hookups to use .io / .connected(...). |
| edg/parts/microcontroller/Rp2040.py | Updates DummyGround/DummyVoltageSource port usage to .io and adopts .connected(...) in one spot. |
| edg/parts/microcontroller/nRF52840.py | Updates DummyGround/DummyVoltageSource port usage to .io and adopts .connected(...) in one spot. |
| edg/parts/microcontroller/Esp32s3.py | Updates DummyGround/DummyVoltageSource port usage to .io and adopts .connected(...) in one spot. |
| edg/parts/microcontroller/Esp32c3.py | Updates DummyGround/DummyVoltageSource port usage to .io and adopts .connected(...) in one spot. |
| edg/parts/microcontroller/Esp32.py | Updates DummyGround/DummyVoltageSource port usage to .io and adopts .connected(...) in one spot. |
| edg/parts/display/oled/test_oled_i2c_spi.py | Migrates DummyDigitalSource hookups to .connected(...) and .io. |
| edg/electronics_interfaces/VoltageDummy.py | Renames .pwr to .io and adds runtime deprecation via __getattr__; switches to BaseDummyBlock. |
| edg/electronics_interfaces/test_voltage_link.py | Updates tests to connect via .io instead of .pwr. |
| edg/electronics_interfaces/GroundDummy.py | Renames .gnd to .io and adds runtime deprecation via __getattr__; switches to BaseDummyBlock. |
| edg/electronics_interfaces/DummyDevices.py | Adds BaseDummyBlock[...] with .connected(...) and updates Dummy* implementations to inherit it. |
| edg/circuits/test_switching_converters.py | Replaces chain(...) with .connected(...) for dummy sources/sinks/ground. |
| edg/circuits/test_power_circuits.py | Replaces chain(...) with .connected(...) for dummy sources/sinks/ground. |
| edg/circuits/test_opamp.py | Removes bespoke analog dummy and replaces with DummyAnalogSource; migrates to .connected(...). |
| edg/circuits/test_diodemerge.py | Replaces chain(...) with .connected(...) for dummy sources/sink. |
| edg/circuits/LevelShifter.py | Migrates DummyVoltageSink hookup to .connected(...) (currently with a type ignore). |
| edg/abstract_parts/TestPoint.py | Refactors typed test point hierarchy and introduces a generic .connected(...) helper. |
| edg/abstract_parts/test_ideal_circuit.py | Migrates dummy hookups to .connected(...) and .io ports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+9
to
+12
| DummyLinkType = TypeVar("DummyLinkType", bound=Link) | ||
|
|
||
|
|
||
| @non_library |
Comment on lines
+18
to
+33
| TestPointLinkType = TypeVar("TestPointLinkType", bound=Link) | ||
|
|
||
|
|
||
| @non_library | ||
| class BaseTypedTestPoint(TypedTestPoint, Block): | ||
| class BaseTypedTestPoint(TypedTestPoint, Block, Generic[TestPointLinkType]): | ||
| """Base class with utility infrastructure for typed test points""" | ||
|
|
||
| def __init__(self, tp_name: StringLike = "") -> None: | ||
| super().__init__() | ||
| self.io: Port | ||
| self.io: Port[TestPointLinkType] | ||
| self.tp_name = self.ArgParameter(tp_name) | ||
| self.tp = self.Block(TestPoint(tp_name=StringExpr())) | ||
|
|
||
| def connected(self, io: Port[TestPointLinkType]) -> Self: | ||
| builder.block().connect(io, self.io) | ||
| return self | ||
|
|
|
|
||
|
|
||
| @non_library | ||
| class BaseDummyBlock(DummyDevice, Block, Generic[DummyLinkType]): |
Comment on lines
+35
to
+39
| warnings.warn( | ||
| f"Use .io instead.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
Comment on lines
+73
to
+77
| warnings.warn( | ||
| f"Use .io instead.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
Comment on lines
+16
to
+20
| warnings.warn( | ||
| f"Use .io instead.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
|
|
||
| class GroundTestPoint(BaseTypedTestPoint, Block): | ||
| class GroundTestPoint(BaseSingleTestPoint[GroundLink], Block): | ||
| """Test point with a VoltageSink port.""" |
|
|
||
|
|
||
| @non_library | ||
| class BaseDummyBlock(DummyDevice, Block, Generic[DummyLinkType]): |
Comment on lines
+35
to
+39
| warnings.warn( | ||
| f"Use .io instead.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
Comment on lines
+73
to
+77
| warnings.warn( | ||
| f"Use .io instead.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
Comment on lines
+16
to
+20
| warnings.warn( | ||
| f"Use .io instead.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
|
|
||
| class GroundTestPoint(BaseTypedTestPoint, Block): | ||
| class GroundTestPoint(BaseSingleTestPoint[GroundLink], Block): | ||
| """Test point with a VoltageSink port.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds connected(...) to DummyBlocks with a base class. Unifies the port name to
io, adding a deprecation pathway for the older port names.Refactors the .connected(...) in TestPoints with a base class.
Refactors use sites.
Resolves #506, resolves #500