From: Florent Kermarrec Date: Fri, 27 Mar 2015 14:49:16 +0000 (+0100) Subject: software/bios/sdram: add random addressing to memtest X-Git-Tag: 24jan2021_ls180~2428^2~2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f85a4f004b7fc845de961410f7616b4b7b08b451;p=litex.git software/bios/sdram: add random addressing to memtest testing memories with linear access is not good enough. Adding random addressing allow us to detect more eventual issues on our L2 cache or SDRAM controller. --- diff --git a/software/bios/sdram.c b/software/bios/sdram.c index 84114799..939c42a7 100644 --- a/software/bios/sdram.c +++ b/software/bios/sdram.c @@ -422,13 +422,16 @@ int sdrlevel(void) #endif /* CSR_DDRPHY_BASE */ -#define TEST_SIZE (2*1024*1024) +#define TEST_DATA_SIZE (2*1024*1024) #define TEST_RANDOM_DATA 1 +#define TEST_ADDR_SIZE 32*1024 +#define TEST_RANDOM_ADDR 1 + #define ONEZERO 0xAAAAAAAA #define ZEROONE 0x55555555 -static unsigned int seed_to_data(unsigned int seed, int random) +static unsigned int seed_to_data_32(unsigned int seed, int random) { if (random) return 1664525*seed + 1013904223; @@ -436,11 +439,20 @@ static unsigned int seed_to_data(unsigned int seed, int random) return seed + 1; } +static unsigned short seed_to_data_16(unsigned short seed, int random) +{ + if (random) + return 25173*seed + 13849; + else + return seed + 1; +} + int memtest_silent(void) { volatile unsigned int *array = (unsigned int *)MAIN_RAM_BASE; int i; - unsigned int seed; + unsigned int seed_32; + unsigned short seed_16; unsigned int error_cnt; /* test data bus */ @@ -463,19 +475,35 @@ int memtest_silent(void) } /* test counter or random data */ - seed = 0; - for(i=0;i