Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bank/description/AutoCSR: add autocsr_exclude

  • Loading branch information...
commit c82b53f1cd813e20dfc15e77b0611f68a583ae27 1 parent 10212e8
@sbourdeauducq sbourdeauducq authored
Showing with 22 additions and 12 deletions.
  1. +22 −12 migen/bank/description.py
View
34 migen/bank/description.py
@@ -96,23 +96,33 @@ 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 isinstance(v, Memory):
- r.append(v)
- elif hasattr(v, "get_memories") and callable(v.get_memories):
- memories = v.get_memories()
- memprefix(k + "_", memories)
- r += memories
+ if k not in exclude:
+ if isinstance(v, Memory):
+ r.append(v)
+ elif hasattr(v, "get_memories") and callable(v.get_memories):
+ memories = v.get_memories()
+ memprefix(k + "_", memories)
+ r += memories
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 isinstance(v, _CSRBase):
- r.append(v)
- elif hasattr(v, "get_csrs") and callable(v.get_csrs):
- csrs = v.get_csrs()
- csrprefix(k + "_", csrs)
- r += csrs
+ if k not in exclude:
+ if isinstance(v, _CSRBase):
+ r.append(v)
+ elif hasattr(v, "get_csrs") and callable(v.get_csrs):
+ csrs = v.get_csrs()
+ csrprefix(k + "_", csrs)
+ r += csrs
return sorted(r, key=lambda x: x.huid)
Please sign in to comment.
Something went wrong with that request. Please try again.