mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
soc/interconnect/csr: Replace level with sort and fix targets compilation.
This commit is contained in:
parent
14b2829a5f
commit
096f2184e6
2 changed files with 7 additions and 8 deletions
|
@ -525,7 +525,7 @@ def _sort_gathered_items(items):
|
|||
return sorted_items
|
||||
|
||||
def _make_gatherer(method, cls, prefix_cb):
|
||||
def gatherer(self, level=0):
|
||||
def gatherer(self, sort=False):
|
||||
try:
|
||||
exclude = self.autocsr_exclude
|
||||
except AttributeError:
|
||||
|
@ -540,13 +540,12 @@ def _make_gatherer(method, cls, prefix_cb):
|
|||
if isinstance(v, cls):
|
||||
r.append(v)
|
||||
elif hasattr(v, method) and callable(getattr(v, method)):
|
||||
items = getattr(v, method)(level=level+1)
|
||||
items = getattr(v, method)()
|
||||
prefix_cb(k + "_", items, prefixed)
|
||||
r += items
|
||||
if level == 0:
|
||||
return _sort_gathered_items(r)
|
||||
else:
|
||||
return r
|
||||
if sort:
|
||||
r = _sort_gathered_items(r)
|
||||
return r
|
||||
return gatherer
|
||||
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ class CSRBankArray(Module):
|
|||
# ---------------------
|
||||
csrs = []
|
||||
if hasattr(obj, "get_csrs"):
|
||||
csrs = obj.get_csrs()
|
||||
csrs = obj.get_csrs(sort=True)
|
||||
|
||||
# Collect CSR Memories.
|
||||
# ---------------------
|
||||
|
@ -252,7 +252,7 @@ class CSRBankArray(Module):
|
|||
# Collect CSR Constants.
|
||||
# ----------------------
|
||||
if hasattr(obj, "get_constants"):
|
||||
for constant in obj.get_constants():
|
||||
for constant in obj.get_constants(sort=True):
|
||||
self.constants.append((name, constant))
|
||||
|
||||
# Create CSRBank with CSRs found.
|
||||
|
|
Loading…
Reference in a new issue