Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/misoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 340014dbac87
Choose a base ref
...
head repository: m-labs/misoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f4c35e358efd
Choose a head ref
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Mar 27, 2015

  1. 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.
    enjoy-digital committed Mar 27, 2015
    Copy the full SHA
    f85a4f0 View commit details
  2. 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.
    enjoy-digital committed Mar 27, 2015
    Copy the full SHA
    6245dd7 View commit details
  3. Copy the full SHA
    f4c35e3 View commit details
Showing with 41 additions and 13 deletions.
  1. +41 −13 software/bios/sdram.c
54 changes: 41 additions & 13 deletions software/bios/sdram.c
Original file line number Diff line number Diff line change
@@ -422,25 +422,37 @@ int sdrlevel(void)

#endif /* CSR_DDRPHY_BASE */

#define TEST_SIZE (2*1024*1024)
#define TEST_RANDOM_DATA 1
#define TEST_DATA_SIZE (2*1024*1024)
#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(unsigned int seed, int random)
static unsigned int seed_to_data_32(unsigned int seed, int random)
{
if (random)
return 1664525*seed + 1013904223;
else
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<TEST_SIZE/4;i++) {
seed = seed_to_data(seed, TEST_RANDOM_DATA);
array[i] = seed;
seed_32 = 0;
for(i=0;i<TEST_DATA_SIZE/4;i++) {
seed_32 = seed_to_data_32(seed_32, TEST_DATA_RANDOM);
array[i] = seed_32;
}

seed = 0;
seed_32 = 0;
error_cnt = 0;
for(i=0;i<TEST_SIZE/4;i++) {
seed = seed_to_data(seed, TEST_RANDOM_DATA);
if(array[i] != seed)
for(i=0;i<TEST_DATA_SIZE/4;i++) {
seed_32 = seed_to_data_32(seed_32, TEST_DATA_RANDOM);
if(array[i] != seed_32)
error_cnt++;
}

/* test random addressing */
seed_16 = 0;
for(i=0;i<TEST_ADDR_SIZE/4;i++) {
seed_16 = seed_to_data_16(seed_16, TEST_ADDR_RANDOM);
array[(unsigned int) seed_16] = i;
}

seed_16 = 0;
error_cnt = 0;
for(i=0;i<TEST_ADDR_SIZE/4;i++) {
seed_16 = seed_to_data_16(seed_16, TEST_ADDR_RANDOM);
if(array[(unsigned int) seed_16] != i)
error_cnt++;
}

return error_cnt;
}

@@ -485,7 +513,7 @@ int memtest(void)

e = memtest_silent();
if(e != 0) {
printf("Memtest failed: %d/%d words incorrect\n", e, TEST_SIZE/4);
printf("Memtest failed: %d/%d words incorrect\n", e, TEST_DATA_SIZE/4 + TEST_ADDR_SIZE/4);
return 0;
} else {
printf("Memtest OK\n");