pyedb 0.38.0__py3-none-any.whl → 0.39.1__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.

Files changed (205) hide show
  1. pyedb/__init__.py +1 -1
  2. pyedb/common/nets.py +53 -139
  3. pyedb/configuration/cfg_components.py +1 -1
  4. pyedb/configuration/cfg_general.py +4 -2
  5. pyedb/configuration/cfg_modeler.py +1 -1
  6. pyedb/configuration/cfg_package_definition.py +1 -1
  7. pyedb/configuration/cfg_padstacks.py +1 -1
  8. pyedb/configuration/cfg_ports_sources.py +56 -23
  9. pyedb/configuration/configuration.py +18 -1
  10. pyedb/dotnet/{application → database}/Variables.py +21 -21
  11. pyedb/dotnet/{edb_core → database}/cell/connectable.py +5 -5
  12. pyedb/dotnet/{edb_core → database}/cell/hierarchy/component.py +11 -11
  13. pyedb/dotnet/{edb_core → database}/cell/hierarchy/hierarchy_obj.py +1 -1
  14. pyedb/dotnet/{edb_core → database}/cell/hierarchy/model.py +1 -1
  15. pyedb/dotnet/{edb_core → database}/cell/layout.py +17 -17
  16. pyedb/dotnet/{edb_core → database}/cell/layout_obj.py +3 -3
  17. pyedb/dotnet/{edb_core → database}/cell/primitive/bondwire.py +1 -1
  18. pyedb/dotnet/{edb_core → database}/cell/primitive/path.py +4 -4
  19. pyedb/dotnet/{edb_core → database}/cell/primitive/primitive.py +14 -14
  20. pyedb/dotnet/{edb_core → database}/cell/terminal/bundle_terminal.py +2 -2
  21. pyedb/dotnet/{edb_core → database}/cell/terminal/edge_terminal.py +4 -4
  22. pyedb/dotnet/{edb_core → database}/cell/terminal/padstack_instance_terminal.py +2 -2
  23. pyedb/dotnet/{edb_core → database}/cell/terminal/pingroup_terminal.py +2 -2
  24. pyedb/dotnet/{edb_core → database}/cell/terminal/point_terminal.py +2 -2
  25. pyedb/dotnet/{edb_core → database}/cell/terminal/terminal.py +11 -11
  26. pyedb/dotnet/{edb_core → database}/cell/voltage_regulator.py +2 -2
  27. pyedb/dotnet/{edb_core → database}/components.py +101 -124
  28. pyedb/dotnet/{edb_core → database}/definition/component_def.py +5 -5
  29. pyedb/dotnet/{edb_core → database}/definition/component_model.py +1 -1
  30. pyedb/dotnet/{edb_core → database}/definition/definition_obj.py +1 -1
  31. pyedb/dotnet/{edb_core → database}/definition/definitions.py +2 -2
  32. pyedb/dotnet/{edb_core → database}/definition/package_def.py +4 -4
  33. pyedb/dotnet/{edb_core → database}/dotnet/database.py +8 -8
  34. pyedb/dotnet/{edb_core → database}/dotnet/primitive.py +9 -9
  35. pyedb/dotnet/{edb_core → database}/edb_data/control_file.py +12 -12
  36. pyedb/dotnet/{edb_core → database}/edb_data/hfss_extent_info.py +7 -7
  37. pyedb/dotnet/{edb_core → database}/edb_data/nets_data.py +10 -13
  38. pyedb/dotnet/{edb_core → database}/edb_data/padstacks_data.py +16 -16
  39. pyedb/dotnet/{edb_core → database}/edb_data/ports.py +4 -4
  40. pyedb/dotnet/{edb_core → database}/edb_data/primitives_data.py +5 -5
  41. pyedb/dotnet/{edb_core → database}/edb_data/raptor_x_simulation_setup_data.py +4 -4
  42. pyedb/dotnet/{edb_core → database}/edb_data/simulation_configuration.py +10 -10
  43. pyedb/dotnet/{edb_core → database}/edb_data/sources.py +4 -4
  44. pyedb/dotnet/{edb_core → database}/edb_data/variables.py +1 -1
  45. pyedb/dotnet/{edb_core → database}/geometry/polygon_data.py +4 -4
  46. pyedb/dotnet/{edb_core → database}/hfss.py +8 -8
  47. pyedb/dotnet/{edb_core → database}/layout_obj_instance.py +1 -1
  48. pyedb/dotnet/{edb_core → database}/layout_validation.py +2 -2
  49. pyedb/dotnet/{edb_core → database}/materials.py +23 -8
  50. pyedb/dotnet/{edb_core → database}/modeler.py +27 -27
  51. pyedb/dotnet/{edb_core → database}/net_class.py +8 -8
  52. pyedb/dotnet/{edb_core → database}/nets.py +12 -12
  53. pyedb/dotnet/{edb_core → database}/padstack.py +15 -15
  54. pyedb/dotnet/{edb_core → database}/sim_setup_data/data/mesh_operation.py +1 -1
  55. pyedb/dotnet/{edb_core → database}/sim_setup_data/data/settings.py +3 -3
  56. pyedb/dotnet/{edb_core → database}/sim_setup_data/data/sim_setup_info.py +2 -2
  57. pyedb/dotnet/{edb_core → database}/sim_setup_data/data/simulation_settings.py +1 -1
  58. pyedb/dotnet/{edb_core → database}/sim_setup_data/data/siw_dc_ir_settings.py +1 -1
  59. pyedb/dotnet/{edb_core → database}/sim_setup_data/data/sweep_data.py +1 -1
  60. pyedb/dotnet/{edb_core → database}/siwave.py +10 -10
  61. pyedb/dotnet/{edb_core → database}/stackup.py +12 -12
  62. pyedb/dotnet/{edb_core → database}/utilities/hfss_simulation_setup.py +15 -15
  63. pyedb/dotnet/{edb_core → database}/utilities/obj_base.py +1 -1
  64. pyedb/dotnet/{edb_core → database}/utilities/simulation_setup.py +3 -3
  65. pyedb/dotnet/{edb_core → database}/utilities/siwave_simulation_setup.py +6 -6
  66. pyedb/dotnet/edb.py +117 -112
  67. pyedb/generic/design_types.py +26 -19
  68. pyedb/generic/general_methods.py +1 -1
  69. pyedb/generic/plot.py +0 -2
  70. pyedb/grpc/database/__init__.py +1 -0
  71. pyedb/grpc/database/components.py +2354 -0
  72. pyedb/grpc/database/control_file.py +1277 -0
  73. pyedb/grpc/database/definition/component_def.py +218 -0
  74. pyedb/grpc/database/definition/component_model.py +39 -0
  75. pyedb/grpc/database/definition/component_pin.py +32 -0
  76. pyedb/grpc/database/definition/materials.py +1207 -0
  77. pyedb/grpc/database/definition/n_port_component_model.py +34 -0
  78. pyedb/grpc/database/definition/package_def.py +227 -0
  79. pyedb/grpc/database/definition/padstack_def.py +842 -0
  80. pyedb/grpc/database/definitions.py +70 -0
  81. pyedb/grpc/database/general.py +43 -0
  82. pyedb/grpc/database/geometry/__init__.py +0 -0
  83. pyedb/grpc/database/geometry/arc_data.py +93 -0
  84. pyedb/grpc/database/geometry/point_3d_data.py +79 -0
  85. pyedb/grpc/database/geometry/point_data.py +30 -0
  86. pyedb/grpc/database/geometry/polygon_data.py +133 -0
  87. pyedb/grpc/database/hfss.py +1279 -0
  88. pyedb/grpc/database/hierarchy/__init__.py +0 -0
  89. pyedb/grpc/database/hierarchy/component.py +1301 -0
  90. pyedb/grpc/database/hierarchy/model.py +31 -0
  91. pyedb/grpc/database/hierarchy/netlist_model.py +30 -0
  92. pyedb/grpc/database/hierarchy/pin_pair_model.py +128 -0
  93. pyedb/grpc/database/hierarchy/pingroup.py +245 -0
  94. pyedb/grpc/database/hierarchy/s_parameter_model.py +33 -0
  95. pyedb/grpc/database/hierarchy/spice_model.py +48 -0
  96. pyedb/grpc/database/layers/__init__.py +0 -0
  97. pyedb/grpc/database/layers/layer.py +57 -0
  98. pyedb/grpc/database/layers/stackup_layer.py +410 -0
  99. pyedb/grpc/database/layout/__init__.py +0 -0
  100. pyedb/grpc/database/layout/cell.py +30 -0
  101. pyedb/grpc/database/layout/layout.py +196 -0
  102. pyedb/grpc/database/layout/voltage_regulator.py +149 -0
  103. pyedb/grpc/database/layout_validation.py +319 -0
  104. pyedb/grpc/database/modeler.py +1468 -0
  105. pyedb/grpc/database/net/__init__.py +0 -0
  106. pyedb/grpc/database/net/differential_pair.py +138 -0
  107. pyedb/grpc/database/net/extended_net.py +340 -0
  108. pyedb/grpc/database/net/net.py +198 -0
  109. pyedb/grpc/database/net/net_class.py +93 -0
  110. pyedb/grpc/database/nets.py +633 -0
  111. pyedb/grpc/database/padstacks.py +1500 -0
  112. pyedb/grpc/database/ports/__init__.py +0 -0
  113. pyedb/grpc/database/ports/ports.py +396 -0
  114. pyedb/grpc/database/primitive/__init__.py +3 -0
  115. pyedb/grpc/database/primitive/bondwire.py +181 -0
  116. pyedb/grpc/database/primitive/circle.py +75 -0
  117. pyedb/grpc/database/primitive/padstack_instance.py +1116 -0
  118. pyedb/grpc/database/primitive/path.py +346 -0
  119. pyedb/grpc/database/primitive/polygon.py +276 -0
  120. pyedb/grpc/database/primitive/primitive.py +739 -0
  121. pyedb/grpc/database/primitive/rectangle.py +146 -0
  122. pyedb/grpc/database/simulation_setup/__init__.py +0 -0
  123. pyedb/grpc/database/simulation_setup/adaptive_frequency.py +33 -0
  124. pyedb/grpc/database/simulation_setup/hfss_advanced_meshing_settings.py +32 -0
  125. pyedb/grpc/database/simulation_setup/hfss_advanced_settings.py +59 -0
  126. pyedb/grpc/database/simulation_setup/hfss_dcr_settings.py +35 -0
  127. pyedb/grpc/database/simulation_setup/hfss_general_settings.py +61 -0
  128. pyedb/grpc/database/simulation_setup/hfss_settings_options.py +78 -0
  129. pyedb/grpc/database/simulation_setup/hfss_simulation_settings.py +118 -0
  130. pyedb/grpc/database/simulation_setup/hfss_simulation_setup.py +355 -0
  131. pyedb/grpc/database/simulation_setup/hfss_solver_settings.py +34 -0
  132. pyedb/grpc/database/simulation_setup/mesh_operation.py +34 -0
  133. pyedb/grpc/database/simulation_setup/raptor_x_advanced_settings.py +34 -0
  134. pyedb/grpc/database/simulation_setup/raptor_x_general_settings.py +33 -0
  135. pyedb/grpc/database/simulation_setup/raptor_x_simulation_settings.py +64 -0
  136. pyedb/grpc/database/simulation_setup/raptor_x_simulation_setup.py +125 -0
  137. pyedb/grpc/database/simulation_setup/siwave_dcir_simulation_setup.py +34 -0
  138. pyedb/grpc/database/simulation_setup/siwave_simulation_setup.py +119 -0
  139. pyedb/grpc/database/simulation_setup/sweep_data.py +32 -0
  140. pyedb/grpc/database/siwave.py +1023 -0
  141. pyedb/grpc/database/source_excitations.py +2572 -0
  142. pyedb/grpc/database/stackup.py +2574 -0
  143. pyedb/grpc/database/terminal/__init__.py +0 -0
  144. pyedb/grpc/database/terminal/bundle_terminal.py +218 -0
  145. pyedb/grpc/database/terminal/edge_terminal.py +51 -0
  146. pyedb/grpc/database/terminal/padstack_instance_terminal.py +171 -0
  147. pyedb/grpc/database/terminal/pingroup_terminal.py +162 -0
  148. pyedb/grpc/database/terminal/point_terminal.py +99 -0
  149. pyedb/grpc/database/terminal/terminal.py +470 -0
  150. pyedb/grpc/database/utility/__init__.py +3 -0
  151. pyedb/grpc/database/utility/constants.py +25 -0
  152. pyedb/grpc/database/utility/heat_sink.py +124 -0
  153. pyedb/grpc/database/utility/hfss_extent_info.py +448 -0
  154. pyedb/grpc/database/utility/layout_statistics.py +277 -0
  155. pyedb/grpc/database/utility/rlc.py +80 -0
  156. pyedb/grpc/database/utility/simulation_configuration.py +3305 -0
  157. pyedb/grpc/database/utility/sources.py +388 -0
  158. pyedb/grpc/database/utility/sweep_data_distribution.py +83 -0
  159. pyedb/grpc/database/utility/xml_control_file.py +1277 -0
  160. pyedb/grpc/edb.py +4152 -0
  161. pyedb/grpc/edb_init.py +481 -0
  162. pyedb/grpc/rpc_session.py +177 -0
  163. pyedb/ipc2581/ecad/cad_data/assembly_drawing.py +3 -2
  164. pyedb/ipc2581/ecad/cad_data/feature.py +4 -3
  165. pyedb/ipc2581/ecad/cad_data/layer_feature.py +32 -20
  166. pyedb/ipc2581/ecad/cad_data/outline.py +3 -2
  167. pyedb/ipc2581/ecad/cad_data/package.py +4 -3
  168. pyedb/ipc2581/ecad/cad_data/path.py +82 -31
  169. pyedb/ipc2581/ecad/cad_data/polygon.py +122 -60
  170. pyedb/ipc2581/ecad/cad_data/profile.py +13 -12
  171. pyedb/ipc2581/ecad/cad_data/step.py +53 -21
  172. pyedb/ipc2581/ipc2581.py +47 -49
  173. pyedb/modeler/geometry_operators.py +1 -1
  174. {pyedb-0.38.0.dist-info → pyedb-0.39.1.dist-info}/METADATA +5 -2
  175. pyedb-0.39.1.dist-info/RECORD +288 -0
  176. pyedb-0.38.0.dist-info/RECORD +0 -195
  177. /pyedb/dotnet/{edb_core → database}/__init__.py +0 -0
  178. /pyedb/dotnet/{application → database/cell}/__init__.py +0 -0
  179. /pyedb/dotnet/{edb_core/cell → database/cell/hierarchy}/__init__.py +0 -0
  180. /pyedb/dotnet/{edb_core → database}/cell/hierarchy/netlist_model.py +0 -0
  181. /pyedb/dotnet/{edb_core → database}/cell/hierarchy/pin_pair_model.py +0 -0
  182. /pyedb/dotnet/{edb_core → database}/cell/hierarchy/s_parameter_model.py +0 -0
  183. /pyedb/dotnet/{edb_core → database}/cell/hierarchy/spice_model.py +0 -0
  184. /pyedb/dotnet/{edb_core → database}/cell/primitive/__init__.py +0 -0
  185. /pyedb/dotnet/{edb_core/cell/hierarchy → database/cell/terminal}/__init__.py +0 -0
  186. /pyedb/dotnet/{edb_core/cell/terminal → database/definition}/__init__.py +0 -0
  187. /pyedb/dotnet/{edb_core/definition → database/dotnet}/__init__.py +0 -0
  188. /pyedb/dotnet/{edb_core/dotnet → database/edb_data}/__init__.py +0 -0
  189. /pyedb/dotnet/{edb_core → database}/edb_data/design_options.py +0 -0
  190. /pyedb/dotnet/{edb_core → database}/edb_data/edbvalue.py +0 -0
  191. /pyedb/dotnet/{edb_core → database}/edb_data/layer_data.py +0 -0
  192. /pyedb/dotnet/{edb_core → database}/edb_data/utilities.py +0 -0
  193. /pyedb/dotnet/{edb_core → database}/general.py +0 -0
  194. /pyedb/dotnet/{edb_core/edb_data → database/geometry}/__init__.py +0 -0
  195. /pyedb/dotnet/{edb_core → database}/geometry/point_data.py +0 -0
  196. /pyedb/dotnet/{edb_core → database}/sim_setup_data/__init__.py +0 -0
  197. /pyedb/dotnet/{edb_core → database}/sim_setup_data/data/__init__.py +0 -0
  198. /pyedb/dotnet/{edb_core → database}/sim_setup_data/data/adaptive_frequency_data.py +0 -0
  199. /pyedb/dotnet/{edb_core/geometry → database/sim_setup_data/io}/__init__.py +0 -0
  200. /pyedb/dotnet/{edb_core → database}/sim_setup_data/io/siwave.py +0 -0
  201. /pyedb/dotnet/{edb_core → database}/utilities/__init__.py +0 -0
  202. /pyedb/dotnet/{edb_core → database}/utilities/heatsink.py +0 -0
  203. /pyedb/{dotnet/edb_core/sim_setup_data/io → grpc/database/definition}/__init__.py +0 -0
  204. {pyedb-0.38.0.dist-info → pyedb-0.39.1.dist-info}/LICENSE +0 -0
  205. {pyedb-0.38.0.dist-info → pyedb-0.39.1.dist-info}/WHEEL +0 -0
