From 9af56cf247d4f085b04c2ecff112122c97910068 Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Mon, 30 Nov 2020 16:27:31 -0500 Subject: [PATCH 1/2] soc: fix typo in IRQ handler exception --- litex/soc/integration/soc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index 3d8d94613..997c56cc4 100644 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -624,7 +624,7 @@ class SoCIRQHandler(SoCLocHandler): # Check IRQ Number if n_irqs > 32: self.logger.error("Unsupported IRQs number: {} supporteds: {:s}".format( - colorer(n, color="red"), colorer("Up to 32", color="green"))) + colorer(n_irqs, color="red"), colorer("Up to 32", color="green"))) raise # Create IRQ Handler From 5cc3db01760a45475b5668f86c6407943c6570d2 Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Mon, 30 Nov 2020 16:28:40 -0500 Subject: [PATCH 2/2] soc: cosmetic: reduce horizontal indentation in IRQ init. --- litex/soc/integration/soc.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index 997c56cc4..fe72877aa 100644 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -1047,20 +1047,19 @@ class SoC(Module): raise # SoC IRQ Interconnect --------------------------------------------------------------------- - if hasattr(self, "cpu"): - if hasattr(self.cpu, "interrupt"): - for name, loc in sorted(self.irq.locs.items()): - if name in self.cpu.interrupts.keys(): - continue - if hasattr(self, name): - module = getattr(self, name) - if not hasattr(module, "ev"): - self.logger.error("EventManager {} in {} SubModule.".format( - colorer("not found", color="red"), - colorer(name))) - raise - self.comb += self.cpu.interrupt[loc].eq(module.ev.irq) - self.add_constant(name + "_INTERRUPT", loc) + if hasattr(self, "cpu") and hasattr(self.cpu, "interrupt"): + for name, loc in sorted(self.irq.locs.items()): + if name in self.cpu.interrupts.keys(): + continue + if hasattr(self, name): + module = getattr(self, name) + if not hasattr(module, "ev"): + self.logger.error("EventManager {} in {} SubModule.".format( + colorer("not found", color="red"), + colorer(name))) + raise + self.comb += self.cpu.interrupt[loc].eq(module.ev.irq) + self.add_constant(name + "_INTERRUPT", loc) # SoC build ------------------------------------------------------------------------------------ def build(self, *args, **kwargs):