interconnect/csr_bus: Fix build with custom get_csrs/get_constants from cores.

This commit is contained in:
Florent Kermarrec 2022-10-21 22:01:34 +02:00
parent d30f780a87
commit 76d3a77cf3
1 changed files with 5 additions and 3 deletions

View File

@ -226,7 +226,8 @@ class CSRBankArray(Module):
# ---------------------
csrs = []
if hasattr(obj, "get_csrs"):
csrs = obj.get_csrs(sort=True)
if "sort" in obj.get_csrs.__code__.co_varnames:
csrs = obj.get_csrs(sort=True)
# Collect CSR Memories.
# ---------------------
@ -252,8 +253,9 @@ class CSRBankArray(Module):
# Collect CSR Constants.
# ----------------------
if hasattr(obj, "get_constants"):
for constant in obj.get_constants(sort=True):
self.constants.append((name, constant))
if "sort" in obj.get_constants.__code__.co_varnames:
for constant in obj.get_constants(sort=True):
self.constants.append((name, constant))
# Create CSRBank with CSRs found.
# -------------------------------