Skip to content

Commit

Permalink
Optimize Edb initialization for die designs (#966)
Browse files Browse the repository at this point in the history
Several times die designs don't have any component defined. The changes
in code are made to reduce the Component initialization time in this
case which significantly reduces the Edb initialization time by ~50%
especially when there are >100k Groups in the layout.

(cherry picked from commit 40cc8f6)

Co-authored-by: skandakotethota <[email protected]>
  • Loading branch information
SMoraisAnsys and skandak-ansys authored Jan 13, 2025
1 parent 7bef7c3 commit fc0c8fa
Showing 1 changed file with 21 additions and 45 deletions.
66 changes: 21 additions & 45 deletions src/pyedb/dotnet/edb_core/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,9 @@ def __getitem__(self, name):

def __init__(self, p_edb):
self._pedb = p_edb
self._cmp = {}
self._res = {}
self._cap = {}
self._ind = {}
self._ios = {}
self._ics = {}
self._others = {}
self.refresh_components()
self._pins = {}
self._comps_by_part = {}
self._init_parts()
self._padstack = EdbPadstacks(self._pedb)

@property
Expand All @@ -132,16 +125,6 @@ def _logger(self):
def _edb(self):
return self._pedb.edb_api

def _init_parts(self):
a = self.instances
a = self.resistors
a = self.ICs
a = self.Others
a = self.inductors
a = self.IOs
a = self.components_by_partname
return True

def _get_edb_value(self, value):
return self._pedb.edb_value(value)

Expand Down Expand Up @@ -205,8 +188,6 @@ def instances(self):
>>> edbapp.components.instances
"""
if not self._cmp:
self.refresh_components()
return self._cmp

@property
Expand Down Expand Up @@ -310,10 +291,29 @@ def export_definition(self, file_path):

def refresh_components(self):
"""Refresh the component dictionary."""
# self._logger.info("Refreshing the Components dictionary.")
self._cmp = {}
self._res = {}
self._ind = {}
self._cap = {}
self._ics = {}
self._ios = {}
self._others = {}
for i in self._pedb.layout.groups:
self._cmp[i.name] = i
if i.type == "Resistor":
self._res[i.name] = i
elif i.type == "Capacitor":
self._cap[i.name] = i
elif i.type == "Inductor":
self._ind[i.name] = i
elif i.type == "IC":
self._ics[i.name] = i
elif i.type == "IO":
self._ios[i.name] = i
elif i.type == "Other":
self._others[i.name] = i
else:
self._logger.warning(f"Unknown component type {i.name} found while refreshing components, will ignore")
return True

@property
Expand All @@ -332,10 +332,6 @@ def resistors(self):
>>> edbapp = Edb("myaedbfolder")
>>> edbapp.components.resistors
"""
self._res = {}
for el, val in self.instances.items():
if val.type == "Resistor":
self._res[el] = val
return self._res

@property
Expand All @@ -354,10 +350,6 @@ def capacitors(self):
>>> edbapp = Edb("myaedbfolder")
>>> edbapp.components.capacitors
"""
self._cap = {}
for el, val in self.instances.items():
if val.type == "Capacitor":
self._cap[el] = val
return self._cap

@property
Expand All @@ -377,10 +369,6 @@ def inductors(self):
>>> edbapp.components.inductors
"""
self._ind = {}
for el, val in self.instances.items():
if val.type == "Inductor":
self._ind[el] = val
return self._ind

@property
Expand All @@ -400,10 +388,6 @@ def ICs(self):
>>> edbapp.components.ICs
"""
self._ics = {}
for el, val in self.instances.items():
if val.type == "IC":
self._ics[el] = val
return self._ics

@property
Expand All @@ -423,10 +407,6 @@ def IOs(self):
>>> edbapp.components.IOs
"""
self._ios = {}
for el, val in self.instances.items():
if val.type == "IO":
self._ios[el] = val
return self._ios

@property
Expand All @@ -446,10 +426,6 @@ def Others(self):
>>> edbapp.components.others
"""
self._others = {}
for el, val in self.instances.items():
if val.type == "Other":
self._others[el] = val
return self._others

@property
Expand Down

0 comments on commit fc0c8fa

Please sign in to comment.