Closed jedrzejboczar closed 4 years ago
Thanks for the detailed report. The CDC has been refactored with https://github.com/enjoy-digital/litedram/commit/92e34d4d376b1f62de1d85a58a396c3fa224b67b and the test has been enabled with https://github.com/enjoy-digital/litedram/commit/c55136c17ae13a026097c9da2b88143fd1276eab and is now passing.
This issue describes problem from https://github.com/enjoy-digital/litedram/pull/165#issuecomment-599629743.
When the memory port passed to
LiteDRAMBISTGenerator
/LiteDRAMBISTChecker
is not insys
clock domain, then synchronization is added for CSRs. The problem is that synchronization of multi-bit CSRs likebase
takes longer than synchronization of single-bit ones, likestart
. This results in a situation where, even though we write tobase
first and then tostart
, it may happend thatstart
propagates fast enough that theLiteDRAMBISTGenerator
module will use old value ofbase
when writing first word. This is similar forLiteDRAMBISTChecker
, whereerrors
do not have final value at the moment whendone
is already 1.Should we add additional synchronization of
start
/done
to account for that?A test for this situation has been added in https://github.com/enjoy-digital/litedram/pull/165: test_bist_csr_cdc. Simulation data from the test can be found in sim-gtkwave.zip (includes all stages of bist_test, with
errors == 4
asserion commented out).test_bist_csr_cdc
fails due to (referring to the stages frombist_test
method):errors
gets updated afterdone
); ideally there should be 4 errors, but the generator on its 2nd run ("corrupt memory") writes the first word to wrong location (using old value ofbase
)done