Skip to content

Commit

Permalink
FEAT: edb configuraton support nearest pin
Browse files Browse the repository at this point in the history
  • Loading branch information
ring630 committed May 28, 2024
1 parent 9bb7df1 commit d9964cc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/pyedb/configuration/cfg_ports_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def _create_terminals(self):
temp = dict()
for i, j in pos_objs.items():
temp[i] = self._pdata.pedb.padstacks.get_reference_pins(j, ref_net, search_radius, max_limit=1)[0]
self.neg_terminal = {i: j.create_terminal(i+"_ref") if not j.terminal else j.terminal for i, j in temp.items()}
else:
if neg_type == "pin_group":
pin_group = {neg_value: self.pedb.siwave.pin_groups[neg_value]}
Expand Down Expand Up @@ -136,7 +137,7 @@ def create(self):
circuit_elements = []
for name, j in self.pos_terminals.items():
if isinstance(self.neg_terminal, dict):
elem = self.pedb.create_port(j, self.neg_terminal[name])
elem = self.pedb.create_port(j, self.neg_terminal[name], is_circuit_port)
else:
elem = self.pedb.create_port(j, self.neg_terminal, is_circuit_port)
if not self.distributed:
Expand Down
10 changes: 9 additions & 1 deletion src/pyedb/dotnet/edb_core/edb_data/padstacks_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ def get_terminal(self, name=None, create_new_terminal=False):
-------
:class:`pyedb.dotnet.edb_core.edb_data.terminals`
"""

warnings.warn("Use new property :func:`terminal` instead.", DeprecationWarning)
if create_new_terminal:
term = self._create_terminal(name)
else:
Expand All @@ -1195,6 +1195,14 @@ def get_terminal(self, name=None, create_new_terminal=False):
if not term.is_null:
return term

@property
def terminal(self):
"""Terminal."""
from pyedb.dotnet.edb_core.edb_data.terminals import PadstackInstanceTerminal

term = PadstackInstanceTerminal(self._pedb, self._edb_object.GetPadstackInstanceTerminal())
return term if not term.is_null else None

@pyedb_function_handler()
def _create_terminal(self, name=None):
"""Create a padstack instance terminal"""
Expand Down
21 changes: 20 additions & 1 deletion tests/legacy/system/test_edb_config_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def test_05c_ports_circuit_net_net_distributed(self, edb_examples):
assert len(edbapp.ports) > 1
edbapp.close()

def test_05c_ports_pin_group(self, edb_examples):
def test_05d_ports_pin_group(self, edb_examples):
edbapp = edb_examples.get_si_verse()
pin_groups = [
{"name": "U9_5V_1", "reference_designator": "U9", "pins": ["32", "33"]},
Expand All @@ -186,6 +186,25 @@ def test_05c_ports_pin_group(self, edb_examples):
assert "U9_pin_group_port" in edbapp.ports
edbapp.close()

def test_05e_ports_circuit_net_net_distributed_nearest_ref(self, edb_examples):
ports = [
{
"name": "CIRCUIT_U7_VDD_DDR_GND",
"reference_designator": "U7",
"type": "circuit",
"distributed": True,
"positive_terminal": {"net": "VDD_DDR"},
"negative_terminal": {"nearest_pin": {
"reference_net" : "GND", "search_radius" : 5e-3
}},
}
]
data = {"ports": ports}
edbapp = edb_examples.get_si_verse()
assert edbapp.configuration.load(data, apply_file=True)
assert len(edbapp.ports) > 1
edbapp.close()

def test_06_s_parameters(self, edb_examples):
with open(self.local_input_folder / "s_parameter.json") as f:
data = json.load(f)
Expand Down

0 comments on commit d9964cc

Please sign in to comment.