Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
ring630 committed Oct 27, 2024
1 parent 023f6df commit 0600b8f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 85 deletions.
62 changes: 28 additions & 34 deletions src/pyedb/configuration/cfg_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,43 +110,35 @@ def _set_model_properties_to_edb(self):
self.spice_model["terminal_pairs"],
)

def retrieve_ic_die_properties_from_edb(self):
def _retrieve_ic_die_properties_from_edb(self):
temp = dict()
cp = self._pyedb_obj.component_property
c_type = self.type.lower()
if not c_type == "ic":
return
else:
ic_die_prop = cp.GetDieProperty().Clone()
die_type = pascal_to_snake(ic_die_prop.GetType().ToString())
self.type = die_type
if not die_type == "no_die":
temp["orientation"] = pascal_to_snake(ic_die_prop.GetOrientation().ToString())
if die_type == "wire_bond":
temp["height"] = ic_die_prop.GetHeightValue().ToString()
self.ic_die_properties = temp
ic_die_prop = cp.GetDieProperty().Clone()
die_type = pascal_to_snake(ic_die_prop.GetType().ToString())
temp["type"] = die_type
if not die_type == "no_die":
temp["orientation"] = pascal_to_snake(ic_die_prop.GetOrientation().ToString())
if die_type == "wire_bond":
temp["height"] = ic_die_prop.GetHeightValue().ToString()
self.ic_die_properties = temp

def _set_ic_die_properties_to_edb(self):
cp = self._pyedb_obj.component_property
c_type = self._pyedb_obj.type.lower()
if not c_type == "ic":
return
else:
ic_die_prop = cp.GetDieProperty().Clone()
die_type = self.ic_die_properties.get("type")
ic_die_prop.SetType(getattr(self._edb.definition.DieType, snake_to_pascal(die_type)))
if not die_type == "no_die":
orientation = self.ic_die_properties.get("orientation")
if orientation:
ic_die_prop.SetOrientation(
getattr(self._edb.definition.DieOrientation, snake_to_pascal(orientation))
)
if die_type == "wire_bond":
height = self.ic_die_properties.get("height")
if height:
ic_die_prop.SetHeight(self._pedb.edb_value(height))
cp.SetDieProperty(ic_die_prop)
self._pyedb_obj.component_property = cp
ic_die_prop = cp.GetDieProperty().Clone()
die_type = self.ic_die_properties.get("type")
ic_die_prop.SetType(getattr(self._pedb._edb.Definition.DieType, snake_to_pascal(die_type)))
if not die_type == "no_die":
orientation = self.ic_die_properties.get("orientation")
if orientation:
ic_die_prop.SetOrientation(
getattr(self._pedb._edb.Definition.DieOrientation, snake_to_pascal(orientation))
)
if die_type == "wire_bond":
height = self.ic_die_properties.get("height")
if height:
ic_die_prop.SetHeight(self._pedb.edb_value(height))
cp.SetDieProperty(ic_die_prop)
self._pyedb_obj.component_property = cp

def _retrieve_solder_ball_properties_from_edb(self):
temp = dict()
Expand Down Expand Up @@ -234,8 +226,10 @@ def retrieve_parameters_from_edb(self):
self.definition = self._pyedb_obj.part_name
self.reference_designator = self._pyedb_obj.name
self.retrieve_model_properties_from_edb()
if self._pyedb_obj.type.lower() in ["ic", "io", "other"]:
self.retrieve_ic_die_properties_from_edb()
if self._pyedb_obj.type.lower() == "ic":
self._retrieve_ic_die_properties_from_edb()
self._retrieve_port_properties_from_edb()
elif self._pyedb_obj.type.lower() in ["io", "other"]:
self._retrieve_solder_ball_properties_from_edb()
self._retrieve_port_properties_from_edb()

Expand Down
48 changes: 24 additions & 24 deletions tests/legacy/system/test_edb_configuration_2p0.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import pytest

from pyedb.dotnet.edb import Edb as EdbType
pytestmark = [pytest.mark.unit, pytest.mark.legacy]


Expand Down Expand Up @@ -949,30 +950,6 @@ def test_16_components_rlc(self, edb_examples):
assert c375["pin_pair_model"] == components[0]["pin_pair_model"]
edbapp.close()

