pyedb 0.12.2__py3-none-any.whl → 0.13.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyedb might be problematic. Click here for more details.
- pyedb/__init__.py +1 -1
- pyedb/configuration/cfg_common.py +48 -0
- pyedb/configuration/cfg_components.py +94 -166
- pyedb/configuration/cfg_data.py +8 -10
- pyedb/configuration/cfg_operations.py +63 -0
- pyedb/configuration/cfg_package_definition.py +128 -0
- pyedb/configuration/cfg_stackup.py +80 -46
- pyedb/configuration/configuration.py +45 -15
- pyedb/dotnet/edb.py +167 -7
- pyedb/dotnet/edb_core/cell/hierarchy/model.py +1 -1
- pyedb/dotnet/edb_core/{edb_data/connectable.py → cell/layout_obj.py} +1 -1
- pyedb/dotnet/edb_core/cell/primitive.py +142 -0
- pyedb/dotnet/edb_core/components.py +1 -1
- pyedb/dotnet/edb_core/definition/component_def.py +1 -1
- pyedb/dotnet/edb_core/definition/component_model.py +1 -1
- pyedb/dotnet/edb_core/definition/definition_obj.py +1 -1
- pyedb/dotnet/edb_core/definition/package_def.py +2 -1
- pyedb/dotnet/edb_core/edb_data/components_data.py +19 -7
- pyedb/dotnet/edb_core/edb_data/padstacks_data.py +3 -3
- pyedb/dotnet/edb_core/edb_data/primitives_data.py +5 -126
- pyedb/dotnet/edb_core/edb_data/terminals.py +2 -2
- pyedb/dotnet/edb_core/geometry/polygon_data.py +1 -1
- pyedb/dotnet/edb_core/materials.py +2 -1
- pyedb/dotnet/edb_core/padstack.py +86 -27
- pyedb/generic/general_methods.py +33 -0
- {pyedb-0.12.2.dist-info → pyedb-0.13.dev0.dist-info}/METADATA +1 -1
- {pyedb-0.12.2.dist-info → pyedb-0.13.dev0.dist-info}/RECORD +30 -26
- /pyedb/dotnet/edb_core/{obj_base.py → utilities/obj_base.py} +0 -0
- {pyedb-0.12.2.dist-info → pyedb-0.13.dev0.dist-info}/LICENSE +0 -0
- {pyedb-0.12.2.dist-info → pyedb-0.13.dev0.dist-info}/WHEEL +0 -0
pyedb/__init__.py
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
#
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
# furnished to do so, subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
# copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
# SOFTWARE.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
from pyedb.generic.general_methods import pyedb_function_handler
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class CfgBase:
|
|
28
|
+
@property
|
|
29
|
+
def protected_attributes(self):
|
|
30
|
+
return []
|
|
31
|
+
|
|
32
|
+
@pyedb_function_handler
|
|
33
|
+
def get_attributes(self, exclude=None):
|
|
34
|
+
attrs = {i: j for i, j in self.__dict__.items() if i not in self.protected_attributes}
|
|
35
|
+
if exclude is not None:
|
|
36
|
+
exclude = exclude if isinstance(exclude, list) else [exclude]
|
|
37
|
+
attrs = {i: j for i, j in attrs.items() if i not in exclude}
|
|
38
|
+
attrs = {i: j for i, j in attrs.items() if not i.startswith("_")}
|
|
39
|
+
attrs = {i: j for i, j in attrs.items() if j is not None}
|
|
40
|
+
return attrs
|
|
41
|
+
|
|
42
|
+
@pyedb_function_handler
|
|
43
|
+
def set_attributes(self, pedb_object):
|
|
44
|
+
attrs = self.get_attributes()
|
|
45
|
+
for attr, value in attrs.items():
|
|
46
|
+
if attr not in dir(pedb_object):
|
|
47
|
+
raise AttributeError(f"Invalid attribute '{attr}' in '{pedb_object}'")
|
|
48
|
+
setattr(pedb_object, attr, value)
|
|
@@ -20,186 +20,114 @@
|
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
# SOFTWARE.
|
|
22
22
|
|
|
23
|
-
from
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
self.
|
|
30
|
-
self.
|
|
31
|
-
self.
|
|
32
|
-
self.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
self.
|
|
51
|
-
self.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
self._comp_dict = kwargs
|
|
65
|
-
self.reference_designator = ""
|
|
66
|
-
self.part_type = self.ComponentType.RESISTOR
|
|
67
|
-
self.enabled = True
|
|
68
|
-
self.rlc_model = CfgRlcModel()
|
|
69
|
-
self.port_properties = CfgPortProperties()
|
|
70
|
-
self.solder_balls = CfgSolderBallsProperties()
|
|
71
|
-
self._update()
|
|
72
|
-
self.layout_comp = None
|
|
73
|
-
|
|
74
|
-
class ComponentType(Enum):
|
|
75
|
-
RESISTOR = 0
|
|
76
|
-
INDUCTOR = 1
|
|
77
|
-
CAPACITOR = 2
|
|
78
|
-
IO = 3
|
|
79
|
-
IC = 4
|
|
80
|
-
OTHER = 5
|
|
81
|
-
|
|
82
|
-
def _update(self):
|
|
83
|
-
self.reference_designator = self._comp_dict.get("reference_designator")
|
|
84
|
-
self.enabled = self._comp_dict.get("enabled")
|
|
85
|
-
part_type = self._comp_dict["part_type"].lower()
|
|
86
|
-
if part_type == "resistor":
|
|
87
|
-
self.part_type = self.part_type.RESISTOR
|
|
88
|
-
elif part_type == "capacitor":
|
|
89
|
-
self.part_type = self.part_type.CAPACITOR
|
|
90
|
-
elif part_type == "inductor":
|
|
91
|
-
self.part_type = self.part_type.INDUCTOR
|
|
92
|
-
elif part_type == "io":
|
|
93
|
-
self.part_type = self.part_type.IO
|
|
94
|
-
elif part_type == "ic":
|
|
95
|
-
self.part_type = self.part_type.IC
|
|
96
|
-
else:
|
|
97
|
-
self.part_type = self.part_type.OTHER
|
|
98
|
-
|
|
99
|
-
if self.part_type.value in [0, 1, 2]:
|
|
100
|
-
rlc_model = self._comp_dict["rlc_model"] if "rlc_model" in self._comp_dict else None
|
|
101
|
-
if rlc_model:
|
|
102
|
-
pin_pairs = rlc_model["pin_pairs"] if "pin_pairs" in rlc_model else None
|
|
103
|
-
if pin_pairs:
|
|
104
|
-
self.rlc_model.pin_pairs = []
|
|
105
|
-
for pp in pin_pairs:
|
|
106
|
-
if pp["type"] == "Parallel":
|
|
107
|
-
self.rlc_model.rlc_model_type = self.rlc_model.rlc_model_type.PARALLEL
|
|
108
|
-
|
|
109
|
-
self.rlc_model.pin_pairs.append([pp["p1"], pp["p2"]])
|
|
110
|
-
self.rlc_model.resistance = pp["resistance"] if "resistance" in pp else None
|
|
111
|
-
self.rlc_model.inductance = pp["inductance"] if "inductance" in pp else None
|
|
112
|
-
self.rlc_model.capacitance = pp["capacitance"] if "capacitance" in pp else None
|
|
113
|
-
|
|
114
|
-
port_properties = self._comp_dict["port_properties"] if "port_properties" in self._comp_dict else None
|
|
115
|
-
if port_properties:
|
|
116
|
-
self.port_properties.ref_offset = float(port_properties["reference_offset"])
|
|
117
|
-
self.port_properties.ref_size_auto = bool(port_properties["reference_size_auto"])
|
|
118
|
-
self.port_properties.ref_size_x = float(port_properties["reference_size_x"])
|
|
119
|
-
self.port_properties.ref_size_y = float(port_properties["reference_size_y"])
|
|
120
|
-
|
|
121
|
-
solder_ball_properties = (
|
|
122
|
-
self._comp_dict["solder_ball_properties"] if "solder_ball_properties" in self._comp_dict else None
|
|
23
|
+
from pyedb.configuration.cfg_common import CfgBase
|
|
24
|
+
from pyedb.generic.general_methods import pyedb_function_handler
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class CfgPortProperties(CfgBase):
|
|
28
|
+
def __init__(self, **kwargs):
|
|
29
|
+
self.reference_offset = kwargs.pop("reference_offset", 0)
|
|
30
|
+
self.reference_size_auto = kwargs.pop("reference_size_auto", 0)
|
|
31
|
+
self.reference_size_x = kwargs.pop("reference_size_x", 0)
|
|
32
|
+
self.reference_size_y = kwargs.pop("reference_size_y", 0)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class CfgSolderBallsProperties(CfgBase):
|
|
36
|
+
def __init__(self, **kwargs):
|
|
37
|
+
self.shape = kwargs.pop("shape", None)
|
|
38
|
+
self.diameter = kwargs.pop("diameter", None)
|
|
39
|
+
self.mid_diameter = kwargs.pop("mid_diameter", None)
|
|
40
|
+
self.height = kwargs.pop("height", None)
|
|
41
|
+
self.enabled = kwargs.pop("enabled", None)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class CfgRlcModel(CfgBase):
|
|
45
|
+
def __init__(self, **kwargs):
|
|
46
|
+
self.resistance = kwargs.get("resistance", None)
|
|
47
|
+
self.inductance = kwargs.get("inductance", None)
|
|
48
|
+
self.capacitance = kwargs.get("capacitance", None)
|
|
49
|
+
self.type = kwargs.get("type", None)
|
|
50
|
+
self.p1 = kwargs.get("p1", None)
|
|
51
|
+
self.p2 = kwargs.get("p2", None)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class CfgComponent(CfgBase):
|
|
55
|
+
def __init__(self, **kwargs):
|
|
56
|
+
self.enabled = kwargs.get("enabled", None)
|
|
57
|
+
|
|
58
|
+
self.reference_designator = kwargs.get("reference_designator", None)
|
|
59
|
+
self.type = kwargs.get("part_type", None)
|
|
60
|
+
self.value = kwargs.get("value", None)
|
|
61
|
+
self.port_properties = CfgPortProperties(**kwargs["port_properties"]) if "port_properties" in kwargs else None
|
|
62
|
+
self.solder_ball_properties = (
|
|
63
|
+
CfgSolderBallsProperties(**kwargs["solder_ball_properties"]) if "solder_ball_properties" in kwargs else None
|
|
123
64
|
)
|
|
124
|
-
|
|
125
|
-
if solder_ball_properties["shape"].lower() == "spheroid":
|
|
126
|
-
self.solder_balls.shape = self.solder_balls.shape.SPHEROID
|
|
127
|
-
self.solder_balls.diameter = solder_ball_properties["diameter"]
|
|
128
|
-
self.solder_balls.mid_diameter = (
|
|
129
|
-
float(solder_ball_properties["mid_diameter"])
|
|
130
|
-
if "mid_diameter" in solder_ball_properties
|
|
131
|
-
else self.solder_balls.diameter
|
|
132
|
-
)
|
|
133
|
-
self.solder_balls.height = solder_ball_properties["height"]
|
|
65
|
+
rlc_models = kwargs.get("rlc_model", [])
|
|
134
66
|
|
|
67
|
+
self.rlc_model = [CfgRlcModel(**rlc_m) for rlc_m in rlc_models]
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def protected_attributes(self):
|
|
71
|
+
return ["reference_designator"]
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class CfgComponents:
|
|
75
|
+
def __init__(self, pedb, data):
|
|
76
|
+
self._pedb = pedb
|
|
77
|
+
self.components = [CfgComponent(**comp) for comp in data]
|
|
78
|
+
|
|
79
|
+
@pyedb_function_handler
|
|
135
80
|
def apply(self):
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if self.part_type.value in [0, 1, 2]:
|
|
161
|
-
self.layout_comp.is_enabled = self.enabled
|
|
162
|
-
if self.rlc_model:
|
|
163
|
-
model_layout = self.layout_comp.model
|
|
164
|
-
if self.rlc_model.pin_pairs:
|
|
81
|
+
comps_in_db = self._pedb.components
|
|
82
|
+
for comp in self.components:
|
|
83
|
+
c_db = comps_in_db[comp.reference_designator]
|
|
84
|
+
|
|
85
|
+
for attr, value in comp.get_attributes().items(): # All component properties
|
|
86
|
+
if attr == "solder_ball_properties":
|
|
87
|
+
solder_ball_properties = value
|
|
88
|
+
port_properties = comp.port_properties
|
|
89
|
+
self._pedb.components.set_solder_ball(
|
|
90
|
+
component=comp.reference_designator,
|
|
91
|
+
sball_diam=solder_ball_properties.diameter,
|
|
92
|
+
sball_mid_diam=solder_ball_properties.mid_diameter,
|
|
93
|
+
sball_height=solder_ball_properties.height,
|
|
94
|
+
shape=solder_ball_properties.shape,
|
|
95
|
+
auto_reference_size=port_properties.reference_size_auto,
|
|
96
|
+
reference_height=port_properties.reference_offset,
|
|
97
|
+
reference_size_x=port_properties.reference_size_x,
|
|
98
|
+
reference_size_y=port_properties.reference_size_y,
|
|
99
|
+
)
|
|
100
|
+
elif attr == "port_properties":
|
|
101
|
+
pass
|
|
102
|
+
elif attr == "rlc_model":
|
|
103
|
+
rlc_models = value
|
|
104
|
+
model_layout = c_db.model
|
|
165
105
|
for pp in model_layout.pin_pairs:
|
|
166
106
|
model_layout.delete_pin_pair_rlc(pp)
|
|
167
|
-
for pp in
|
|
168
|
-
pin_pair = self._pedb.edb_api.utility.PinPair(pp
|
|
107
|
+
for pp in rlc_models:
|
|
108
|
+
pin_pair = self._pedb.edb_api.utility.PinPair(pp.p1, pp.p2)
|
|
169
109
|
rlc = self._pedb.edb_api.utility.Rlc()
|
|
170
|
-
rlc.IsParallel = False if
|
|
171
|
-
if
|
|
110
|
+
rlc.IsParallel = False if pp.type else True
|
|
111
|
+
if pp.resistance is not None:
|
|
172
112
|
rlc.REnabled = True
|
|
173
|
-
rlc.R = self._pedb.edb_value(
|
|
113
|
+
rlc.R = self._pedb.edb_value(pp.resistance)
|
|
174
114
|
else:
|
|
175
115
|
rlc.REnabled = False
|
|
176
|
-
if
|
|
116
|
+
if pp.inductance is not None:
|
|
177
117
|
rlc.LEnabled = True
|
|
178
|
-
rlc.L = self._pedb.edb_value(
|
|
118
|
+
rlc.L = self._pedb.edb_value(pp.inductance)
|
|
179
119
|
else:
|
|
180
120
|
rlc.LEnabled = False
|
|
181
121
|
|
|
182
|
-
if
|
|
122
|
+
if pp.capacitance is not None:
|
|
183
123
|
rlc.CEnabled = True
|
|
184
|
-
rlc.C = self._pedb.edb_value(
|
|
124
|
+
rlc.C = self._pedb.edb_value(pp.capacitance)
|
|
185
125
|
else:
|
|
186
126
|
rlc.CEnabled = False
|
|
187
127
|
model_layout._set_pin_pair_rlc(pin_pair, rlc)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
shape = "Spheroid"
|
|
195
|
-
self._pedb.components.set_solder_ball(
|
|
196
|
-
component=self.reference_designator,
|
|
197
|
-
sball_diam=self.solder_balls.diameter,
|
|
198
|
-
sball_mid_diam=self.solder_balls.mid_diameter,
|
|
199
|
-
sball_height=self.solder_balls.height,
|
|
200
|
-
shape=shape,
|
|
201
|
-
auto_reference_size=self.port_properties.ref_size_auto,
|
|
202
|
-
reference_height=self.port_properties.ref_offset,
|
|
203
|
-
reference_size_x=self.port_properties.ref_size_x,
|
|
204
|
-
reference_size_y=self.port_properties.ref_size_y,
|
|
205
|
-
)
|
|
128
|
+
comps_in_db.model = model_layout
|
|
129
|
+
else:
|
|
130
|
+
if attr in dir(c_db):
|
|
131
|
+
setattr(c_db, attr, value)
|
|
132
|
+
else:
|
|
133
|
+
raise AttributeError(f"'{attr}' is not valid component attribute.")
|
pyedb/configuration/cfg_data.py
CHANGED
|
@@ -20,10 +20,13 @@
|
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
# SOFTWARE.
|
|
22
22
|
|
|
23
|
+
|
|
23
24
|
from pyedb.configuration.cfg_boundaries import CfgBoundaries
|
|
24
|
-
from pyedb.configuration.cfg_components import
|
|
25
|
+
from pyedb.configuration.cfg_components import CfgComponents
|
|
25
26
|
from pyedb.configuration.cfg_general import CfgGeneral
|
|
26
27
|
from pyedb.configuration.cfg_nets import CfgNets
|
|
28
|
+
from pyedb.configuration.cfg_operations import CfgOperations
|
|
29
|
+
from pyedb.configuration.cfg_package_definition import CfgPackageDefinitions
|
|
27
30
|
from pyedb.configuration.cfg_padstacks import CfgPadstacks
|
|
28
31
|
from pyedb.configuration.cfg_pin_groups import CfgPinGroup
|
|
29
32
|
from pyedb.configuration.cfg_ports_sources import CfgPort, CfgSources
|
|
@@ -31,7 +34,6 @@ from pyedb.configuration.cfg_s_parameter_models import CfgSParameterModel
|
|
|
31
34
|
from pyedb.configuration.cfg_setup import CfgSetup
|
|
32
35
|
from pyedb.configuration.cfg_spice_models import CfgSpiceModel
|
|
33
36
|
from pyedb.configuration.cfg_stackup import CfgStackup
|
|
34
|
-
from pyedb.generic.general_methods import pyedb_function_handler
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
class CfgData(object):
|
|
@@ -52,7 +54,8 @@ class CfgData(object):
|
|
|
52
54
|
self, kwargs.get("nets", {}).get("signal_nets", []), kwargs.get("nets", {}).get("power_ground_nets", [])
|
|
53
55
|
)
|
|
54
56
|
|
|
55
|
-
self.components = [CfgComponent(self, **component) for component in kwargs.get("components", [])]
|
|
57
|
+
# self.components = [CfgComponent(self, **component) for component in kwargs.get("components", [])]
|
|
58
|
+
self.components = CfgComponents(self._pedb, data=kwargs.get("components", []))
|
|
56
59
|
|
|
57
60
|
self.padstacks = CfgPadstacks(self, kwargs.get("padstacks", None))
|
|
58
61
|
|
|
@@ -78,10 +81,5 @@ class CfgData(object):
|
|
|
78
81
|
for spice_model in kwargs.get("spice_models", [])
|
|
79
82
|
]
|
|
80
83
|
|
|
81
|
-
self.
|
|
82
|
-
self.operations =
|
|
83
|
-
|
|
84
|
-
@pyedb_function_handler
|
|
85
|
-
def apply(self):
|
|
86
|
-
"""Apply configuration settings to the current design"""
|
|
87
|
-
self.stackup.apply()
|
|
84
|
+
self.package_definitions = CfgPackageDefinitions(self._pedb, data=kwargs.get("package_definitions", []))
|
|
85
|
+
self.operations = CfgOperations(self._pedb, data=kwargs.get("operations", []))
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
#
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
# furnished to do so, subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
# copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
# SOFTWARE.
|
|
22
|
+
|
|
23
|
+
from pyedb.configuration.cfg_common import CfgBase
|
|
24
|
+
from pyedb.generic.general_methods import pyedb_function_handler
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class CfgCutout(CfgBase):
|
|
28
|
+
def __init__(self, **kwargs):
|
|
29
|
+
self.signal_list = kwargs.get("signal_list")
|
|
30
|
+
self.reference_list = kwargs.get("reference_list")
|
|
31
|
+
self.extent_type = kwargs.get("extent_type")
|
|
32
|
+
self.expansion_size = kwargs.get("expansion_size")
|
|
33
|
+
self.use_round_corner = kwargs.get("use_round_corner")
|
|
34
|
+
self.output_aedb_path = kwargs.get("output_aedb_path")
|
|
35
|
+
self.open_cutout_at_end = kwargs.get("open_cutout_at_end")
|
|
36
|
+
self.use_pyaedt_cutout = kwargs.get("use_pyaedt_cutout")
|
|
37
|
+
self.number_of_threads = kwargs.get("number_of_threads")
|
|
38
|
+
self.use_pyaedt_extent_computing = kwargs.get("use_pyaedt_extent_computing")
|
|
39
|
+
self.extent_defeature = kwargs.get("extent_defeature")
|
|
40
|
+
self.remove_single_pin_components = kwargs.get("remove_single_pin_components")
|
|
41
|
+
self.custom_extent = kwargs.get("custom_extent")
|
|
42
|
+
self.custom_extent_units = kwargs.get("custom_extent_units")
|
|
43
|
+
self.include_partial_instances = kwargs.get("include_partial_instances")
|
|
44
|
+
self.keep_voids = kwargs.get("keep_voids")
|
|
45
|
+
self.check_terminals = kwargs.get("check_terminals")
|
|
46
|
+
self.include_pingroups = kwargs.get("include_pingroups")
|
|
47
|
+
self.expansion_factor = kwargs.get("expansion_factor")
|
|
48
|
+
self.maximum_iterations = kwargs.get("maximum_iterations")
|
|
49
|
+
self.preserve_components_with_model = kwargs.get("preserve_components_with_model")
|
|
50
|
+
self.simple_pad_check = kwargs.get("simple_pad_check")
|
|
51
|
+
self.keep_lines_as_path = kwargs.get("keep_lines_as_path")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class CfgOperations(CfgBase):
|
|
55
|
+
def __init__(self, pedb, data):
|
|
56
|
+
self._pedb = pedb
|
|
57
|
+
self.op_cutout = CfgCutout(**data["cutout"]) if "cutout" in data else None
|
|
58
|
+
|
|
59
|
+
@pyedb_function_handler
|
|
60
|
+
def apply(self):
|
|
61
|
+
"""Imports operation information from JSON."""
|
|
62
|
+
if self.op_cutout:
|
|
63
|
+
self._pedb.cutout(**self.op_cutout.get_attributes())
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
#
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
# furnished to do so, subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
# copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
# SOFTWARE.
|
|
22
|
+
|
|
23
|
+
from pyedb.configuration.cfg_common import CfgBase
|
|
24
|
+
from pyedb.dotnet.edb_core.definition.package_def import PackageDef
|
|
25
|
+
from pyedb.generic.general_methods import pyedb_function_handler
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class CfgPackage(CfgBase):
|
|
29
|
+
"""Configuration package class."""
|
|
30
|
+
|
|
31
|
+
def __init__(self, **kwargs):
|
|
32
|
+
self.name = kwargs.get("name", None)
|
|
33
|
+
self.component_definition = kwargs.get("component_definition", None)
|
|
34
|
+
self.maximum_power = kwargs.get("maximum_power", None)
|
|
35
|
+
self.therm_cond = kwargs.get("therm_cond", None)
|
|
36
|
+
self.theta_jb = kwargs.get("theta_jb", None)
|
|
37
|
+
self.theta_jc = kwargs.get("theta_jc", None)
|
|
38
|
+
self.height = kwargs.get("height", None)
|
|
39
|
+
self.apply_to_all = kwargs.get("apply_to_all", None)
|
|
40
|
+
self.components = kwargs.get("components", [])
|
|
41
|
+
self.extent_bounding_box = kwargs.get("extent_bounding_box", None)
|
|
42
|
+
self._heatsink = CfgHeatSink(**kwargs["heatsink"]) if "heatsink" in kwargs else None
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def heatsink(self):
|
|
46
|
+
return self._heatsink
|
|
47
|
+
|
|
48
|
+
@heatsink.setter
|
|
49
|
+
def heatsink(self, value):
|
|
50
|
+
self._heatsink = value
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def protected_attributes(self):
|
|
54
|
+
"""Attributes cannot be set to package definition class or don't exist in package definition class."""
|
|
55
|
+
return ["apply_to_all", "components", "extent_bounding_box", "component_definition"]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class CfgHeatSink(CfgBase):
|
|
59
|
+
"""Configuration heat sink class."""
|
|
60
|
+
|
|
61
|
+
def __init__(self, **kwargs):
|
|
62
|
+
self.fin_base_height = kwargs.get("fin_base_height", None)
|
|
63
|
+
self.fin_height = kwargs.get("fin_height", None)
|
|
64
|
+
self.fin_orientation = kwargs.get("fin_orientation", None)
|
|
65
|
+
self.fin_spacing = kwargs.get("fin_spacing", None)
|
|
66
|
+
self.fin_thickness = kwargs.get("fin_thickness", None)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class CfgPackageDefinitions:
|
|
70
|
+
def __init__(self, pedb, data):
|
|
71
|
+
self._pedb = pedb
|
|
72
|
+
self.packages = [CfgPackage(**package) for package in data]
|
|
73
|
+
|
|
74
|
+
def apply(self):
|
|
75
|
+
for pkg in self.packages:
|
|
76
|
+
comp_def_from_db = self._pedb.definitions.component[pkg.component_definition]
|
|
77
|
+
if pkg.name in self._pedb.definitions.package:
|
|
78
|
+
self._pedb.definitions.package[pkg.name].delete()
|
|
79
|
+
|
|
80
|
+
if pkg.extent_bounding_box:
|
|
81
|
+
package_def = PackageDef(self._pedb, name=pkg.name, extent_bounding_box=pkg.extent_bounding_box)
|
|
82
|
+
else:
|
|
83
|
+
package_def = PackageDef(self._pedb, name=pkg.name, component_part_name=pkg.component_definition)
|
|
84
|
+
pkg.set_attributes(package_def)
|
|
85
|
+
|
|
86
|
+
if pkg.heatsink:
|
|
87
|
+
attrs = pkg.heatsink.get_attributes()
|
|
88
|
+
for attr, value in attrs.items():
|
|
89
|
+
package_def.set_heatsink(**attrs)
|
|
90
|
+
|
|
91
|
+
comp_list = dict()
|
|
92
|
+
if pkg.apply_to_all:
|
|
93
|
+
comp_list.update(
|
|
94
|
+
{
|
|
95
|
+
refdes: comp
|
|
96
|
+
for refdes, comp in comp_def_from_db.components.items()
|
|
97
|
+
if refdes not in pkg.components
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
else:
|
|
101
|
+
comp_list.update(
|
|
102
|
+
{refdes: comp for refdes, comp in comp_def_from_db.components.items() if refdes in pkg.components}
|
|
103
|
+
)
|
|
104
|
+
for _, i in comp_list.items():
|
|
105
|
+
i.package_def = pkg.name
|
|
106
|
+
|
|
107
|
+
@pyedb_function_handler
|
|
108
|
+
def get_data_from_db(self):
|
|
109
|
+
package_definitions = []
|
|
110
|
+
|
|
111
|
+
for pkg_name, pkg_obj in self._pedb.definitions.package.items():
|
|
112
|
+
pkg = {}
|
|
113
|
+
pkg_attrs = [i for i in dir(pkg_obj) if not i.startswith("_")]
|
|
114
|
+
pkg_attrs = {i for i in pkg_attrs if i in CfgPackage().__dict__}
|
|
115
|
+
for pkg_attr_name in pkg_attrs:
|
|
116
|
+
pkg[pkg_attr_name] = getattr(pkg_obj, pkg_attr_name)
|
|
117
|
+
|
|
118
|
+
hs_obj = pkg_obj.heatsink
|
|
119
|
+
if hs_obj:
|
|
120
|
+
hs = {}
|
|
121
|
+
hs_attrs = [i for i in dir(hs_obj) if not i.startswith("_")]
|
|
122
|
+
hs_attrs = [i for i in hs_attrs if i in CfgHeatSink().__dict__]
|
|
123
|
+
for hs_attr_name in hs_attrs:
|
|
124
|
+
hs[hs_attr_name] = getattr(hs_obj, hs_attr_name)
|
|
125
|
+
pkg["heatsink"] = hs
|
|
126
|
+
package_definitions.append(pkg)
|
|
127
|
+
|
|
128
|
+
return package_definitions
|