DDR5 Bank Groups and Address Mapping: Why the "Obvious" Mapping Wastes a Third of Your Bandwidth
A memory controller slices every physical address into fields: channel, rank, bank group, bank, row, column, and the byte offset inside a burst.
Which bits go where looks like bookkeeping. It actually decides whether a streaming workload runs at full speed or leaves a third of the bus idle.
A concrete DDR5 setup
Take a DDR5 subchannel built from four x8, 16 Gb chips:
- Each burst is BL16 on a 32-bit bus:
16 ร 4 bytes = 64 bytes, one cache line. - A row across the rank holds about
4 KB, or 64 cache lines. - There are 32 banks, arranged as 8 bank groups of 4.
- A BL16 burst keeps the data bus busy for 8 clocks (16 transfers, 2 per clock).
Why bank groups exist
DRAM cores haven't kept up with interface speeds, so each column access prefetches a wide chunk of data. Banks inside one bank group share part of that internal data path.
Back-to-back column commands to the same group must be spaced by tCCD_L; to different groups, by the shorter tCCD_S.
At DDR5-4800 (tCK โ 0.4167 ns): tCCD_S = 8 clocks, tCCD_L = max(8 nCK, 5 ns) = 12 clocks.
Two mappings, one streaming workload
| Mapping | Bit order (high โ low) | Consecutive cache lines go to |
|---|---|---|
| A: row-interleaved | row ยท BG ยท bank ยท column ยท offset |
Same row, same bank, same bank group |
| B: BG-interleaved | row ยท bank ยท column-high ยท BG ยท offset |
A different bank group each line |
Mapping A feels ideal: every access is a row hit. But every read hits the same bank group, so reads must be 12 clocks apart while each burst uses only 8. The bus is busy 8 of every 12 clocks: about 67% utilization.
Mapping B rotates consecutive lines across all 8 bank groups. Reads only need tCCD_S = 8 clocks apart, so the bus can stay close to 100% busy, and each group still sees row hits as the stream comes back around.
That gap is the whole reason bank groups matter for controller design.
The pathological stride
Under mapping A, column plus offset cover 4 KB, and bank plus bank group cover the next 32 ร 4 KB = 128 KB. A program striding by exactly 128 KB (common with big power-of-two arrays) changes only the row bits.
Every access lands in the same bank with a different row: a row conflict every time, about three times the latency of a hit.
Real controllers fix this by XOR hashing: mixing some low row bits into the bank and bank-group bits. Pathological strides spread out, and sequential access is unaffected. Many controllers make the mapping programmable for exactly this reason.
How to answer "which mapping would you choose?"
State your workload, compute which address field toggles for that access pattern, and say what you'd measure (bandwidth and row-hit rate) to confirm. Showing the bit arithmetic is what makes the answer land.
Cheat sheet DDR5 organization, tCCD_S/L, and every other core timing parameter on one free page: download it here.
For the full worked examples plus 30 interview questions with model answers, see the DRAM & DDR5 Interview Field Guide.
Illustrative organization for a 16 Gb x8 DDR5 device; check your part's datasheet.
Comments
No comments yet. Start the discussion.