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,6 +226,7 @@ class CSRBankArray(Module):
# --------------------- # ---------------------
csrs = [] csrs = []
if hasattr(obj, "get_csrs"): if hasattr(obj, "get_csrs"):
if "sort" in obj.get_csrs.__code__.co_varnames:
csrs = obj.get_csrs(sort=True) csrs = obj.get_csrs(sort=True)
# Collect CSR Memories. # Collect CSR Memories.
@ -252,6 +253,7 @@ class CSRBankArray(Module):
# Collect CSR Constants. # Collect CSR Constants.
# ---------------------- # ----------------------
if hasattr(obj, "get_constants"): if hasattr(obj, "get_constants"):
if "sort" in obj.get_constants.__code__.co_varnames:
for constant in obj.get_constants(sort=True): for constant in obj.get_constants(sort=True):
self.constants.append((name, constant)) self.constants.append((name, constant))