Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-synchronized path in cdc_2phase_clearable #243

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

phsauter
Copy link

As it stands, the cdc_2phase_clearable module has a path going from the source clock domain into the destination clock domain directly, without a 2-flop synchronizer.
The path in question is in the reset/clear logic implemented in cdc_reset_ctrlr.
Specifically receiver_next_phase is clocked by the source domain (side A in cdc_reset_ctrlr) and then goes into the other side (side B) where it goes into i_state_transition_cdc_dst, a cdc_4phase_dst with the DECOUPLED parameter set to zero.
Setting this parameter to zero effectively bypasses the spill-register in there allowing the same asynchronous signal to leave and go into the destination clock domain, where it shows up as receiver_next_phase used to create the isolate and clear signals on the destination side.

I strongly doubt this is intended behavior and would like to fix this issue.

Further, this shows to me that especially the clock domain crossings need working testbenches that run in a CI to make sure they work as intended.
As part of this PR, I also started to fix the testbenches which in the case of cdc_2phase_clearable did not even test the module but presumably some old development version instead. This happened because the module is essentially copied in the testbench instead of actually testing the module itself.

adapted from cdc_2phase_tb
Previously this used some old (development?) version of
the DUT module.
Now it uses the same implementation as is currently used.

Todo: This should test the module, not a copy of the module.
The previous implementation creates a non-synchronized path
across the CDC, making it significantly more vulnerable
to metastability.

This does not seem to be necessary for DECOUPLED to work in
the cdc_2phase_clearable (cdc_reset_ctrlr).
The important thing seems to be when on the source side the
ready signal is asserted, not how the destination side
synchronizes data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant