From 76d3a77cf33d44459db380b3860eafeabef662ce Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 21 Oct 2022 22:01:34 +0200 Subject: [PATCH] interconnect/csr_bus: Fix build with custom get_csrs/get_constants from cores. --- litex/soc/interconnect/csr_bus.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/litex/soc/interconnect/csr_bus.py b/litex/soc/interconnect/csr_bus.py index 815e80ff6..5713d237b 100644 --- a/litex/soc/interconnect/csr_bus.py +++ b/litex/soc/interconnect/csr_bus.py @@ -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. # -------------------------------