soc_core/sdram: Don't blow up if _wb_sdram_ifs or _csr_masters are empty
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 24 Sep 2019 06:40:22 +0000 (08:40 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 24 Sep 2019 06:41:59 +0000 (08:41 +0200)
For example a standalone controller with no exposed CSRs (probably not
a very useful configuration but I really don't like python backtraces)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
litex/soc/integration/soc_core.py
litex/soc/integration/soc_sdram.py

index 076934dd295a579629edf4c5bde47b9379dca98f..48009791b91714da9f5658fb10f8d434720fdcb6 100644 (file)
@@ -541,7 +541,8 @@ class SoCCore(Module):
             alignment=self.csr_alignment)
 
         # Add CSRs interconnect
-        self.submodules.csrcon = csr_bus.InterconnectShared(
+        if len(self._csr_masters) != 0:
+            self.submodules.csrcon = csr_bus.InterconnectShared(
                 self._csr_masters, self.csrbankarray.get_buses())
 
         # Check and add CSRs regions
index 54a3db5369965ea18226481dc376eff3e8a54fbd..d6a72e502802e77f7bceb7399d97ed821812b538 100644 (file)
@@ -121,7 +121,8 @@ class SoCSDRAM(SoCCore):
                 raise FinalizeError("Need to call SoCSDRAM.register_sdram()")
 
             # Arbitrate wishbone interfaces to the DRAM
-            self.submodules.wb_sdram_con = wishbone.Arbiter(self._wb_sdram_ifs, self._wb_sdram)
+            if len(self._wb_sdram_ifs) != 0:
+                self.submodules.wb_sdram_con = wishbone.Arbiter(self._wb_sdram_ifs, self._wb_sdram)
         SoCCore.do_finalize(self)