---
title: Memory devices
heading: How a bit is stored as a latch, a charge on a tiny capacitor or charge trapped in a gate, the SRAM cell, the DRAM cell with its charge sharing, leakage and refresh, flash memory with several bits per cell, and the newer resistive and magnetic memories
eyebrow: D6 · Lesson 8 · Memory devices
xp: 40
---

::: hook
A smartphone holds three very different kinds of memory, each a different physical way of keeping a bit. SRAM, inside the processor, is a pair of cross-coupled inverters that hold a 1 or 0 as long as power stays on: fast but bulky. DRAM stores each bit as a few femtocoulombs on a capacitor smaller than a bacterium, which leaks away and must be refreshed many times a second. Flash traps electrons in an insulated layer where they stay for years with the power off. Their trade-offs of speed, density, cost and persistence explain why computers have a memory hierarchy at all.
:::

::: play
- A DRAM read: the cell's capacitor $C_s$, charged to $V_{DD}$ or 0, is connected to a bitline of capacitance $C_{bl}$ precharged to $V_{DD}/2$. The charge shares, moving the bitline by $\pm\frac{V_{DD}}{2}\frac{C_s}{C_s + C_{bl}}$.
- A sense amplifier must detect that small swing. Long bitlines (large $C_{bl}$) and shrinking cells (small $C_s$) both shrink it.
- The readout gives the swing for $V_{DD}$ = 1.1 V.
:::

```sim plot
view: graph
x: c = 5..50
y: d = 0..300
slider: b = 20..300 step 5 = 80
plot: 0.55*c/(c + b)*1000 | samples: 300 | label: bitline swing, mV (c = cell capacitance in fF)
marker: x = 20 | label: 20 fF cell
readout: swing with a 20 fF cell, mV = 0.55*20/(20 + b)*1000 | digits: 3
```

::: predict
## A 20 fF DRAM cell at 1.1 V shares its charge with an 80 fF bitline precharged to 0.55 V. How much does the bitline move?

- [ ] 0.55 V
- [ ] 1.1 V
- [x] 110 mV
- [ ] 11 mV

::: reveal
The cell starts 0.55 V away from the bitline, and after sharing the bitline has moved by 0.55 × 20/(20 + 80) = 0.11 V. The sense amplifier, a latch balanced on the bitline pair, amplifies that 110 mV to a full logic level, which also writes the value back into the cell, since the read destroyed it.
:::
:::

::: nameit
## SRAM

Six transistors: two cross-coupled inverters that hold the bit, and two access transistors connecting them to a pair of bitlines. Reads are fast and non-destructive; the cell needs no refresh but occupies about 100 to 150 F² (F being the feature size). It's used for caches and registers.

## DRAM

One transistor and one capacitor, about 6 F². A read connects the cell to its bitline and shares charge, giving a swing of

$$\Delta V = \frac{V_{DD}}{2}\cdot\frac{C_s}{C_s + C_{bl}}$$

The stored charge leaks away through the access transistor and junctions; the time for a leakage current I to droop the cell by ΔV is $t = C_s\Delta V/I$. Every row is therefore rewritten every 64 ms (refresh), spread out so that one of the rows is refreshed every $t_\text{REF}/N_\text{rows}$.

## Flash

A transistor with an extra, insulated gate (floating gate or charge-trap layer) under its control gate. Tunneling electrons onto it raises the threshold voltage; reading checks whether the transistor turns on at a given gate voltage. Packing $2^b$ threshold levels into a window stores b bits per cell: SLC 1, MLC 2, TLC 3, QLC 4, with the levels spaced by the window over $(2^b - 1)$. More bits per cell means less margin, slower writes and fewer program–erase cycles. 3D NAND stacks more than 200 layers of cells vertically.

## Newer memories

- **MRAM**: a magnetic tunnel junction whose resistance depends on whether two magnetic layers are parallel.
- **ReRAM** and **phase-change memory**: a material switched between high and low resistance by forming filaments or by melting and crystallizing.

All are non-volatile and faster than flash, aiming to fill the gap between DRAM and storage.
:::

::: example
## A 20 fF cell may droop by 0.3 V before it becomes unreadable. If it leaks 10 fA, how long does it hold? How often is each of 8192 rows refreshed?

::: solution
1. **Retention time.**
   $$\begin{aligned} t &= \frac{20\ \text{fF} \times 0.3\ \text{V}}{10\ \text{fA}} \\ &= 0.6\ \text{s} \end{aligned}$$
   comfortably beyond the 64 ms refresh period (worst-case cells at high temperature leak far more).
2. **Row refresh interval.**
   $$\frac{64\ \text{ms}}{8192} = 7.8\ \mu\text{s}$$

**Answer:** the cell holds for 0.6 s, and one row is refreshed every 7.8 µs.
:::
:::

::: example
## A flash cell has a 6 V threshold window. How far apart are the levels for TLC and for QLC?

::: solution
1. **TLC.** It needs 8 levels, 7 gaps across the window:
   $$\frac{6\ \text{V}}{7} = 0.86\ \text{V}$$
2. **QLC.** It needs 16 levels:
   $$\frac{6\ \text{V}}{15} = 0.40\ \text{V}$$
3. **Errors.** Charge loss or noise of a few tenths of a volt then causes errors, which strong error correction (D4) handles.

**Answer:** the levels are 0.86 V apart for TLC and 0.40 V apart for QLC.
:::
:::

