diff --git a/misoclib/sdramphy/initsequence.py b/misoclib/sdramphy/initsequence.py index 8a9dc28f6..f4ea15a75 100644 --- a/misoclib/sdramphy/initsequence.py +++ b/misoclib/sdramphy/initsequence.py @@ -35,7 +35,7 @@ static void command_p{n}(int cmd) # # sdrrd/sdrwr functions utilities # - r += "#define DFII_PIX_WRDATA_SIZE CSR_DFII_PI0_WRDATA_SIZE\n" + r += "#define DFII_PIX_DATA_SIZE CSR_DFII_PI0_WRDATA_SIZE\n" dfii_pix_wrdata_addr = [] for n in range(nphases): dfii_pix_wrdata_addr.append("CSR_DFII_PI{n}_WRDATA_ADDR".format(n=n)) @@ -44,9 +44,7 @@ const unsigned int dfii_pix_wrdata_addr[{n}] = {{ {dfii_pix_wrdata_addr} }}; """.format(n=nphases, dfii_pix_wrdata_addr=",\n\t".join(dfii_pix_wrdata_addr)) - r +="\n" - r += "#define DFII_PIX_RDDATA_SIZE CSR_DFII_PI0_RDDATA_SIZE\n" dfii_pix_rddata_addr = [] for n in range(nphases): dfii_pix_rddata_addr.append("CSR_DFII_PI{n}_RDDATA_ADDR".format(n=n)) diff --git a/software/bios/sdram.c b/software/bios/sdram.c index 24482ddfd..186241434 100644 --- a/software/bios/sdram.c +++ b/software/bios/sdram.c @@ -70,12 +70,12 @@ void sdrrdbuf(int dq) first_byte = 0; step = 1; } else { - first_byte = DFII_PIX_RDDATA_SIZE/2 - 1 - dq; - step = DFII_PIX_RDDATA_SIZE/2; + first_byte = DFII_PIX_DATA_SIZE/2 - 1 - dq; + step = DFII_PIX_DATA_SIZE/2; } for(p=0;p\n"); @@ -131,7 +131,7 @@ void sdrrderr(char *count) return; } - for(i=0;i=0;i--) { + for(i=DFII_PIX_DATA_SIZE/2-1;i>=0;i--) { printf("%2d%c ", delay[i], high_skew[i] ? '*' : ' '); if(delay[i] >= ERR_DDRPHY_DELAY) ok = 0; @@ -287,7 +287,7 @@ static void read_bitslip(int *delay, int *high_skew) int i; bitslip_thr = 0x7fffffff; - for(i=0;i=0;i--) + for(i=DFII_PIX_DATA_SIZE/2-1;i>=0;i--) if(delay[i] > bitslip_thr) { ddrphy_dly_sel_write(1 << i); /* 7-series SERDES in DDR mode needs 3 pulses for 1 bitslip */ @@ -310,7 +310,7 @@ static void read_bitslip(int *delay, int *high_skew) static void read_delays(void) { unsigned int prv; - unsigned char prs[DFII_NPHASES*DFII_PIX_WRDATA_SIZE]; + unsigned char prs[DFII_NPHASES*DFII_PIX_DATA_SIZE]; int p, i, j; int working; int delay, delay_min, delay_max; @@ -319,7 +319,7 @@ static void read_delays(void) /* Generate pseudo-random sequence */ prv = 42; - for(i=0;i