cpu/vexriscv/system.h: provide empty flush_cpu_i/dcache functions for variants with...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 31 Jul 2020 06:58:30 +0000 (08:58 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 31 Jul 2020 06:58:30 +0000 (08:58 +0200)
litex/soc/cores/cpu/vexriscv/system.h

index 0683b5b72bdea2c73390e8798f70295a2a41beb3..f441a197e992c7621603cc7f7483512868334a66 100644 (file)
@@ -3,12 +3,17 @@
 
 #include <csr-defs.h>
 
+#include <generated/soc.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 __attribute__((unused)) static void flush_cpu_icache(void)
 {
+#if defined(CONFIG_CPU_VARIANT_MIN)
+  /* No instruction cache */
+#else
   asm volatile(
     ".word(0x100F)\n"
     "nop\n"
@@ -17,19 +22,22 @@ __attribute__((unused)) static void flush_cpu_icache(void)
     "nop\n"
     "nop\n"
   );
+#endif
 }
 
 __attribute__((unused)) static void flush_cpu_dcache(void)
 {
+#if defined(CONFIG_CPU_VARIANT_MIN) || defined(CONFIG_CPU_VARIANT_LITE)
+  /* No data cache */
+#else
   asm volatile(".word(0x500F)\n");
+#endif
 }
 
 void flush_l2_cache(void);
 
 void busy_wait(unsigned int ms);
 
-#include <csr-defs.h>
-
 #define csrr(reg) ({ unsigned long __tmp; \
   asm volatile ("csrr %0, " #reg : "=r"(__tmp)); \
   __tmp; })