soc/software/liblitedram: fix pattern checking for low DFI databits
This commit is contained in:
parent
4636a841d3
commit
6f8a0052ef
|
@ -6,6 +6,7 @@
|
||||||
// This file is Copyright (c) 2018 Jean-François Nguyen <jf@lambdaconcept.fr>
|
// This file is Copyright (c) 2018 Jean-François Nguyen <jf@lambdaconcept.fr>
|
||||||
// This file is Copyright (c) 2018 Sergiusz Bazanski <q3k@q3k.org>
|
// This file is Copyright (c) 2018 Sergiusz Bazanski <q3k@q3k.org>
|
||||||
// This file is Copyright (c) 2018 Tim 'mithro' Ansell <me@mith.ro>
|
// This file is Copyright (c) 2018 Tim 'mithro' Ansell <me@mith.ro>
|
||||||
|
// This file is Copyright (c) 2021 Antmicro <www.antmicro.com>
|
||||||
// License: BSD
|
// License: BSD
|
||||||
|
|
||||||
#include <generated/csr.h>
|
#include <generated/csr.h>
|
||||||
|
@ -57,7 +58,7 @@ __attribute__((unused)) void cdelay(int i)
|
||||||
#define MEMTEST_DATA_SIZE (2*1024*1024)
|
#define MEMTEST_DATA_SIZE (2*1024*1024)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DFII_PIX_DATA_BYTES SDRAM_PHY_DATABITS*SDRAM_PHY_XDR/8
|
#define DFII_PIX_DATA_BYTES SDRAM_PHY_DFI_DATABITS/8
|
||||||
|
|
||||||
int sdram_get_databits(void) {
|
int sdram_get_databits(void) {
|
||||||
return SDRAM_PHY_DATABITS;
|
return SDRAM_PHY_DATABITS;
|
||||||
|
@ -299,7 +300,7 @@ static void print_scan_errors(unsigned int errors) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READ_CHECK_TEST_PATTERN_MAX_ERRORS (SDRAM_PHY_PHASES*2*32)
|
#define READ_CHECK_TEST_PATTERN_MAX_ERRORS (8*SDRAM_PHY_PHASES*SDRAM_PHY_XDR)
|
||||||
|
|
||||||
static unsigned int sdram_write_read_check_test_pattern(int module, unsigned int seed) {
|
static unsigned int sdram_write_read_check_test_pattern(int module, unsigned int seed) {
|
||||||
int p, i;
|
int p, i;
|
||||||
|
@ -346,8 +347,12 @@ static unsigned int sdram_write_read_check_test_pattern(int module, unsigned int
|
||||||
/* Read back test pattern */
|
/* Read back test pattern */
|
||||||
csr_rd_buf_uint8(sdram_dfii_pix_rddata_addr(p), tst, DFII_PIX_DATA_BYTES);
|
csr_rd_buf_uint8(sdram_dfii_pix_rddata_addr(p), tst, DFII_PIX_DATA_BYTES);
|
||||||
/* Verify bytes matching current 'module' */
|
/* Verify bytes matching current 'module' */
|
||||||
errors += popcount(prs[p][ SDRAM_PHY_MODULES-1-module] ^ tst[ SDRAM_PHY_MODULES-1-module]);
|
for (int i = 0; i < DFII_PIX_DATA_BYTES; ++i) {
|
||||||
errors += popcount(prs[p][2*SDRAM_PHY_MODULES-1-module] ^ tst[2*SDRAM_PHY_MODULES-1-module]);
|
int j = p * DFII_PIX_DATA_BYTES + i;
|
||||||
|
if (j % SDRAM_PHY_MODULES == SDRAM_PHY_MODULES-1-module) {
|
||||||
|
errors += popcount(prs[p][i] ^ tst[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SDRAM_PHY_ECP5DDRPHY
|
#ifdef SDRAM_PHY_ECP5DDRPHY
|
||||||
|
|
Loading…
Reference in New Issue