self.ibus = ibus = wishbone.Interface()
self.dbus = dbus = wishbone.Interface()
self.buses = [ibus, dbus]
- self.interrupt = Signal(32)
# # #
raise
self.constants[name] = SoCConstant(value)
- def add_config(self, name, value):
+ def add_config(self, name, value=None):
name = "CONFIG_" + name
if isinstance(value, str):
self.add_constant(name + "_" + value)
for n, cpu_bus in enumerate(self.cpu.buses):
self.bus.add_master(name="cpu_bus{}".format(n), master=cpu_bus)
self.csr.add("cpu", use_loc_if_exists=True)
- for name, loc in self.cpu.interrupts.items():
- self.irq.add(name, loc)
+ if hasattr(self.cpu, "interrupt"):
+ for name, loc in self.cpu.interrupts.items():
+ self.irq.add(name, loc)
+ self.add_config("CPU_HAS_INTERRUPT")
if hasattr(self, "ctrl"):
self.comb += self.cpu.reset.eq(self.ctrl.reset)
self.add_config("CPU_RESET_ADDR", reset_address)
self.check_if_exists(name)
setattr(self.submodules, name, Timer())
self.csr.add(name, use_loc_if_exists=True)
- self.irq.add(name, use_loc_if_exists=True)
+ if hasattr(self.cpu, "interrupt"):
+ self.irq.add(name, use_loc_if_exists=True)
# SoC finalization -----------------------------------------------------------------------------
def do_finalize(self):
self.csr.add("uart_phy", use_loc_if_exists=True)
self.csr.add("uart", use_loc_if_exists=True)
- self.irq.add("uart", use_loc_if_exists=True)
+ if hasattr(self.cpu, "interrupt"):
+ self.irq.add("uart", use_loc_if_exists=True)
+ else:
+ self.add_constant("UART_POLLING")
# Add SDRAM ------------------------------------------------------------------------------------
def add_sdram(self, name, phy, module, origin, size=None,
self.cpu_type = cpu_type
self.cpu_variant = cpu_variant
- if cpu_type == "serv":
- self.add_constant("UART_POLLING") # FIXME: use UART in polling mode for SERV bringup
-
self.integrated_rom_size = integrated_rom_size
self.integrated_rom_initialized = integrated_rom_init != []
self.integrated_sram_size = integrated_sram_size
#include <generated/mem.h>
#include <generated/csr.h>
+#include <generated/soc.h>
#ifdef CSR_ETHMAC_BASE
#include <net/microudp.h>
printf("Executing booted program at 0x%08x\n\n", addr);
printf("--============= \e[1mLiftoff!\e[0m ===============--\n");
uart_sync();
+#ifdef CONFIG_CPU_HAS_INTERRUPT
irq_setmask(0);
irq_setie(0);
+#endif
/* FIXME: understand why flushing icache on Vexriscv make boot fail */
#ifndef __vexriscv__
flush_cpu_icache();
#include <generated/csr.h>
+#include <generated/soc.h>
#include <irq.h>
#include <uart.h>
#include <stdio.h>
+void isr(void);
-#if defined(__blackparrot__) /*TODO: Update this function for BP*/ //
+#ifdef CONFIG_CPU_HAS_INTERRUPT
-void isr(void);
+#if defined(__blackparrot__) /*TODO: Update this function for BP*/ //
void isr(void)
{
static int onetime = 0;
*((unsigned int *)PLIC_THRSHLD) = 0;
}
-void isr(void);
void isr(void)
{
unsigned int claim;
}
}
#else
-void isr(void);
void isr(void)
{
__attribute__((unused)) unsigned int irqs;
#endif
}
#endif
+
+#else
+
+void isr(void){};
+
+#endif
{
char buffer[64];
int sdr_ok;
-
+#ifdef CONFIG_CPU_HAS_INTERRUPT
irq_setmask(0);
irq_setie(1);
+#endif
uart_init();
printf("\n");
#include <system.h>
#include <generated/csr.h>
+#include <generated/soc.h>
+
+#ifdef CONFIG_CPU_HAS_INTERRUPT
#ifdef __picorv32__
// PicoRV32 has a very limited interrupt support, implemented via custom
return (csrr(mstatus) & CSR_MSTATUS_MIE) != 0;
#elif defined (__rocket__)
return (csrr(mstatus) & CSR_MSTATUS_MIE) != 0;
-#elif defined (__microwatt__)
- return 0; /* No interrupt support on Microwatt */
#elif defined (__blackparrot__)
return (csrr(mstatus) & CSR_MSTATUS_MIE) != 0; /* FIXME */
-#elif defined (__serv__)
- return 0; /* No interrupt support on SERV */
#else
#error Unsupported architecture
#endif
if(ie) csrs(mstatus,CSR_MSTATUS_MIE); else csrc(mstatus,CSR_MSTATUS_MIE);
#elif defined (__rocket__)
if(ie) csrs(mstatus,CSR_MSTATUS_MIE); else csrc(mstatus,CSR_MSTATUS_MIE);
-#elif defined (__microwatt__)
- /* No interrupt support on Microwatt */
#elif defined (__blackparrot__)
if(ie) csrs(mstatus,CSR_MSTATUS_MIE); else csrc(mstatus,CSR_MSTATUS_MIE); /* FIXME */
-#elif defined (__serv__)
- /* No interrupt support on SERV */
#else
#error Unsupported architecture
#endif
return mask;
#elif defined (__rocket__)
return *((unsigned int *)PLIC_ENABLED) >> 1;
-#elif defined (__microwatt__)
- return 0; /* No interrupt support on Microwatt */
#elif defined (__blackparrot__)
return 0; /* FIXME */
-#elif defined (__serv__)
- return 0; /* No interrupt support on SERV */
#else
#error Unsupported architecture
#endif
asm volatile ("csrw %0, %1" :: "i"(CSR_IRQ_MASK), "r"(mask));
#elif defined (__rocket__)
*((unsigned int *)PLIC_ENABLED) = mask << 1;
-#elif defined (__microwatt__)
- /* No interrupt support on Microwatt */
#elif defined (__blackparrot__)
/* FIXME */
-#elif defined (__serv__)
- /* No interrupt support on SERV */
#else
#error Unsupported architecture
#endif
return pending;
#elif defined (__rocket__)
return *((unsigned int *)PLIC_PENDING) >> 1;
-#elif defined (__microwatt__)
- return 0; /* No interrupt support on Microwatt */
#elif defined (__blackparrot__)
return csr_readl(PLIC_PENDING) >> 1; /* FIXME */
-#elif defined (__serv__)
- return 0; /* No interrupt support on SERV */
#else
#error Unsupported architecture
#endif
}
#endif
+#endif
+
#endif /* __IRQ_H */