From f85a4f004b7fc845de961410f7616b4b7b08b451 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 27 Mar 2015 15:49:16 +0100 Subject: [PATCH 1/3] 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. --- software/bios/sdram.c | 52 +++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/software/bios/sdram.c b/software/bios/sdram.c index 841147995..939c42a72 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 Date: Fri, 27 Mar 2015 16:43:22 +0100 Subject: [PATCH 2/3] software/bios/sdram: for now desactivate random on address test since it seems to trigger a L2 cache or LASMIcon bug on at least de0nano/minispartan6 Memtest sometimes reports 1 or 2 errors with de0nano/minispartan6 on this new test when used with LASMICON. Minicon seems fine. We will have to investigate on this issue. --- software/bios/sdram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/software/bios/sdram.c b/software/bios/sdram.c index 939c42a72..31552036b 100644 --- a/software/bios/sdram.c +++ b/software/bios/sdram.c @@ -425,8 +425,8 @@ int sdrlevel(void) #define TEST_DATA_SIZE (2*1024*1024) #define TEST_RANDOM_DATA 1 -#define TEST_ADDR_SIZE 32*1024 -#define TEST_RANDOM_ADDR 1 +#define TEST_ADDR_SIZE (32*1024) +#define TEST_RANDOM_ADDR 0 #define ONEZERO 0xAAAAAAAA #define ZEROONE 0x55555555 From f4c35e358efd5a596a16c6d386644f358ae146d6 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 27 Mar 2015 18:24:19 +0100 Subject: [PATCH 3/3] software/bios/sdram: small clean up --- software/bios/sdram.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/software/bios/sdram.c b/software/bios/sdram.c index 31552036b..b8c7262ea 100644 --- a/software/bios/sdram.c +++ b/software/bios/sdram.c @@ -423,10 +423,10 @@ int sdrlevel(void) #endif /* CSR_DDRPHY_BASE */ #define TEST_DATA_SIZE (2*1024*1024) -#define TEST_RANDOM_DATA 1 +#define TEST_DATA_RANDOM 1 #define TEST_ADDR_SIZE (32*1024) -#define TEST_RANDOM_ADDR 0 +#define TEST_ADDR_RANDOM 0 #define ONEZERO 0xAAAAAAAA #define ZEROONE 0x55555555 @@ -477,14 +477,14 @@ int memtest_silent(void) /* test counter or random data */ seed_32 = 0; for(i=0;i