bank/description/AutoCSR: add autocsr_exclude

This commit is contained in:
Sebastien Bourdeauducq 2013-05-08 20:58:57 +02:00
parent 10212e85e7
commit c82b53f1cd
1 changed files with 22 additions and 12 deletions

View File

@ -96,8 +96,13 @@ def memprefix(prefix, memories):
class AutoCSR:
def get_memories(self):
try:
exclude = self.autocsr_exclude
except AttributeError:
exclude = {}
r = []
for k, v in self.__dict__.items():
if k not in exclude:
if isinstance(v, Memory):
r.append(v)
elif hasattr(v, "get_memories") and callable(v.get_memories):
@ -107,8 +112,13 @@ class AutoCSR:
return sorted(r, key=lambda x: x.huid)
def get_csrs(self):
try:
exclude = self.autocsr_exclude
except AttributeError:
exclude = {}
r = []
for k, v in self.__dict__.items():
if k not in exclude:
if isinstance(v, _CSRBase):
r.append(v)
elif hasattr(v, "get_csrs") and callable(v.get_csrs):