soc_core: check for cpu before checking interrupt

This commit is contained in:
Florent Kermarrec 2018-11-13 16:17:49 +01:00
parent b4bdf2a023
commit af25bf2bc0
1 changed files with 9 additions and 8 deletions

View File

@ -375,14 +375,15 @@ class SoCCore(Module):
self._constants.append(("CONFIG_" + name.upper(), value)) self._constants.append(("CONFIG_" + name.upper(), value))
# Interrupts # Interrupts
if hasattr(self.cpu, "interrupt"): if hasattr(self, "cpu"):
for interrupt, mod_name in sorted(self.interrupt_rmap.items()): if hasattr(self.cpu, "interrupt"):
if mod_name == "nmi": for interrupt, mod_name in sorted(self.interrupt_rmap.items()):
continue if mod_name == "nmi":
if hasattr(self, mod_name): continue
mod_impl = getattr(self, mod_name) if hasattr(self, mod_name):
assert hasattr(mod_impl, 'ev'), "Submodule %s does not have EventManager (xx.ev) module" % mod_name mod_impl = getattr(self, mod_name)
self.comb += self.cpu.interrupt[interrupt].eq(mod_impl.ev.irq) 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): def build(self, *args, **kwargs):
return self.platform.build(self, *args, **kwargs) return self.platform.build(self, *args, **kwargs)