4.1.15 · D1Memory Technologies

Foundations — ECC and memory error correction

2,507 words11 min readBack to topic

This page assumes you know nothing. We start from what a bit is and end holding every symbol the parent note throws at you. Read top to bottom; each idea is used only after it's built.


1. A bit — the atom of everything

Why we need it: memory is nothing but a huge row of these switches. A "bit flip" — the villain of this whole topic — is simply one switch getting knocked to the wrong position by noise (see Cosmic Rays and Soft Errors).

Figure s01 below draws a bit as a physical switch: the left switch is down (value , violet), the right switch is up (value , magenta), and the orange arrow shows a cosmic ray "flipping" it — knocking a switch to the wrong position. That knock is the single event this whole topic fights.

Figure — ECC and memory error correction

2. A bit-string, and its length

The picture: a row of switches. If someone says "", picture seven switches in a line.

Why the topic needs it: a Hamming codeword is a bit-string, and every counting formula in this topic tallies positions in that string. You can't count positions without a symbol for "how many". We will meet the exact formula in section 5, once we have named all the pieces it counts.


3. Position numbers — counting from 1

The picture: put a tiny tag under each switch: 1, 2, 3, … That numbering is what the treasure-map syndrome will read out.


4. Reading a bit-string as a binary number

Before any "syndrome" can spell an address, we need to agree how a row of bits turns into an ordinary counting number. This is the missing translator between "pattern of bits" and "position 5".

Figure — ECC and memory error correction

Figure s05 stacks the string 101 over its weights and shows the running sum . Keep this picture: when the parent note writes "syndrome ", it is doing exactly this multiply-and-add, with sitting in the MSB (weight ) slot and in the LSB (weight ) slot. The little subscript "" just means "this is written in binary".

Why the topic needs it: a syndrome is a handful of pass/fail bits. Only by reading them with place value (MSB on the left) does that handful become a single position number to flip.


5. Powers of two — and the counting bound

We now name the two quantities the bound will compare:

  • ::: the number of data bits (the actual message).
  • ::: the number of parity / check bits we add.
  • ::: total bits, matching the from section 2.
Figure — ECC and memory error correction

Figure s02 is a bar chart: as climbs the height jumps — each bar twice the last. The orange "×2" arrow marks the doubling. This is why only a few check bits can name many positions.

So the is not a mystery: it is the "all clear" verdict, reserved so that a syndrome of can mean "nothing is wrong" (we cash this in fully in section 9).


6. XOR — the symbol (how a parity check is computed)

Figure — ECC and memory error correction

Figure s03 lines up four bits 1 0 1 1 joined by signs. Three of them are — an odd count — so the whole row collapses to the orange result . Picture: XOR "erases" pairs of s and reports whether one is left over. That single output bit is one parity check.

Why the topic needs it: every parity bit in a Hamming code is set so that its group of bits XORs to (that's "even parity"). When a bit later flips, that group's XOR becomes — the check "fails". No XOR, no check.


7. The parity bit — the simplest ECC there is

The picture: one guard bit watching a row. If exactly one switch flips, the guard notices something is wrong — but shrugs when you ask "which one?". Full story in Parity Bit.

Why the topic needs it: Hamming code is just many parity bits, each watching a cleverly chosen subset, so that together they don't just say "wrong" but say "wrong here". One parity bit is the seed of the whole idea.


8. Hamming distance and

Figure — ECC and memory error correction

Figure s04 stacks over and boxes in orange only the positions where they disagree. Count the orange boxes — that count is . Picture as the shortest such gap anywhere in the codebook.

Why the topic needs it: the entire "can I correct / detect?" question is answered by alone. Detect errors; correct . Those two formulas in the parent note are pure distance geometry — a single flip moves you step, so if legal words are far apart you always land nearest the right one.


9. The floor bracket

Why the topic needs it: correction capability must be a whole number of bits — you can't correct "one and a half" bits. For SECDED, gives : correct exactly one.


10. The syndrome — the treasure map

Why the topic needs it: this is the payoff of every earlier symbol. verdicts (section 5) come from XOR checks (section 6) on subsets picked by binary position numbers (sections 3–4), and the verdict is the location. See Hamming Code for the full construction; Reed-Solomon Codes extend the same idea to whole symbols.


How the foundations feed the topic

Bit 0 or 1

Bit-string length n

Position index from 1

Binary place value MSB and LSB

XOR parity of a group

Single parity bit detect one

Powers of two 2 to the r

Hamming bound checks vs positions

Hamming distance d min

Detect and correct capability

Hamming code many checks

Syndrome equals error address

ECC SECDED in DRAM

The map reads left-to-right into the parent topic: switches become strings, place value turns strings into numbers, XOR turns groups into checks, binary positions turn checks into addresses, and distance tells you how many errors survive.


Equipment checklist

Cover the right side and answer before revealing.

A single storage cell holding 0 or 1 is called a
bit.
The total number of bits in the string we work with is the symbol
.
We number bit positions starting from
1 (one, not zero), across the whole codeword.
In a bit-string the rightmost bit is worth
1 (it is the least significant bit, LSB); weights double leftward 1, 2, 4, 8.
The bit-string 101 read as a binary number equals
5 (that is ).
counts
the number of distinct verdicts yes/no checks can produce.
, , and stand for
data bits, parity bits, and total bits, with .
The "+1" in is there for
the "no error at all" verdict, reserved so a zero syndrome means "all clear".
equals 1 exactly when
the two bits differ (XOR).
Chaining bits with XOR computes their
parity (odd number of 1s → 1).
A single parity bit can detect one error but cannot
locate which bit flipped.
measures
how many positions two equal-length strings disagree in.
is
the smallest distance between any two valid codewords.
means
round down to the nearest whole number.
The syndrome is
the binary number formed by which parity checks failed; it equals the flipped bit's position (0 = no error).