def test_15b_component_solder_ball(self, edb_examples):
components = [
{
"reference_designator": "U1",
"part_type": "io",
"solder_ball_properties": {"shape": "cylinder", "diameter": "244um", "height": "406um"},
"port_properties": {
"reference_offset": "0.1mm",
"reference_size_auto": True,
"reference_size_x": 0,
"reference_size_y": 0,
},
},
]
data = {"components": components}
edbapp = edb_examples.get_si_verse()
assert edbapp.configuration.load(data, apply_file=True)
assert edbapp.components["U1"].type == "IO"
assert edbapp.components["U1"].solder_ball_shape == "Cylinder"
assert edbapp.components["U1"].solder_ball_height == 406e-6
assert edbapp.components["U1"].solder_ball_diameter == (244e-6, 244e-6)

edbapp.close()

def test_16_export_to_external_file(self, edb_examples):
edbapp = edb_examples.get_si_verse()
data_file_path = Path(edb_examples.test_folder) / "test.json"
Expand Down Expand Up @@ -1014,3 +991,26 @@ def test_16b_export_cutout(self, edb_examples):
edbapp = edb_examples.get_si_verse()
edbapp.configuration.load(data_from_db, apply_file=True)
edbapp.close()

def test_17_ic_die_properties(self, edb_examples):
db: EdbType = edb_examples.get_si_verse()

comps_edb = db.configuration.get_data_from_db(components=True)["components"]
component = [i for i in comps_edb if i["reference_designator"] == "U8"][0]
_assert_initial_ic_die_properties(component)

db.configuration.load(U8_IC_DIE_PROPERTIES, apply_file=True)
comps_edb = db.configuration.get_data_from_db(components=True)["components"]
component = [i for i in comps_edb if i["reference_designator"] == "U8"][0]
_assert_final_ic_die_properties(component)


def _assert_initial_ic_die_properties(component: dict):
assert component["ic_die_properties"]["type"] == "no_die"
assert "orientation" not in component["ic_die_properties"]
assert "height" not in component["ic_die_properties"]


def _assert_final_ic_die_properties(component: dict):
assert component["ic_die_properties"]["type"] == "flip_chip"
assert component["ic_die_properties"]["orientation"] == "chip_down"
27 changes: 0 additions & 27 deletions tests/legacy/system/test_edb_padstacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,33 +456,6 @@ def test_via_fence(self):
assert "via_central" in edbapp.padstacks.definitions
edbapp.close()

def test_pad_parameter(self, edb_examples):
edbapp = edb_examples.get_si_verse()
o_pad_params = edbapp.padstacks.definitions["v35h15"].pad_parameters
assert o_pad_params["regular_pad"][0]["shape"] == "circle"

i_pad_params = {}
i_pad_params["regular_pad"] = [
{"layer_name": "1_Top", "shape": "circle", "offset_x": "0.1mm", "rotation": "0", "diameter": "0.5mm"}
]
i_pad_params["anti_pad"] = [{"layer_name": "1_Top", "shape": "circle", "diameter": "1mm"}]
i_pad_params["thermal_pad"] = [
{
"layer_name": "1_Top",
"shape": "round90",
"inner": "1mm",
"channel_width": "0.2mm",
"isolation_gap": "0.3mm",
}
]
edbapp.padstacks.definitions["v35h15"].pad_parameters = i_pad_params
o2_pad_params = edbapp.padstacks.definitions["v35h15"].pad_parameters
assert o2_pad_params["regular_pad"][0]["diameter"] == "0.5mm"
assert o2_pad_params["regular_pad"][0]["offset_x"] == "0.1mm"
assert o2_pad_params["anti_pad"][0]["diameter"] == "1mm"
assert o2_pad_params["thermal_pad"][0]["inner"] == "1mm"
assert o2_pad_params["thermal_pad"][0]["channel_width"] == "0.2mm"

def test_pad_parameter(self, edb_examples):
edbapp = edb_examples.get_si_verse()
o_hole_params = edbapp.padstacks.definitions["v35h15"].hole_parameters
Expand Down

0 comments on commit 0600b8f

Please sign in to comment.