Skip to content

Commit

Permalink
FIX: merge_via bugs (#991)
Browse files Browse the repository at this point in the history
* fix net_filter bug
fix start and stop layer bug

* add merge_via test3
  • Loading branch information
boyang2022 authored Jan 22, 2025
1 parent 726259f commit aba86f0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pyedb/dotnet/edb_core/padstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,9 +1651,7 @@ def merge_via(self, contour_boxes, net_filter=None, start_layer=None, stop_layer
raise Exception(f"No padstack instances found inside {contour_box}")
else:
if net_filter:
instances = [
self.instances[id] for id in instances if not self.instances[id].net_name in net_filter
]
instances = [id for id in instances if not self.instances[id].net_name in net_filter]

net = self.instances[instances[0]].net_name
x_values = []
Expand Down Expand Up @@ -1690,6 +1688,9 @@ def merge_via(self, contour_boxes, net_filter=None, start_layer=None, stop_layer
):
raise Exception(f"Failed to create padstack definition {new_padstack_def}")
merged_instance = self.place(position=[0, 0], definition_name=new_padstack_def, net_name=net)
merged_instance.start_layer = start_layer
merged_instance.stop_layer = stop_layer

merged_via_ids.append(merged_instance.id)
[self.instances[id].delete() for id in instances]
return merged_via_ids
Expand Down
Binary file not shown.
16 changes: 16 additions & 0 deletions tests/legacy/system/test_edb_padstacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,3 +484,19 @@ def test_via_merge2(self, edb_examples):
result = edbapp.padstacks.merge_via(contour_boxes=polygon, start_layer="1_Top", stop_layer="16_Bottom")
assert len(result) == 1
edbapp.close()

def test_via_merge3(self):
source_path = Path(__file__).parent.parent.parent / "example_models" / "TEDB" / "merge_via_4layers.aedb"
edbapp = Edb(edbpath=source_path)

merged_via = edbapp.padstacks.merge_via(
contour_boxes=[[[11e-3, -5e-3], [17e-3, -5e-3], [17e-3, 1e-3], [11e-3, 1e-3], [11e-3, -5e-3]]],
net_filter=["NET_3"],
start_layer="layer1",
stop_layer="layer2",
)

assert edbapp.padstacks.instances[merged_via[0]].net_name == "NET_1"
assert edbapp.padstacks.instances[merged_via[0]].start_layer == "layer1"
assert edbapp.padstacks.instances[merged_via[0]].stop_layer == "layer2"
edbapp.close()

0 comments on commit aba86f0

Please sign in to comment.