From af25bf2bc01679f473bf563e6dc1a9f86ff2b43f Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 13 Nov 2018 16:17:49 +0100 Subject: [PATCH] soc_core: check for cpu before checking interrupt --- litex/soc/integration/soc_core.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/litex/soc/integration/soc_core.py b/litex/soc/integration/soc_core.py index 8b9f80f8b..8e91d31c1 100644 --- a/litex/soc/integration/soc_core.py +++ b/litex/soc/integration/soc_core.py @@ -375,14 +375,15 @@ class SoCCore(Module): self._constants.append(("CONFIG_" + name.upper(), value)) # Interrupts - if hasattr(self.cpu, "interrupt"): - for interrupt, mod_name in sorted(self.interrupt_rmap.items()): - if mod_name == "nmi": - continue - if hasattr(self, mod_name): - mod_impl = getattr(self, mod_name) - assert hasattr(mod_impl, 'ev'), "Submodule %s does not have EventManager (xx.ev) module" % mod_name - self.comb += self.cpu.interrupt[interrupt].eq(mod_impl.ev.irq) + if hasattr(self, "cpu"): + if hasattr(self.cpu, "interrupt"): + for interrupt, mod_name in sorted(self.interrupt_rmap.items()): + if mod_name == "nmi": + continue + if hasattr(self, mod_name): + mod_impl = getattr(self, mod_name) + assert hasattr(mod_impl, 'ev'), "Submodule %s does not have EventManager (xx.ev) module" % mod_name + self.comb += self.cpu.interrupt[interrupt].eq(mod_impl.ev.irq) def build(self, *args, **kwargs): return self.platform.build(self, *args, **kwargs)