Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

bank/description/AutoCSR: add autocsr_exclude

  • Loading branch information...
commit c82b53f1cd813e20dfc15e77b0611f68a583ae27 1 parent 10212e8
Sébastien Bourdeauducq authored May 08, 2013

Showing 1 changed file with 22 additions and 12 deletions. Show diff stats Hide diff stats

  1. 34  migen/bank/description.py
34  migen/bank/description.py
@@ -96,23 +96,33 @@ def memprefix(prefix, memories):
96 96
 
97 97
 class AutoCSR:
98 98
 	def get_memories(self):
  99
+		try:
  100
+			exclude = self.autocsr_exclude
  101
+		except AttributeError:
  102
+			exclude = {}
99 103
 		r = []
100 104
 		for k, v in self.__dict__.items():
101  
-			if isinstance(v, Memory):
102  
-				r.append(v)
103  
-			elif hasattr(v, "get_memories") and callable(v.get_memories):
104  
-				memories = v.get_memories()
105  
-				memprefix(k + "_", memories)
106  
-				r += memories
  105
+			if k not in exclude:
  106
+				if isinstance(v, Memory):
  107
+					r.append(v)
  108
+				elif hasattr(v, "get_memories") and callable(v.get_memories):
  109
+					memories = v.get_memories()
  110
+					memprefix(k + "_", memories)
  111
+					r += memories
107 112
 		return sorted(r, key=lambda x: x.huid)
108 113
 
109 114
 	def get_csrs(self):
  115
+		try:
  116
+			exclude = self.autocsr_exclude
  117
+		except AttributeError:
  118
+			exclude = {}
110 119
 		r = []
111 120
 		for k, v in self.__dict__.items():
112  
-			if isinstance(v, _CSRBase):
113  
-				r.append(v)
114  
-			elif hasattr(v, "get_csrs") and callable(v.get_csrs):
115  
-				csrs = v.get_csrs()
116  
-				csrprefix(k + "_", csrs)
117  
-				r += csrs
  121
+			if k not in exclude:
  122
+				if isinstance(v, _CSRBase):
  123
+					r.append(v)
  124
+				elif hasattr(v, "get_csrs") and callable(v.get_csrs):
  125
+					csrs = v.get_csrs()
  126
+					csrprefix(k + "_", csrs)
  127
+					r += csrs
118 128
 		return sorted(r, key=lambda x: x.huid)

0 notes on commit c82b53f

Please sign in to comment.
Something went wrong with that request. Please try again.