File without changes
@@ -0,0 +1,138 @@
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
+ import re
25
+
26
+ from ansys.edb.core.net.differential_pair import (
27
+ DifferentialPair as GrpcDifferentialPair,
28
+ )
29
+
30
+ from pyedb.grpc.database.net.net import Net
31
+
32
+
33
+ class DifferentialPairs:
34
+ def __init__(self, pedb):
35
+ self._pedb = pedb
36
+
37
+ @property
38
+ def items(self):
39
+ """Extended nets.
40
+
41
+ Returns
42
+ -------
43
+ dict[str, :class:`pyedb.dotnet.database.edb_data.nets_data.EDBDifferentialPairData`]
44
+ Dictionary of extended nets.
45
+ """
46
+ diff_pairs = {}
47
+ for diff_pair in self._pedb.layout.differential_pairs:
48
+ diff_pairs[diff_pair.name] = DifferentialPair(self._pedb, diff_pair)
49
+ return diff_pairs
50
+
51
+ def create(self, name, net_p, net_n):
52
+ # type: (str, str, str) -> DifferentialPair
53
+ """
54
+
55
+ Parameters
56
+ ----------
57
+ name : str
58
+ Name of the differential pair.
59
+ net_p : str
60
+ Name of the positive net.
61
+ net_n : str
62
+ Name of the negative net.
63
+
64
+ Returns
65
+ -------
66
+ :class:`pyedb.dotnet.database.edb_data.nets_data.EDBDifferentialPairData`
67
+ """
68
+ if name in self.items:
69
+ self._pedb.logger.error("{} already exists.".format(name))
70
+ return False
71
+ GrpcDifferentialPair.create(layout=self._pedb.layout, name=name, pos_net=net_p, neg_net=net_n)
72
+ return self.items[name]
73
+
74
+ def auto_identify(self, positive_differentiator="_P", negative_differentiator="_N"):
75
+ """Auto identify differential pairs by naming conversion.
76
+
77
+ Parameters
78
+ ----------
79
+ positive_differentiator: str, optional
80
+ Differentiator of the positive net. The default is ``"_P"``.
81
+ negative_differentiator: str, optional
82
+ Differentiator of the negative net. The default is ``"_N"``.
83
+
84
+ Returns
85
+ -------
86
+ list
87
+ A list containing identified differential pair names.
88
+ Examples
89
+ --------
90
+ >>> from pyedb import Edb
91
+ >>> edbapp = Edb("myaedbfolder", edbversion="2023.1")
92
+ >>> edb_nets = edbapp.differential_pairs.auto_identify()
93
+ """
94
+ nets = self._pedb.nets.nets
95
+ pos_net = []
96
+ neg_net = []
97
+ for name, _ in nets.items():
98
+ if name.endswith(positive_differentiator):
99
+ pos_net.append(name)
100
+ elif name.endswith(negative_differentiator):
101
+ neg_net.append(name)
102
+ else:
103
+ pass
104
+
105
+ temp = []
106
+ for p in pos_net:
107
+ pattern_p = r"^(.+){}$".format(positive_differentiator)
108
+ match_p = re.findall(pattern_p, p)[0]
109
+
110
+ for n in neg_net:
111
+ pattern_n = r"^(.+){}$".format(negative_differentiator)
112
+ match_n = re.findall(pattern_n, n)[0]
113
+
114
+ if match_p == match_n:
115
+ diff_name = "DIFF_{}".format(match_p)
116
+ self.create(diff_name, p, n)
117
+ temp.append(diff_name)
118
+ return temp
119
+
120
+
121
+ class DifferentialPair(GrpcDifferentialPair):
122
+ """Manages EDB functionalities for a primitive.
123
+ It inherits EDB object properties.
124
+ """
125
+
126
+ def __init__(self, pedb, edb_object):
127
+ super().__init__(edb_object.msg)
128
+ self._pedb = pedb
129
+
130
+ @property
131
+ def positive_net(self):
132
+ """Positive Net."""
133
+ return Net(self._pedb, super().positive_net)
134
+
135
+ @property
136
+ def negative_net(self):
137
+ """Negative Net."""
138
+ return Net(self._pedb, super().negative_net)
@@ -0,0 +1,340 @@
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 ansys.edb.core.net.extended_net import ExtendedNet as GrpcExtendedNet
24
+
25
+ from pyedb.grpc.database.net.net import Net
26
+
27
+
28
+ class ExtendedNets:
29
+ def __init__(self, pedb):
30
+ self._pedb = pedb
31
+
32
+ @property
33
+ def items(self):
34
+ """Extended nets.
35
+
36
+ Returns
37
+ -------
38
+ Dict[str, :class:`ExtendedNet <pyedb.grpc.database.net.extended_net.ExtendedNet>`]
39
+ Dictionary of extended nets.
40
+ """
41
+ nets = {}
42
+ for extended_net in self._pedb.layout.extended_nets:
43
+ nets[extended_net.name] = ExtendedNet(self._pedb, extended_net)
44
+ return nets
45
+
46
+ def create(self, name, net):
47
+ # type: (str, str|list)->ExtendedNet
48
+ """Create a new Extended net.
49
+
50
+ Parameters
51
+ ----------
52
+ name : str
53
+ Name of the extended net.
54
+ net : str, list
55
+ Name of the nets to be added into this extended net.
56
+
57
+ Returns
58
+ -------
59
+ :class:`ExtendedNet <pyedb.grpc.database.net.extended_net.ExtendedNet>`
60
+ Created ExtendedNet object.
61
+ """
62
+ if name in self.items:
63
+ self._pedb.logger.error("{} already exists.".format(name))
64
+ return False
65
+ extended_net = GrpcExtendedNet.create(self._pedb.layout, name)
66
+ if isinstance(net, str):
67
+ net = [net]
68
+ for i in net:
69
+ extended_net.add_net(self._pedb.nets.nets[i])
70
+ return self.items[name]
71
+
72
+ def auto_identify_signal(self, resistor_below=10, inductor_below=1, capacitor_above=1e-9, exception_list=None):
73
+ # type: (int | float, int | float, int |float, list) -> list
74
+ """Get extended signal net and associated components.
75
+
76
+ Parameters
77
+ ----------
78
+ resistor_below : int, float, optional
79
+ Threshold for the resistor value. Search the extended net across resistors that
80
+ have a value lower than the threshold.
81
+ inductor_below : int, float, optional
82
+ Threshold for the inductor value. Search the extended net across inductances
83
+ that have a value lower than the threshold.
84
+ capacitor_above : int, float, optional
85
+ Threshold for the capacitor value. Search the extended net across capacitors
86
+ that have a value higher than the threshold.
87
+ exception_list : list, optional
88
+ List of components to bypass when performing threshold checks. Components
89
+ in the list are considered as serial components. The default is ``None``.
90
+
91
+ Returns
92
+ -------
93
+ List[:class:`ExtendedNet <pyedb.grpc.database.net.extended_net.ExtendedNet>`]
94
+ List of all extended nets.
95
+
96
+ Examples
97
+ --------
98
+ >>> from pyedb import Edb
99
+ >>> app = Edb()
100
+ >>> app.extended_nets.auto_identify_signal()
101
+ """
102
+ return self.generate_extended_nets(resistor_below, inductor_below, capacitor_above, exception_list, True, True)
103
+
104
+ def auto_identify_power(self, resistor_below=10, inductor_below=1, capacitor_above=1, exception_list=None):
105
+ # type: (int | float, int | float, int |float, list) -> list
106
+ """Get all extended power nets and their associated components.
107
+
108
+ Parameters
109
+ ----------
110
+ resistor_below : int, float, optional
111
+ Threshold for the resistor value. Search the extended net across resistors that
112
+ have a value lower than the threshold.
113
+ inductor_below : int, float, optional
114
+ Threshold for the inductor value. Search the extended net across inductances that
115
+ have a value lower than the threshold.
116
+ capacitor_above : int, float, optional
117
+ Threshold for the capacitor value. Search the extended net across capacitors that
118
+ have a value higher than the threshold.
119
+ exception_list : list, optional
120
+ List of components to bypass when performing threshold checks. Components
121
+ in the list are considered as serial components. The default is ``None``.
122
+
123
+ Returns
124
+ -------
125
+ List[:class:`ExtendedNet <pyedb.grpc.database.net.extended_net.ExtendedNet>`]
126
+ List of all extended nets and their associated components.
127
+
128
+ Examples
129
+ --------
130
+ >>> from pyedb import Edb
131
+ >>> app = Edb()
132
+ >>> app.extended_nets.auto_identify_power()
133
+ """
134
+ return self.generate_extended_nets(resistor_below, inductor_below, capacitor_above, exception_list, True, True)
135
+
136
+ def generate_extended_nets(
137
+ self,
138
+ resistor_below=10,
139
+ inductor_below=1,
140
+ capacitor_above=1,
141
+ exception_list=None,
142
+ include_signal=True,
143
+ include_power=True,
144
+ ):
145
+ # type: (int | float, int | float, int |float, list, bool, bool) -> list
146
+ """Get extended net and associated components.
147
+
148
+ Parameters
149
+ ----------
150
+ resistor_below : int, float, optional
151
+ Threshold of resistor value. Search extended net across resistors which has value lower than the threshold.
152
+ inductor_below : int, float, optional
153
+ Threshold of inductor value. Search extended net across inductances which has value lower than the
154
+ threshold.
155
+ capacitor_above : int, float, optional
156
+ Threshold of capacitor value. Search extended net across capacitors which has value higher than the
157
+ threshold.
158
+ exception_list : list, optional
159
+ List of components to bypass when performing threshold checks. Components
160
+ in the list are considered as serial components. The default is ``None``.
161
+ include_signal : str, optional
162
+ Whether to generate extended signal nets. The default is ``True``.
163
+ include_power : str, optional
164
+ Whether to generate extended power nets. The default is ``True``.
165
+
166
+ Returns
167
+ -------
168
+ List[:class:`ExtendedNet <pyedb.grpc.database.net.extended_net.ExtendedNet>`]
169
+ List of all extended nets.
170
+
171
+ Examples
172
+ --------
173
+ >>> from pyedb import Edb
174
+ >>> app = Edb()
175
+ >>> app.nets.get_extended_nets()
176
+ """
177
+ if exception_list is None:
178
+ exception_list = []
179
+ _extended_nets = []
180
+ _nets = self._pedb.nets.nets
181
+ all_nets = list(_nets.keys())[:]
182
+ net_dicts = (
183
+ self._pedb.nets._comps_by_nets_dict
184
+ if self._pedb.nets._comps_by_nets_dict
185
+ else (self._pedb.nets.components_by_nets)
186
+ )
187
+ comp_dict = (
188
+ self._pedb.nets._nets_by_comp_dict
189
+ if self._pedb.nets._nets_by_comp_dict
190
+ else (self._pedb.nets.nets_by_components)
191
+ )
192
+
193
+ def get_net_list(net_name, _net_list):
194
+ comps = []
195
+ if net_name in net_dicts:
196
+ comps = net_dicts[net_name]
197
+
198
+ for vals in comps:
199
+ refdes = vals
200
+ cmp = self._pedb.components.instances[refdes]
201
+ if cmp.type not in ["inductor", "resistor", "capacitor"]:
202
+ continue
203
+ if not cmp.enabled:
204
+ continue
205
+ val_value = cmp.rlc_values
206
+ if refdes in exception_list:
207
+ pass
208
+ elif cmp.type == "inductor" and val_value[1] < inductor_below:
209
+ pass
210
+ elif cmp.type == "resistor" and val_value[0] < resistor_below:
211
+ pass
212
+ elif cmp.type == "capacitor" and val_value[2] > capacitor_above:
213
+ pass
214
+ else:
215
+ continue
216
+ for net in comp_dict[refdes]:
217
+ if net not in _net_list:
218
+ _net_list.append(net)
219
+ get_net_list(net, _net_list)
220
+
221
+ while len(all_nets) > 0:
222
+ new_ext = [all_nets[0]]
223
+ get_net_list(new_ext[0], new_ext)
224
+ all_nets = [i for i in all_nets if i not in new_ext]
225
+ _extended_nets.append(new_ext)
226
+
227
+ if len(new_ext) > 1:
228
+ i = new_ext[0]
229
+ for i in new_ext:
230
+ if not i.lower().startswith("unnamed"):
231
+ break
232
+
233
+ is_power = False
234
+ for i in new_ext:
235
+ is_power = is_power or _nets[i].is_power_ground
236
+
237
+ if is_power:
238
+ if include_power:
239
+ ext_net = ExtendedNet.create(self._pedb.layout, i)
240
+ ext_net.add_net(self._pedb.nets.nets[i])
241
+ for net in new_ext:
242
+ ext_net.add_net(self._pedb.nets.nets[net])
243
+ else: # pragma: no cover
244
+ pass
245
+ else:
246
+ if include_signal:
247
+ ext_net = ExtendedNet.create(self._pedb.layout, i)
248
+ ext_net.add_net(self._pedb.nets.nets[i])
249
+ for net in new_ext:
250
+ ext_net.add_net(self._pedb.nets.nets[net])
251
+ else: # pragma: no cover
252
+ pass
253
+
254
+ return _extended_nets
255
+
256
+
257
+ class ExtendedNet(GrpcExtendedNet):
258
+ """Manages EDB functionalities for a primitives.
259
+ It Inherits EDB Object properties.
260
+ """
261
+
262
+ def __init__(self, pedb, edb_object):
263
+ super().__init__(edb_object.msg)
264
+ self._pedb = pedb
265
+
266
+ @property
267
+ def nets(self):
268
+ """Nets dictionary.
269
+
270
+ Returns
271
+ -------
272
+ Dict[str, :class:`Net <pyedb.grpc.database.net.net.Net>`]
273
+ Dict[net name, Net object].
274
+ """
275
+ return {net.name: Net(self._pedb, net) for net in super().nets}
276
+
277
+ @property
278
+ def components(self):
279
+ """Dictionary of components.
280
+
281
+ Returns
282
+ -------
283
+ Dict[str, :class:`Component <pyedb.grpc.database.hierarchy.component.Component>`].
284
+ Dict[net name, Component object].
285
+ """
286
+ comps = {}
287
+ for _, obj in self.nets.items():
288
+ comps.update(obj.components)
289
+ return comps
290
+
291
+ @property
292
+ def rlc(self):
293
+ """Dictionary of RLC components.
294
+
295
+ Returns
296
+ -------
297
+ Dict[str, :class:`Component <pyedb.grpc.database.hierarchy.component.Component>`].
298
+ Dict[net name, Component object].
299
+ """
300
+ return {
301
+ name: comp for name, comp in self.components.items() if comp.type in ["inductor", "resistor", "capacitor"]
302
+ }
303
+
304
+ @property
305
+ def serial_rlc(self):
306
+ """Dictionary of serial RLC components.
307
+
308
+ Returns
309
+ -------
310
+ Dict[str, :class:`Component <pyedb.grpc.database.hierarchy.component.Component>`].
311
+ Dict[net name, Component object].
312
+
313
+ """
314
+ res = {}
315
+ nets = self.nets
316
+ for comp_name, comp_obj in self.components.items():
317
+ if comp_obj.type not in ["resistor", "inductor", "capacitor"]:
318
+ continue
319
+ if set(list(nets.keys())).issubset(comp_obj.nets):
320
+ res[comp_name] = comp_obj
321
+ return res
322
+
323
+ @property
324
+ def shunt_rlc(self):
325
+ """Dictionary of shunt RLC components.
326
+
327
+ Returns
328
+ -------
329
+ Dict[str, :class:`Component <pyedb.grpc.database.hierarchy.component.Component>`].
330
+ Dict[net name, Component object].
331
+
332
+ """
333
+ res = {}
334
+ nets = self.nets
335
+ for comp_name, comp_obj in self.components.items():
336
+ if comp_obj.type not in ["resistor", "inductor", "capacitor"]:
337
+ continue
338
+ if not set(list(nets.keys())).issubset(comp_obj.nets):
339
+ res[comp_name] = comp_obj
340
+ return res
@@ -0,0 +1,198 @@
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 ansys.edb.core.net.net import Net as GrpcNet
24
+ from ansys.edb.core.primitive.primitive import PrimitiveType as GrpcPrimitiveType
25
+
26
+ from pyedb.grpc.database.primitive.bondwire import Bondwire
27
+ from pyedb.grpc.database.primitive.circle import Circle
28
+ from pyedb.grpc.database.primitive.padstack_instance import PadstackInstance
29
+ from pyedb.grpc.database.primitive.path import Path
30
+ from pyedb.grpc.database.primitive.polygon import Polygon
31
+ from pyedb.grpc.database.primitive.rectangle import Rectangle
32
+
33
+
34
+ class Net(GrpcNet):
35
+ """Manages EDB functionalities for a primitives.
36
+ It Inherits EDB Object properties.
37
+
38
+ Examples
39
+ --------
40
+ >>> from pyedb import Edb
41
+ >>> edb = Edb(myedb, edbversion="2021.2")
42
+ >>> edb_net = edb.nets.nets["GND"]
43
+ >>> edb_net.name # Class Property
44
+ >>> edb_net.name # EDB Object Property
45
+ """
46
+
47
+ def __init__(self, pedb, raw_net):
48
+ super().__init__(raw_net.msg)
49
+ self._pedb = pedb
50
+ self._core_components = pedb.components
51
+ self._core_primitive = pedb.modeler
52
+ self._edb_object = raw_net
53
+
54
+ @property
55
+ def primitives(self):
56
+ """Primitives that belongs to the net.
57
+
58
+ Returns
59
+ -------
60
+ List[:class:`Primitive <pyedb.grpc.database.primitive.primitive.Primitive>`].
61
+ List of Primitive object.
62
+
63
+ """
64
+ primitives = []
65
+ for primitive in super().primitives:
66
+ if primitive.primitive_type == GrpcPrimitiveType.PATH:
67
+ primitives.append(Path(self._pedb, primitive))
68
+ elif primitive.primitive_type == GrpcPrimitiveType.POLYGON:
69
+ primitives.append(Polygon(self._pedb, primitive))
70
+ elif primitive.primitive_type == GrpcPrimitiveType.CIRCLE:
71
+ primitives.append(Circle(self._pedb, primitive))
72
+ elif primitive.primitive_type == GrpcPrimitiveType.RECTANGLE:
73
+ primitives.append(Rectangle(self._pedb, primitive))
74
+ elif primitive.primitive_type == GrpcPrimitiveType.BONDWIRE:
75
+ primitives.append(Bondwire(self._pedb, primitive))
76
+ return primitives
77
+
78
+ @property
79
+ def padstack_instances(self):
80
+ """Padstack instance which belong to net.
81
+
82
+ Returns
83
+ -------
84
+ List[:class:`PadstackInstance <pyedb.grpc.database.primitive.padstack_instance.PadstackInstance>`]
85
+ LIst of PadstackInstance object.
86
+
87
+ """
88
+ return [PadstackInstance(self._pedb, i) for i in super().padstack_instances]
89
+
90
+ @property
91
+ def components(self):
92
+ """Components connected to net.
93
+
94
+ Returns
95
+ -------
96
+ Dict[str, :class:`Component <pyedb.grpc.database.hierarchy.component.Component>`]
97
+ """
98
+ components = {}
99
+ for padstack_instance in self.padstack_instances:
100
+ component = padstack_instance.component
101
+ if component:
102
+ try:
103
+ components[component.name] = component
104
+ except:
105
+ pass
106
+ return components
107
+
108
+ def find_dc_short(self, fix=False):
109
+ """Find DC-shorted nets.
110
+
111
+ Parameters
112
+ ----------
113
+ fix : bool, optional
114
+ If `True`, rename all the nets. (default)
115
+ If `False`, only report dc shorts.
116
+
117
+ Returns
118
+ -------
119
+ List[List[str, str]]
120
+ [[net name, net name]].
121
+ """
122
+ return self._pedb.layout_validation.dc_shorts(self.name, fix)
123
+
124
+ def plot(
125
+ self,
126
+ layers=None,
127
+ show_legend=True,
128
+ save_plot=None,
129
+ outline=None,
130
+ size=(2000, 1000),
131
+ show=True,
132
+ ):
133
+ """Plot a net to Matplotlib 2D chart.
134
+
135
+ Parameters
136
+ ----------
137
+ layers : str, list, optional
138
+ Name of the layers to include in the plot. If `None` all the signal layers will be considered.
139
+ show_legend : bool, optional
140
+ If `True` the legend is shown in the plot. (default)
141
+ If `False` the legend is not shown.
142
+ save_plot : str, optional
143
+ If a path is specified the plot will be saved in this location.
144
+ If ``save_plot`` is provided, the ``show`` parameter is ignored.
145
+ outline : list, optional
146
+ List of points of the outline to plot.
147
+ size : tuple, optional
148
+ Image size in pixel (width, height).
149
+ show : bool, optional
150
+ Whether to show the plot or not. Default is `True`.
151
+ """
152
+
153
+ self._pedb.nets.plot(
154
+ self.name,
155
+ layers=layers,
156
+ show_legend=show_legend,
157
+ save_plot=save_plot,
158
+ outline=outline,
159
+ size=size,
160
+ show=show,
161
+ plot_components=True,
162
+ plot_vias=True,
163
+ )
164
+
165
+ def get_smallest_trace_width(self):
166
+ """Retrieve the smallest trace width from paths.
167
+
168
+ Returns
169
+ -------
170
+ float
171
+ Trace smallest width.
172
+ """
173
+
174
+ current_value = 1e10
175
+ paths = [prim for prim in self.primitives if prim.primitive_type == GrpcPrimitiveType.PATH]
176
+ for path in paths:
177
+ if path.width < current_value:
178
+ current_value = path.width
179
+ return current_value
180
+
181
+ @property
182
+ def extended_net(self):
183
+ """Get extended net and associated components.
184
+
185
+ Returns
186
+ -------
187
+ :class:`ExtendedNet <pyedb.grpc.database.net.extended_net.ExtendedNet>`
188
+
189
+ Examples
190
+ --------
191
+ >>> from pyedb import Edb
192
+ >>> app = Edb()
193
+ >>> app.nets["BST_V3P3_S5"].extended_net
194
+ """
195
+ if self.name in self._pedb.extended_nets.items:
196
+ return self._pedb.extended_nets.items[self.name]
197
+ else:
198
+ return None