phy: Align Nexus DDR writes without altering CWL - #397
Merged
Conversation
The Nexus write path is one memory clock later than the command path. Compensating for this by incrementing CWL programs a different DDR3 mode and can produce an invalid CWL for the selected memory clock. Schedule DFI write data one sys_clk cycle earlier, then apply a fixed half-word slip to DQ, DM, DQS and their tristate controls. Since a sys_clk cycle spans two memory clocks, this advances the complete write stream by the required single memory clock while preserving the JEDEC CWL. Add simulations for data and tristate bit ordering, burst preamble/postamble boundaries, and the default Nexus PHY timing settings. Suggested-by: Myrtle Shah <gatecat@ds0.me>
Contributor
|
Looks good, thanks for finding a better solution here! Tested with both Radiant and nextpnr: (incidentally, the workaround of tampering with latencies came from s7ddrphy doing a similar hack for the read path: litedram/litedram/phy/s7ddrphy.py Lines 125 to 128 in 058937a |
Owner
Author
|
Thanks @gatecat for the quick feedback! I'll merge then. The solution on Artix7 is indeed also a workaround, I'll try to explore other solutions with AI and see if we could improve. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #396.
Summary
sys_clkcycle earlier and apply a fixed half-word slip to DQ, DM, DQS, and their tristate controls.Rationale
The Nexus write path is one memory clock later than the command path. In the 1:2 PHY, one
sys_clkcycle spans two memory clocks, so scheduling onesys_clkcycle earlier and delaying the serializer streams by half a word produces the required net advance of one memory clock.This keeps the controller timing and programmed DDR3 mode consistent. Incrementing CWL can otherwise select a value that is not valid for the configured memory clock.
Testing
pytest -q test/test_nxddrphy.py test/test_phy_utils.py: 30 passed, 12 subtests passed.pytest -q: 335 passed, 5 skipped, 612 subtests passed.@gatecat, could you please test this on the Certus-NX Versa board, first with Radiant and also with nextpnr if practical? The useful checks are DDR3 initialization plus repeated write/read tests, since hardware validation is the remaining part that simulation cannot cover here.