xmos / lib_sdram

SDRAM library
Other
1 stars 5 forks source link

Termination time bug #15

Closed ed-xmos closed 7 years ago

ed-xmos commented 7 years ago

Looks like there could be an issue with termination time likely causing a delay after r/w, or worse, premature termination possibly causing corruption?

t in server.xc (read/write_impl) is timestamped from a port timer and then incremented to synchrnoise the SDRAM transaction:

unsigned t = partout_timestamped(ras, 1, CTRL_RAS_NOP);
t += READ_SETUP_LATENCY;

It is then passed to the ASM implementation to calculate termination:

sdram_block_read( buffer, ports, t, word_count, row_words, cas_latency);

R2 (3rd param) is then modified to calc termination time:

    #define term_time       r2
//calculate the time to issue the terminate cmd
add term_time, start_time, r3
add term_time, term_time, r3

The last line (doubling the term time) seems dangerous - it is an absolute (not relative) trigger point so maths don't work out..

ed-xmos commented 7 years ago

This seems to be a falsely reported issue. The ASM actually adds double the termination time to to the start time and preserves the absolute datum