Skip to content

Commit

Permalink
FIX: bug in edb configuration padstack (#519)
Browse files Browse the repository at this point in the history
* FIX: bug in uniitest

* MISC: Auto fixes from pre-commit.com hooks

For more information, see https://pre-commit.ci

* boundaries default behavior

---------

Co-authored-by: ring630 <@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: svandenb-dev <[email protected]>
  • Loading branch information
3 people authored May 29, 2024
1 parent 06d4464 commit db78c0d
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 36 deletions.
60 changes: 35 additions & 25 deletions src/pyedb/configuration/cfg_boundaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ class CfgBoundaries:
def __init__(self, pdata, boundaries_dict):
self._pedb = pdata.pedb
self._boundaries_dict = boundaries_dict
self.open_region = self._boundaries_dict.get("open_region", True)
self.open_region = self._boundaries_dict.get("open_region", None)
self._map_open_region_type()
self.pml_visible = self._boundaries_dict.get("pml_visible", False)
self.pml_operation_frequency = self._boundaries_dict.get("pml_operation_frequency", "5GHz")
self.pml_radiation_factor = self._boundaries_dict.get("pml_radiation_factor", 10)
self.pml_visible = self._boundaries_dict.get("pml_visible", None)
self.pml_operation_frequency = self._boundaries_dict.get("pml_operation_frequency", None)
self.pml_radiation_factor = self._boundaries_dict.get("pml_radiation_factor", None)
self._map_dielectric_extend_type()
self.dielectric_base_polygon = self._boundaries_dict.get("dielectric_base_polygon", "")
self.horizontal_padding = self._boundaries_dict.get("horizontal_padding", 0.0)
self.dielectric_base_polygon = self._boundaries_dict.get("dielectric_base_polygon", None)
self.horizontal_padding = self._boundaries_dict.get("horizontal_padding", None)
self.honor_primitives_on_dielectric_layers = self._boundaries_dict.get(
"honor_primitives_on_dielectric_layers", False
)
self._map_air_box_extend_type()
self.air_box_base_polygon = self._boundaries_dict.get("air_box_base_polygon", "")
self.air_box_base_polygon = self._boundaries_dict.get("air_box_base_polygon", None)
self.air_box_truncate_model_ground_layers = self._boundaries_dict.get(
"air_box_truncate_model_ground_layers", False
"air_box_truncate_model_ground_layers", None
)
self.air_box_horizontal_padding = self._boundaries_dict.get("air_box_horizontal_padding", 0.15)
self.air_box_positive_vertical_padding = self._boundaries_dict.get("air_box_positive_vertical_padding", 1)
self.air_box_negative_vertical_padding = self._boundaries_dict.get("air_box_negative_vertical_padding", 1)
self.air_box_horizontal_padding = self._boundaries_dict.get("air_box_horizontal_padding", None)
self.air_box_positive_vertical_padding = self._boundaries_dict.get("air_box_positive_vertical_padding", None)
self.air_box_negative_vertical_padding = self._boundaries_dict.get("air_box_negative_vertical_padding", None)

def _map_air_box_extend_type(self):
air_box_type = self._boundaries_dict.get("air_box_extents_type", None)
Expand Down Expand Up @@ -94,22 +94,32 @@ class ExtentType(Enum):

def apply(self):
"""Imports boundary information from JSON."""
self._pedb.hfss.hfss_extent_info.use_open_region = self.open_region
if self.open_region is not None:
self._pedb.hfss.hfss_extent_info.use_open_region = self.open_region
self._pedb.hfss.hfss_extent_info.open_region_type = self.open_region_type.name.lower()
self._pedb.hfss.hfss_extent_info.is_pml_visible = self.pml_visible
self._pedb.hfss.hfss_extent_info.operating_freq = self.pml_operation_frequency
self._pedb.hfss.hfss_extent_info.radiation_level = self.pml_radiation_factor
if self.pml_visible is not None:
self._pedb.hfss.hfss_extent_info.is_pml_visible = self.pml_visible
if self.pml_operation_frequency:
self._pedb.hfss.hfss_extent_info.operating_freq = self.pml_operation_frequency
if self.pml_radiation_factor:
self._pedb.hfss.hfss_extent_info.radiation_level = self.pml_radiation_factor
self._pedb.hfss.hfss_extent_info.extent_type = self.dielectric_extents_type.name.lower()
if self.dielectric_base_polygon:
self._pedb.hfss.hfss_extent_info.dielectric_base_polygon = self.dielectric_base_polygon
self._pedb.hfss.hfss_extent_info.dielectric_extent_size = float(self.horizontal_padding)
self._pedb.hfss.hfss_extent_info.honor_user_dielectric = self.honor_primitives_on_dielectric_layers
if self.horizontal_padding:
self._pedb.hfss.hfss_extent_info.dielectric_extent_size = float(self.horizontal_padding)
if self.honor_primitives_on_dielectric_layers is not None:
self._pedb.hfss.hfss_extent_info.honor_user_dielectric = self.honor_primitives_on_dielectric_layers
self._pedb.hfss.hfss_extent_info.extent_type = self.air_box_extents_type.name.lower()
self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground = self.air_box_truncate_model_ground_layers
self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent = float(self.air_box_horizontal_padding)
self._pedb.hfss.hfss_extent_info.air_box_positive_vertical_extent = float(
self.air_box_positive_vertical_padding
)
self._pedb.hfss.hfss_extent_info.air_box_negative_vertical_extent = float(
self.air_box_negative_vertical_padding
)
if self.air_box_truncate_model_ground_layers is not None:
self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground = self.air_box_truncate_model_ground_layers
if self.air_box_horizontal_padding:
self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent = float(self.air_box_horizontal_padding)
if self.air_box_positive_vertical_padding:
self._pedb.hfss.hfss_extent_info.air_box_positive_vertical_extent = float(
self.air_box_positive_vertical_padding
)
if self.air_box_negative_vertical_padding:
self._pedb.hfss.hfss_extent_info.air_box_negative_vertical_extent = float(
self.air_box_negative_vertical_padding
)
22 changes: 13 additions & 9 deletions src/pyedb/configuration/cfg_padstacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,24 @@ class Definition:
def __init__(self, pdata, definition_dict):
self._pedb = pdata.pedb
self._definition_dict = definition_dict
self.name = self._definition_dict.get("name", "")
self.hole_diameter = self._definition_dict.get("hole_diameter", "")
self.hole_plating_thickness = self._definition_dict.get("hole_plating_thickness", "")
self.hole_material = self._definition_dict.get("hole_material", "")
self.hole_range = self._definition_dict.get("hole_range", "")
self.name = self._definition_dict.get("name", None)
self.hole_diameter = self._definition_dict.get("hole_diameter", None)
self.hole_plating_thickness = self._definition_dict.get("hole_plating_thickness", None)
self.hole_material = self._definition_dict.get("hole_material", None)
self.hole_range = self._definition_dict.get("hole_range", None)

def apply(self):
"""Apply padstack definition on layout."""
padstack_defs = self._pedb.padstacks.definitions
pdef = padstack_defs[self.name]
pdef.hole_diameter = self.hole_diameter
pdef.hole_plating_thickness = self.hole_plating_thickness
pdef.material = self.hole_material
pdef.hole_range = self.hole_range
if self.hole_diameter:
pdef.hole_diameter = self.hole_diameter
if self.hole_plating_thickness:
pdef.hole_plating_thickness = self.hole_plating_thickness
if self.hole_material:
pdef.material = self.hole_material
if self.hole_range:
pdef.hole_range = self.hole_range


class Instance:
Expand Down
30 changes: 28 additions & 2 deletions tests/legacy/system/test_edb_config_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,34 @@ def test_08a_operations_cutout(self, edb_examples):
edbapp.close()

def test_09_padstacks(self, edb_examples):
with open(self.local_input_folder / "padstacks.json") as f:
data = json.load(f)
data = {
"padstacks": {
"definitions": [
{
"name": "v40h20",
# "hole_diameter": "0.18mm",
"hole_plating_thickness": "25um",
"hole_material": "copper",
"hole_range": "through",
}
],
"instances": [
{
"name": "Via998",
"backdrill_top": {
"drill_to_layer": "Inner3(Sig1)",
"drill_diameter": "0.5mm",
"stub_length": "0.2mm",
},
"backdrill_bottom": {
"drill_to_layer": "Inner4(Sig2)",
"drill_diameter": "0.5mm",
"stub_length": "0.2mm",
},
}
],
}
}

edbapp = edb_examples.get_si_verse()
assert edbapp.configuration.load(data, apply_file=True)
Expand Down

0 comments on commit db78c0d

Please sign in to comment.