From: Florent Kermarrec Date: Wed, 11 Nov 2015 12:10:03 +0000 (+0100) Subject: soc/software/bios/sdram: split memtest and allow external #define of memtest sizes X-Git-Tag: 24jan2021_ls180~2087 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bda196fbc8417b84e9668fb4ff6a46853ba07d4c;p=litex.git soc/software/bios/sdram: split memtest and allow external #define of memtest sizes --- diff --git a/litex/boards/targets/sim.py b/litex/boards/targets/sim.py index d1d35131..49f66798 100644 --- a/litex/boards/targets/sim.py +++ b/litex/boards/targets/sim.py @@ -44,7 +44,9 @@ class BaseSoC(SoCSDRAM): self.submodules.sdrphy = SDRAMPHYModel(sdram_module, phy_settings) self.register_sdram(self.sdrphy, "minicon", sdram_module.geom_settings, sdram_module.timing_settings) - + # reduce memtest size to speed up simulation + self.add_constant("MEMTEST_DATA_SIZE", 8*1024) + self.add_constant("MEMTEST_ADDR_SIZE", 8*1024) def main(): diff --git a/litex/soc/software/bios/sdram.c b/litex/soc/software/bios/sdram.c index 75421a39..e826d52f 100644 --- a/litex/soc/software/bios/sdram.c +++ b/litex/soc/software/bios/sdram.c @@ -423,15 +423,6 @@ int sdrlevel(void) #endif /* CSR_DDRPHY_BASE */ -#define TEST_DATA_SIZE (32*1024) // FIXME add #define -#define TEST_DATA_RANDOM 1 - -#define TEST_ADDR_SIZE (32*1024) -#define TEST_ADDR_RANDOM 0 - -#define ONEZERO 0xAAAAAAAA -#define ZEROONE 0x55555555 - static unsigned int seed_to_data_32(unsigned int seed, int random) { if (random) @@ -448,81 +439,123 @@ static unsigned short seed_to_data_16(unsigned short seed, int random) return seed + 1; } -int memtest_silent(void) +#define ONEZERO 0xAAAAAAAA +#define ZEROONE 0x55555555 + +#ifndef MEMTEST_BUS_SIZE +#define MEMTEST_BUS_SIZE (512) +#endif + +static int memtest_bus(void) { volatile unsigned int *array = (unsigned int *)MAIN_RAM_BASE; - int i; - unsigned int seed_32; - unsigned short seed_16; - unsigned int error_cnt; + int i, errors; - error_cnt = 0; + errors = 0; - /* test data bus */ - for(i=0;i<128;i++) { + for(i=0;i