S426 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S4 · Lesson 26 · DRAM

Banks, rows and the row buffer, timing parameters, bandwidth, refresh and memory controllers

Main memory is DRAM: each bit a capacitor and a transistor, packed so densely that a single chip holds billions of them. The density comes at a cost. Reading a row of cells drains them, so the whole row is copied into a row buffer first, and that copy takes time; the cells leak, so every row must be refreshed every few tens of milliseconds; and the interface runs far slower than the processor. A memory access that finds its row already open in the buffer costs about a third of one that doesn't, so memory controllers reorder requests to hit open rows, and good data layouts matter as much as raw bandwidth.

  • Average DRAM access latency against the row-buffer hit rate h. A hit needs only the column access, tCL; a miss to a bank with another row open needs a precharge, an activate and the column access, tRP+tRCD+tCL.
  • With DDR4-3200 timings of 22-22-22 cycles at 1600 MHz, each step is 13.75 ns: a hit costs 13.75 ns and a miss 41.25 ns (plus the burst itself).
  • The readout gives the channel's peak bandwidth: transfers per second times 8 bytes.

Predict

A DDR4-3200 channel is 64 bits wide. What's its peak bandwidth?

Name it

Organization

A DRAM chip has several banks (16 in DDR4, 32 in DDR5), each an array of rows. A rank of chips works in lockstep to fill a 64-bit channel; capacity = banks × rows × columns × bits per column.

  • Activate (ACT) copies a row into the bank's row buffer: tRCD before a column command can follow.
  • Read/write (CAS) moves data from the open row: tCL to the first data, then a burst of BL transfers (8 in DDR4, 16 in DDR5).
  • Precharge (PRE) closes the row: tRP before another activate. A row must stay open at least tRAS.

Timings are quoted in clock cycles, CL-tRCD-tRP (such as 22-22-22); in nanoseconds, cycles ÷ clock frequency, where the clock is half the transfer rate.

Hits, misses and conflicts

  • Row hit: tCL.
  • Row empty (bank precharged): tRCD+tCL.
  • Row conflict (another row open): tRP+tRCD+tCL.

An open-page policy leaves rows open, betting on locality; closed-page precharges at once, betting against it. Controllers schedule ready row hits first (FR-FCFS) and spread consecutive lines across banks and channels so their activations overlap.

Bandwidth and refresh

  • Peak bandwidth = transfers per second × bus width × channels. One burst of BL transfers moves BL × 8 bytes, a 64-byte line in DDR4.
  • Every row must be refreshed within 64 ms. The controller issues a refresh command every tREFI (7.8 µs) that blocks the rank for tRFC (hundreds of ns), losing a fraction tRFC/tREFI of the time.

Worked example

DDR4-3200 with 22-22-22 timings: what are the hit and conflict latencies, the time to move a 64-byte line, and the average latency at a 60% hit rate (all misses conflicts)?

Show the solution
  1. One timing in nanoseconds. The clock is 1600 MHz, so 22cycles=13.75ns
  2. Hit and conflict. A row hit takes 13.75 ns, and a conflict takes 3×13.75=41.25ns
  3. Moving the line. The burst of 8 transfers at 3200 MT/s takes 2.5 ns.
  4. Average at h = 0.6. t=0.6×13.75+0.4×41.25=24.75ns before the burst, against 35.75 ns at h = 0.2.

Answer 13.75 ns for a hit and 41.25 ns for a conflict, 2.5 ns to move the line, and 24.75 ns on average at a 60% hit rate (before the burst).

Worked example

With tREFI = 7.8 µs and tRFC = 350 ns, what fraction of time does refresh take, and how many refresh commands cover the 64 ms retention period?

Show the solution
  1. Refresh overhead. 350/7800=4.5% of the rank's time.
  2. Refresh commands. 64ms/7.8µs=8205 so each refresh covers about 1/8192 of the rows.
  3. Density. Larger chips need longer tRFC, which is why refresh overhead grows with density and why DDR5 can refresh banks individually.

Answer refresh takes 4.5% of the time, and about 8205 commands cover the 64 ms retention period.

Worked example

A DDR4 chip has 16 banks of 65 536 rows, each with 1024 columns of 8 bits. What is its capacity, and what does a rank of eight such chips hold?

Show the solution
  1. Chip capacity. C=16×65536×1024×8=8.6×109bits which is 8 Gb.
  2. The rank. Eight chips side by side fill a 64-bit channel, each supplying 8 bits of every transfer: 8×8Gb=64Gb an 8 GB rank.

Answer each chip holds 8 Gb, and the rank of eight holds 64 Gb, 8 GB.

Check

A system has 1 channels of 64-bit DRAM at 3200 MT/s. What's its peak bandwidth?

Check

A row hits 0.55 of the time; every miss is a conflict. With tCL = 12, tRCD = 16 and tRP = 17 ns, what's the average latency to the first data?

Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.

Check

A DRAM timing is 22 cycles at a 1200 MHz clock. How many nanoseconds is that?

Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.

Check

Each refresh blocks a rank for 350 ns, once every 3.9 µs. What fraction of time is lost?

Check

A DRAM chip has 16 banks of 32768 rows, each row with 1024 columns of 16 bits. What's its capacity?

Write units the way you normally would: 1.5 Gbit, 1500 Mbit and 0.0015 Tbit are the same answer.

Check

A burst of 8 transfers runs at 3200 MT/s. How long does it take?

Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.

Check

A DRAM runs at 3200 MT/s with CL = tRCD = tRP = 16 clock cycles and bursts of 16 transfers on a 64-bit bus.

(a)

What is a row hit's latency?

Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.

(b)

And a row conflict's?

(c)

How long does one burst take on the bus, and so how often can the bus carry 16 × 8 bytes?

Check

A DRAM controller sees a row-hit rate h; misses are conflicts. tCL = a, tRCD = b, tRP = c (in ns). Refresh blocks the rank R ns every F ns.

Step 1

What is the average latency?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why do memory controllers reorder requests instead of serving them in the order they arrive?

Practice

Keep practicing

10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.