Skip to main content
Be Bitwise

DRAM Fundamentals

Memory Technology · Hardware Foundations track

11 min read

In this module

One Transistor, One Capacitor

Main memory in every modern computer is built from Dynamic RAM (DRAM). Where SRAM burns six transistors per bit, DRAM stores each bit with just one transistor and one capacitor (the 1T1C cell). That radical simplicity is why your machine can pack 16 or 32 gigabytes of main memory. DRAM hits roughly 10 to 20 times the density of SRAM, at a fraction of the cost per bit.

You pay for that density in speed and complexity. DRAM is slower than SRAM, its reads destroy what they read, and it has to be refreshed constantly or it forgets. Understanding these mechanisms matters for reasoning about system performance and memory controller behaviour.

The 1T1C Cell

A DRAM cell consists of:

  • One NMOS access transistor: its gate connects to the word line, its source to the bit line, and its drain to the storage capacitor.
  • One storage capacitor (typically 20-30 femtofarads): stores charge that represents a logical 0 or 1.

To store a 1, charge the capacitor to VDD. To store a 0, drain it to ground. The access transistor acts as a gate: pull the word line low, the transistor switches off, and the capacitor sits there isolated, holding whatever charge it had.

Why 'Dynamic'?

"Dynamic" because the charge keeps slipping away. The capacitor is leaky: subthreshold leakage through the access transistor, junction leakage in the capacitor itself, all conspiring to bleed charge over time. Within tens to hundreds of milliseconds, the stored voltage has degraded enough that the bit becomes unreadable. So DRAM has to be refreshed on a schedule, every cell read and rewritten before its charge slides too far.

Destructive Reads

Reading a DRAM cell works nothing like reading SRAM. The process is destructive. The act of reading partially erases what was there.

The Read Sequence

  1. Precharge: the bit line is precharged to VDD/2 (half the supply voltage). This sets a known reference point.

  2. Word line assertion: the word line goes high, turning on the access transistor and connecting the storage capacitor to the bit line.

  3. Charge sharing: the capacitor's charge redistributes between the small storage capacitor (roughly 10-20 fF in modern cells; older generations ran nearer 25-30 fF) and the bit line capacitance, which is several times larger. If the cell stored a 1 (capacitor at VDD), the bit line voltage rises slightly above VDD/2. If the cell stored a 0 (capacitor at ground), the bit line voltage drops slightly below VDD/2.

  4. Sense amplification: the sense amplifier compares the bit line voltage to VDD/2 and amplifies the tiny difference (typically 100-200 mV) to a full logic swing.

  5. Restore (write-back): because charge sharing degraded the capacitor's voltage, the sense amplifier drives the bit line to the full value (VDD for 1, ground for 0), recharging the capacitor to its original state.

Getting the first data out of a closed row takes roughly 20-30 ns on DDR4 (the timing example below works one through), and the full cycle of activate, read, restore and precharge (tRC) is around 45-50 ns before the same bank can open another row. An on-chip SRAM cache answers in a nanosecond or two.

Why Destructive Reads Matter

Destructive reads ripple out into the architecture:

  • Every read is also a write: the restore step costs you time and energy. You can't read a cell without rewriting it on the way out.
  • Row access latency: activating a row reads every cell in that row at once, because the sense amplifiers for every column fire together.
  • Bank conflicts: while a row sits in sense-and-restore, the bank is tied up and won't serve any other request to a different row in that bank.

Refresh

Charge leaks, so the whole memory has to be refreshed on a schedule. JEDEC requires every row to be refreshed within a retention time window, typically 64 milliseconds at standard operating temperatures.

How Refresh Works

A refresh operation is essentially a read followed by a restore. The memory controller (or an on-die refresh engine in modern DRAM) issues a refresh command that activates a row, allows the sense amplifiers to detect and amplify the stored values, and writes them back at full strength.

Try it on a single cell. Press Leak Charge a few times and watch the capacitor drain until the cell flags that it needs a refresh, then press Refresh to restore it. A Read also leaves the cell asking for a restore, which is the destructive read from the previous section. Flip to the SRAM tab for contrast: no leak button, because a latch doesn't leak its state away.

Memory Cell Operation

Word Line
LOW
1T1C Cell
1
Charge: 100%
Bit Line
---
Idle

The 1T1C DRAM cell stores a bit as charge on a tiny capacitor. Reading is destructive: asserting the word line shares the capacitor's charge with the bit line, draining the cell. The sense amplifier detects the voltage change and rewrites the value. DRAM must be refreshed every 64 ms to prevent data loss from charge leakage.

DDR4 doesn't refresh one row per command. The controller issues 8192 refresh (REF) commands per 64 ms window, one every tREFI = 64 ms / 8192 ≈ 7.8 microseconds, and the DRAM's internal counter decides which rows each one covers. A single REF refreshes several rows in every bank at once, and the whole chip is busy for tRFC: about 160 ns for a 2 Gb DDR4 die, 350 ns for 8 Gb and 550 ns for 16 Gb. Denser chips have more rows to get through per command, so tRFC keeps climbing.

The Refresh Overhead

Refresh isn't free:

  • Bandwidth cost: while a refresh runs, the banks it covers won't service normal reads or writes. The fraction of time lost is roughly tRFC / tREFI: for an 8 Gb DDR4 die, 350 ns / 7.8 µs ≈ 4.5%, and for 16 Gb, 550 ns / 7.8 µs ≈ 7%. Hot DRAM in 2x refresh mode doubles it.
  • Power cost: every refresh fires the sense amplifiers across a whole row, burning dynamic power.
  • Scaling challenge: more rows per bank means more refresh. At very high densities, refresh can swallow 20-30% of bandwidth, which is why techniques like targeted refresh and per-bank refresh (DDR5's same-bank refresh, which leaves the other banks free) exist to spread the pain more evenly.
Temperature and Retention

Leakage current rises exponentially with temperature. Past 85 degrees Celsius, retention time drops and refresh has to happen more often. Some DRAM specs define a "2x refresh" mode that halves the refresh interval for hot operation. Server-grade memory controllers watch the DIMM's temperature sensors and dial refresh rates up as the chips heat up.

DRAM Array Organisation

DRAM arrays are organised hierarchically: cells form rows, rows form sub-arrays, sub-arrays form banks, and banks form ranks and channels.

Banks and Row Buffers

Each bank carries its own array of rows and its own set of sense amplifiers. Those sense amplifiers, taken together, are the row buffer. Once a row is activated, its entire contents sit there in the buffer, waiting for column accesses.

A modern DDR4 chip has 16 banks grouped into 4 bank groups. DDR5 doubles this to 32 banks in 8 bank groups. Multiple banks can be active at once, which gives you bank-level parallelism. While one bank is refreshing or activating a row, another can be pumping data out the door.

DRAM Timing Parameters

DRAM timing comes down to a handful of parameters you'll see on memory specs like DDR4-3200 CL16. Decoding these numbers reveals what each operation actually costs.

The Key Timings

tRCD (RAS to CAS Delay): how long after issuing a row activation command (ACT) you have to wait before firing the first column command (READ or WRITE). Covers the word line rising, charge sharing, and the sense amplifiers settling. Typical values: 12-18 clock cycles.

tCAS (CAS Latency, also called CL): time from issuing a column read command until valid data shows up on the data pins. The column multiplexer picks the requested columns out of the row buffer and routes them to the output drivers. Typical values: 14-22 clock cycles.

tRP (Row Precharge): how long to deactivate the current row and precharge the bit lines back to VDD/2 before activating a different row in the same bank. Typical values: 12-18 clock cycles.

tRAS (Row Active Time): minimum dwell time a row has to stay active before you're allowed to precharge it. Ensures the sense amplifiers have fully restored cell data. On DDR4 it's typically around 32-35 ns, well over tRCD, and tRAS + tRP gives the row cycle time tRC.

Putting It Together

A complete access to a closed row (no row currently active in the bank) requires:

c
Total latency = tRP (if row was open) + tRCD + tCAS

For DDR4-3200 CL16 with tRCD=16, tCAS=16, tRP=16 at a clock of 1600 MHz (0.625 ns per cycle):

c
Minimum closed-row latency = (16 + 16) cycles = 32 cycles = 20 ns
With precharge: (16 + 16 + 16) cycles = 48 cycles = 30 ns

Row Buffer Hits, Misses, and Conflicts

The row buffer dictates DRAM performance. Three cases to know:

Row buffer hit: the data you want sits in a row that's already active in the buffer. Just fire the column command (tCAS latency). Fastest case.

Row buffer miss (closed page): no row is active. The controller has to send an activate (tRCD) and then a column command (tCAS). Slower than a hit by tRCD.

Row buffer conflict: a different row is currently active in the buffer. Now the controller has to precharge the old row (tRP), activate the new one (tRCD), then issue the column command (tCAS). Worst case.

Access TypeOperationsLatency
Row buffer hitCAS onlytCAS
Row buffer missACT + CAStRCD + tCAS
Row buffer conflictPRE + ACT + CAStRP + tRCD + tCAS
Key Concept
Access Pattern Sensitivity

DRAM performance is highly sensitive to access patterns. Sequential accesses within the same row achieve row buffer hits and deliver near-peak bandwidth. Random accesses across different rows cause row buffer conflicts, increasing latency by 2-3 times. This is why memory access locality - both spatial and temporal - matters so much for performance, and why memory controllers go to great lengths to reorder requests to maximise row buffer hits.

Memory Controller Scheduling

The memory controller's job is translating processor memory requests into the exact dance of DRAM commands (activate, read, write, precharge, refresh), all while obeying every timing constraint.

Open-Page vs Closed-Page Policies

Open-page policy: leave the row buffer active after an access. The optimist's bet that the next access will hit the same row. Great for sequential or locality-rich workloads, painful when accesses are scattered.

Closed-page policy: precharge the row right after each access. The pessimist's bet that the next access will land on a different row. Avoids conflict penalties at the cost of paying tRCD every single time.

Modern controllers run adaptive policies that look at recent access history and guess whether to keep the row open or close it.

Request Reordering

Memory controllers keep a queue of pending requests and shuffle them to maximise row buffer hits and bank-level parallelism. A request that lands on an already-open row can jump the queue past an earlier request that needs a row activation, as long as data dependencies stay intact.

This reordering is one reason memory latency can swing wildly depending on access patterns. The controller is chasing throughput, not honouring strict FIFO order.

Rowhammer

Hammer the same DRAM row at high frequency and bits start flipping in physically adjacent rows. This is Rowhammer. The frenetic charge movement from repeated activation disturbs neighbouring cells, making them bleed charge faster than they should. Attackers have wielded Rowhammer to escalate privileges, break out of sandboxes, and corrupt page table entries. Modern DRAM ships with mitigations like Target Row Refresh (TRR), which detects hot rows and refreshes their neighbours, but TRR keeps getting bypassed: Blacksmith (2021) used carefully timed, non-uniform hammering patterns to flip bits on every DDR4 module tested, and Google's Half-Double (2021) showed flips two rows away from the hammered one. DDR5 adds Refresh Management (RFM), where the controller tells the DRAM when a bank has seen many activations, and JEDEC's 2024 update added Per-Row Activation Counting (PRAC), which counts activations per row inside the DRAM itself. The cat-and-mouse game continues.