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
|
return sorted_items
|
||||||
|
|
||||||
def _make_gatherer(method, cls, prefix_cb):
|
def _make_gatherer(method, cls, prefix_cb):
|
||||||
def gatherer(self, level=0):
|
def gatherer(self, sort=False):
|
||||||
try:
|
try:
|
||||||
exclude = self.autocsr_exclude
|
exclude = self.autocsr_exclude
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -540,12 +540,11 @@ 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)(level=level+1)
|
items = getattr(v, method)()
|
||||||
prefix_cb(k + "_", items, prefixed)
|
prefix_cb(k + "_", items, prefixed)
|
||||||
r += items
|
r += items
|
||||||
if level == 0:
|
if sort:
|
||||||
return _sort_gathered_items(r)
|
r = _sort_gathered_items(r)
|
||||||
else:
|
|
||||||
return r
|
return r
|
||||||
return gatherer
|
return gatherer
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ class CSRBankArray(Module):
|
||||||
# ---------------------
|
# ---------------------
|
||||||
csrs = []
|
csrs = []
|
||||||
if hasattr(obj, "get_csrs"):
|
if hasattr(obj, "get_csrs"):
|
||||||
csrs = obj.get_csrs()
|
csrs = obj.get_csrs(sort=True)
|
||||||
|
|
||||||
# Collect CSR Memories.
|
# Collect CSR Memories.
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
@ -252,7 +252,7 @@ class CSRBankArray(Module):
|
||||||
# Collect CSR Constants.
|
# Collect CSR Constants.
|
||||||
# ----------------------
|
# ----------------------
|
||||||
if hasattr(obj, "get_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))
|
self.constants.append((name, constant))
|
||||||
|
|
||||||
# Create CSRBank with CSRs found.
|
# Create CSRBank with CSRs found.
|
||||||
|
|
Loading…
Reference in a new issue