Skip to content

DDR2: use Micron DDR2-800 datasheet timings, fix tRPA and auto-precharge burst spacing - #8

Open
samirbhattarai135 wants to merge 2 commits into
normal-computing-oss:mainfrom
samirbhattarai135:ddr2-micron-timings
Open

samirbhattarai135 wants to merge 2 commits into
normal-computing-oss:mainfrom
samirbhattarai135:ddr2-micron-timings

Conversation

@samirbhattarai135

Copy link
Copy Markdown

This PR replaces the DDR2 timing values with the datasheet values for one real part, and fixes three rules the datasheet disagrees with.

Vendor datasheet: Micron, 1Gb: x4, x8, x16 DDR2 SDRAM, 1GbDDR2.pdf Rev. Y 02/14 (136 pages). The part is the MT47H64M16 (x16, 8 banks) in speed grade -25E, which is DDR2-800 at CL = 5 and tCK = 2.5 ns. It is the DDR2 part on the Digilent Nexys A7 board. Each value is ns / tCK, taken from Table 12 (pp. 35-41) and p. 86 (RL = AL + CL, WL = RL - 1). Every line in timing_params/ddr2.py has a comment that gives its source value.

Commit 1: values only

Before this commit, timing_params/ddr2.py and timing_params/ddr3.py shared 18 keys, and every one of them had the same value.

Parameter Before After Datasheet
tCCD 4 2 2 tCK
tRAS 28 16 40 ns
tRC 38 22 55 ns
tRCD / tRP 10 / 10 5 / 5 12.5 ns
tRFC 88 51 127.5 ns (1Gb)
tRL / tWL 10 / 8 5 / 4 CL = 5, WL = RL - 1
tRRD 5 4 10 ns (x16)
tFAW 24 18 45 ns (x16)
tRTP / tWTR 6 / 6 3 / 3 7.5 ns
tWR 12 6 15 ns
tXP 6 2 2 tCK
tXSNR 2 55 tRFC + 10 ns

These keys do not change: tPD 3 (tCKE), tXSRD 200, tXARD 2, tAL 0, tRTRS 1 and tCK 1.

Commit 2: rules

This commit is separate, so you can take the values without it.

  • PRECHARGE ALL to ACT / REF / SRE now uses a new key, tRPA = tRP + tCK = 6. Note 36 gives this value for 8-bank devices. The old tRP of 10 covered the gap. If a memspec has no tRPA, create_standard raises a TypeError; it does not build a net with a silent bound.
  • After RDA or WRA, the next READ or WRITE to another bank now waits BL/2 (Tables 42 and 43). Only a burst without auto precharge can be interrupted 2 tCK later (Figures 49 and 61). The net had no WRA to WR rule at all, so it accepted a WR one cycle after a WRA.

Testing

  • pytest: 10 passed on each commit. example_ddr3.py also runs.
  • I replayed short sequences through can_fire_transition:
    • ACT 5 cycles after PREA is now rejected (tRPA = 6).
    • RD to bank 1 two cycles after RDA to bank 0 is now rejected. So is WR one or two cycles after WRA.
    • RD or WR exactly 2 cycles after a RD or WR is still accepted, which is correct (a BL8 interrupt).
    • ACT 2 cycles after SRX is now rejected (tXSNR was 2).
    • WR 6 cycles after RD is now accepted, which follows from WL = RL - 1.

Left unchanged, as questions

  • nbrOfBanks stays at 2. Every memspec in the repo uses 2, so I took it to be a deliberate limit on state space. The real part has 8, and with 2 banks tFAW can never bind.
  • The alias DDR2_800C_1GB stays. The -25E part reaches tCK = 2.5 ns only at CL 5 or above (Table 12), so the letter in the name may not match this part.
  • tRRD and tFAW depend on device width. I used the x16 values; x4 and x8 parts give tRRD = 3 and tFAW = 14.
  • BL8 bursts 3 cycles apart. A second READ or WRITE is legal at exactly +2 (an interrupt) or at +4 and later, but not at +3. One lower bound cannot express this, so the net still accepts +3.

Other disagreements with the datasheet

I can send these as separate PRs if you agree with how I read them:

  • The intra_rank ACT to PRE tRAS rule applies across banks, so an ACT to bank 1 blocks a PRE to bank 0. Table 39 (p. 76) allows that PRE.
  • PREA has no tRAS check after an ACT (Table 12, p. 39).
  • PDX to RD applies both tXARD and tXARDS, so a fast exit always waits for the slow bound. Separately, the hard-coded tXARDS = 6 - AL is the DDR2-400/533 value, and -25E needs 8 - AL (p. 41). A fix needs a slow-exit (MR12) flag in the memspec.

I found these by running the net as an RTL bus monitor alongside can_fire_transition: https://github.com/samirbhattarai135/ddr2-timing-monitor (each case is in tools/audit.py).

The DDR2 timing parameters matched the DDR3-1600 values on every shared
key. Replace them with the values for the Micron MT47H64M16 -25E part
(1Gb, x16, DDR2-800, CL = 5, tCK = 2.5 ns) from the Micron 1Gb DDR2 SDRAM
datasheet, Rev. Y 02/14, Table 12.
PRECHARGE ALL uses tRPA = tRP + tCK on 8-bank devices (datasheet note
36), not tRP. The old tRP of 10 hid this.

Only a READ or WRITE without auto precharge can be interrupted 2 tCK
later (Figs. 49, 61). After RDA or WRA the next READ or WRITE to another
bank needs BL/2 (Tables 42, 43). There was no WRA-to-WR rule at all, so
a WR one cycle after a WRA was accepted.
@jan-o-e
jan-o-e self-requested a review November 26, 2026 09:34
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