from misoclib.identifier import git
class Identifier(Module, AutoCSR):
- def __init__(self, sysid, frequency, revision=None):
+ def __init__(self, sysid, frequency, l2_size, revision=None):
self._r_sysid = CSRStatus(16)
self._r_revision = CSRStatus(32)
self._r_frequency = CSRStatus(32)
+ self._r_l2_size = CSRStatus(8)
###
self.comb += [
self._r_sysid.status.eq(sysid),
self._r_revision.status.eq(revision),
- self._r_frequency.status.eq(frequency)
+ self._r_frequency.status.eq(frequency),
+ self._r_l2_size.status.eq(l2_size)
]
void flush_cpu_icache(void);
void flush_cpu_dcache(void);
+void flush_l2_cache(void);
#ifdef __cplusplus
}
#include <uart.h>
#include <system.h>
+#include <hw/mem.h>
+#include <hw/csr.h>
void flush_cpu_icache(void)
{
"nop\n"
);
}
+
+void flush_l2_cache(void)
+{
+ unsigned int l2_nwords;
+ unsigned int i;
+ register unsigned int addr;
+ register unsigned int dummy;
+
+ l2_nwords = 1 << (identifier_l2_size_read() - 2);
+ for(i=0;i<2*l2_nwords;i++) {
+ addr = SDRAM_BASE + i*4;
+ __asm__ volatile("lw %0, (%1+0)\n":"=r"(dummy):"r"(addr));
+ }
+}
#
self.submodules.crg = mxcrg.MXCRG(MXClockPads(platform), clk_freq)
self.submodules.uart = uart.UART(platform.request("serial"), clk_freq, baud=115200)
- self.submodules.identifier = identifier.Identifier(self.known_platform_id[platform_name], int(clk_freq))
+ self.submodules.identifier = identifier.Identifier(self.known_platform_id[platform_name], int(clk_freq),
+ log2_int(l2_size))
self.submodules.timer0 = timer.Timer()
if platform_name == "mixxeo":
self.submodules.leds = gpio.GPIOOut(platform.request("user_led"))