interconnect/csr: Only sort gathered items at Module level.
This commit is contained in:
parent
a57f0640cc
commit
a60a51c52f
|
@ -517,6 +517,7 @@ def _sort_gathered_items(items):
|
||||||
if sorted_items[i] is None:
|
if sorted_items[i] is None:
|
||||||
sorted_items[i] = CSR(name=f"reserved{i}")
|
sorted_items[i] = CSR(name=f"reserved{i}")
|
||||||
|
|
||||||
|
|
||||||
# Verify all locations are filled.
|
# Verify all locations are filled.
|
||||||
assert None not in sorted_items
|
assert None not in sorted_items
|
||||||
|
|
||||||
|
@ -524,7 +525,7 @@ def _sort_gathered_items(items):
|
||||||
return sorted_items
|
return sorted_items
|
||||||
|
|
||||||
def _make_gatherer(method, cls, prefix_cb):
|
def _make_gatherer(method, cls, prefix_cb):
|
||||||
def gatherer(self):
|
def gatherer(self, level=0):
|
||||||
try:
|
try:
|
||||||
exclude = self.autocsr_exclude
|
exclude = self.autocsr_exclude
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -539,10 +540,13 @@ def _make_gatherer(method, cls, prefix_cb):
|
||||||
if isinstance(v, cls):
|
if isinstance(v, cls):
|
||||||
r.append(v)
|
r.append(v)
|
||||||
elif hasattr(v, method) and callable(getattr(v, method)):
|
elif hasattr(v, method) and callable(getattr(v, method)):
|
||||||
items = getattr(v, method)()
|
items = getattr(v, method)(level=level+1)
|
||||||
prefix_cb(k + "_", items, prefixed)
|
prefix_cb(k + "_", items, prefixed)
|
||||||
r += items
|
r += items
|
||||||
|
if level == 0:
|
||||||
return _sort_gathered_items(r)
|
return _sort_gathered_items(r)
|
||||||
|
else:
|
||||||
|
return r
|
||||||
return gatherer
|
return gatherer
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue