Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REFACTOR: Optimize Edb initialization for die designs #966

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading