Skip to content

modules: DDR4 same bank group tCCD limit and per speed grade tCCD, tRRD and CL/CWL. - #470

Merged
enjoy-digital merged 2 commits into
masterfrom
modules/ddr4-speedgrade-timings
Nov 6, 2026
Merged

enjoy-digital merged 2 commits into
masterfrom
modules/ddr4-speedgrade-timings

Conversation

@enjoy-digital

Copy link
Copy Markdown
Owner

Closes #306. Refs #185, #406.

Per speed grade timings (first commit)

  • _SpeedgradeTimings accepts optional tCCD, tRRD, cl and cwl. tCCD/tRRD override the technology timings when set, and SDRAMModule.get_cl_cwl() returns the speed grade's CL/CWL.
  • litedram_gen gets sdram_module_speedgrade (previously ignored), cl and cwl. CL/CWL come from the YAML, then the speed grade, else the PHY defaults. --sim cores do not use cl/cwl.
  • An unknown sdram_module_speedgrade now raises a KeyError, where the key used to be ignored.

DDR4 tCCD (second commit)

  • Hand-written DDR4 modules used tCCD=(4, None), so with sys_clk above 200 MHz at 1:4, consecutive CAS commands to a bank group were closer than tCCD_L.
  • They now use tCCD_L from the Micron 8Gb DDR4 datasheet (Rev. L, Tables 161/162): 5 ns from DDR4-2400, and 5.355 ns for the two DDR4-2133 modules. Its minimum is 4nCK: "Although JEDEC specifies the larger of 5nCK or Xns, Micron's DRAM supports the larger of 4nCK or Xns."
  • tCCD is now computed without the 3/4 sys_clk phase margin. That margin would give tCCD=2 at every usual clock and halve sequential throughput. It is not needed since consecutive CAS commands of the same type are on the same DFI phase.

Effect on tCCD (all modules, 10 clocks from 25 to 400 MHz, no other timing changes)

Modules Change
DDR2, DDR3, SDR, LPDDR None
Hand-written DDR4 None up to 156.25 MHz. 1 to 2 from 300 MHz, also at 200 MHz for the two 2133 modules, 1 to 3 at 400 MHz for those two
HMA82GR7DJR4N, HMA84GR7DJR4N, M393A2K40DB3, M393A4K40DB3 2 to 1 up to 200 MHz, 3 to 2 from 300 MHz

The four RDIMM modules, and modules built from SPD data, get more sequential throughput at usual clocks. That is the change most worth reviewing, since it relaxes real designs.

Known limits, not changed here

Tested

  • test_modules, test_timing, test_controller_timing, test_gen, test_init, test_multiplexer, test_crossbar and test_controller pass.
  • Generation of arty, ulx3s, kcu105, xcu1525 and a USP DDR4 core: with cl/cwl the init sequence has CL=11, and CL=9 without them.
  • No hardware and no real-PHY throughput measurement.

Written by Claude Code (AI agent), supervised by Florent Kermarrec.

🤖 Generated with Claude Code

enjoy-digital and others added 2 commits November 6, 2026 15:09
tCCD and tRRD could only be set per technology and CL/CWL only came from a clock rate table, while
they depend on the speed grade (litedram #306, #185). _SpeedgradeTimings now accepts optional tCCD,
tRRD, cl and cwl: tCCD/tRRD override the technology timings when set, and SDRAMModule.get_cl_cwl
returns the speed grade's CL/CWL.

litedram_gen gets sdram_module_speedgrade (previously ignored), cl and cwl keys: CL/CWL come from the
YAML, then the speed grade, else the PHY defaults. Existing modules define no override, so their
timings do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gin.

Hand-written DDR4 modules used tCCD=(4, None), so at 1:4 with sys_clk > 200 MHz consecutive CAS
commands to a bank group were closer than tCCD_L (litedram #306). Use the tCCD_L of the Micron 8Gb
DDR4 datasheet: 5ns from DDR4-2400, 5.355ns for the DDR4-2133 modules, with 4nCK as minimum.

ck_ns_to_cycles also adds a phase margin of 3/4 sys_clk, which would give tCCD=2 at every usual clock
and halve sequential throughput, as already happened with the (4, 5) RDIMM modules. Consecutive CAS
commands of the same type are on the same DFI phase, so their spacing is an exact number of cycles:
compute tCCD without this margin.

tCCD compared over all modules and clocks: unchanged for DDR2/DDR3/SDR and for hand-written DDR4
modules up to 156.25 MHz sys_clk; HMA82GR7DJR4N, HMA84GR7DJR4N, M393A2K40DB3 and M393A4K40DB3 go from
2 to 1 up to 200 MHz.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@enjoy-digital
enjoy-digital merged commit 09685cb into master Nov 6, 2026
6 checks passed
enjoy-digital added a commit that referenced this pull request Nov 6, 2026
This x8 DDR4-2133 module used tRRD=(4, 4.9), the DDR4-2400 value: tRRD_L is 5.3ns at DDR4-2133 with
1KB pages (Micron 8Gb DDR4 datasheet, Table 161). Set it on the speed grade, with the per speed grade
tRRD from #470. The phase margin was covering the difference: among the clocks compared, the
controller's tRRD only changes at 50 MHz sys_clk (1 to 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Why are CL and CWL not included as speedgrade parameters in the module class?

1 participant