::: example
## A 20 fF DRAM cell storing 1 V is connected to a 100 fF bit line precharged to 0.5 V. What signal does the sense amplifier see?

::: solution
1. **Charge sharing.**
   $$\begin{aligned} V &= \frac{20 \times 1 + 100 \times 0.5}{120}\ \text{V} \\ &= 0.583\ \text{V} \end{aligned}$$
2. **Signal.** That's a swing of 83 mV above the precharge level.
3. **Bit-line length.** Bigger bit lines would shrink it further, which is why DRAM arrays are cut into short segments.

**Answer:** the sense amplifier sees 83 mV above the 0.5 V precharge.
:::
:::

::: check
given: s = 10 | 20 | 30; b = 50 | 100 | 200; v = 1.1 | 1.2
answer: v/2*s/(s + b)*1000
unit: mV
tolerance: 0.5%

## A {s} fF DRAM cell at {v} V shares charge with a {b} fF bitline precharged to $V_{DD}/2$. How far does the bitline move?

::: right
Right. $(V_{DD}/2)C_s/(C_s + C_{bl})$ = {answer} mV.
:::

::: misses
- [v*s/(s + b)*1000] The bitline starts halfway: the cell is only $V_{DD}/2$ away from it.
- [v/2*s/b*1000] Charge spreads over both capacitances: $C_s + C_{bl}$.
- [any] Not yet. Charge sharing.
:::
:::

::: check
given: s = 10 | 25; d = 0.2 | 0.4; I = 1 | 10 | 100
answer: s*d/I
unit: s
tolerance: 0.5%

## A {s} fF cell can droop {d} V before failing and leaks {I} fA. How long can it go between refreshes?

::: right
Right. $C\Delta V/I$ = {answer} s.
:::

::: misses
- [any] Not yet. Charge it can lose over the leakage current.
:::
:::

::: check
given: t = 32 | 64; n = 4096 | 8192 | 16384
answer: t*1000/n
unit: µs
tolerance: 0.5%

## A DRAM refreshes all {n} rows every {t} ms, spread evenly. How often does it refresh a row?

::: right
Right. $t_\text{REF}/N$ = {answer} µs.
:::

::: misses
- [any] Not yet. The refresh period shared among the rows.
:::
:::

::: check
given: w = 4 | 6 | 8; b = 2 | 3 | 4
answer: w/(2^b - 1)
unit: V
tolerance: 0.5%

## A flash cell has a {w} V threshold window and stores {b} bits. How far apart are its levels?

::: right
Right. $w/(2^b - 1)$ = {answer} V.
:::

::: misses
- [w/2^b] $2^b$ levels have $2^b - 1$ gaps between them.
- [w/b] b bits need $2^b$ levels.
- [any] Not yet. Levels spread across the window.
:::
:::

::: check
kind: parts
given: c = 10 | 20 | 30; b = 60 | 100 | 200; V = 1 | 1.2

## A DRAM cell of {c} fF stores {V} V and shares charge with a {b} fF bit line precharged to half that.

::: part
answer: (V - V/2)*c/(c + b)*1000
unit: mV
tolerance: 0.5%

### How big a signal reaches the sense amplifier?

::: misses
- [(V - V/2)*c/b*1000] Divide by the total capacitance.
- [any] $\Delta V\,C_s/(C_s + C_b)$.
:::
:::

::: part
answer: c*V/(1e-15*1e15)*1e-15/1.602e-19
unit: electrons
tolerance: 0.5%

### How many electrons hold the 1?

::: misses
- [any] $CV/q$.
:::
:::
:::

::: check
kind: parts
given: W = 4 | 6 | 8; b = 2 | 3 | 4

## A flash cell has a {W} V threshold window and stores {b} bits.

::: part
answer: 2^b
tolerance: 0

### How many levels must it distinguish?

::: misses
- [any] $2^b$.
:::
:::

::: part
answer: W/(2^b - 1)
unit: V
tolerance: 0.5%

### How far apart are they?

::: misses
- [W/2^b] There are $2^b - 1$ gaps between $2^b$ levels.
- [any] Window ÷ $(2^b - 1)$.
:::
:::
:::

::: explain
## Why does DRAM need refreshing while SRAM doesn't?

::: model
An SRAM cell holds its bit in two cross-coupled inverters, each driving the other's input, so any small disturbance is actively corrected by the transistors as long as power is applied: the stored state is regenerated continuously. A DRAM cell holds its bit as charge on a tiny capacitor isolated by an access transistor that is off, and no switch is perfectly off: leakage through the transistor and the junctions slowly drains or fills the capacitor. After long enough the voltage drifts past the point where the sense amplifier can tell a one from a zero, so every cell must be read and rewritten periodically, which is what refresh does.
:::
:::

::: practice

::: check
given: s = 5 | 50; b = 20 | 400; v = 0.8 | 1.5
answer: v/2*s/(s + b)*1000
unit: mV
tolerance: 0.5%

## Bitline swing: $C_s$ = {s} fF, $C_{bl}$ = {b} fF, {v} V?

::: misses
- [any] $(V_{DD}/2)C_s/(C_s + C_{bl})$.
:::
:::

::: check
given: w = 2 | 10; b = 1 | 2 | 3 | 4 | 5
answer: w/(2^b - 1)
unit: V
tolerance: 0.5%

## Level spacing: {w} V window, {b} bits per cell?

::: misses
- [any] $w/(2^b - 1)$.
:::
:::
:::
