Memories hold most of a modern block's state, so a rare bit upset can become a persistent architectural error. Protection adds redundant bits, checking logic, reporting, and a policy for correction and repair.
A planned 32-bit, 1024-word control SRAM is the running integration exercise. The supplied snippets explain parity, SECDED, byte-write read-modify-write, scrub, injection and diagnostic contracts; this topic does not supply a complete protected-memory implementation or executed integration harness.
7 lessons, about 28 min
It changes the interface contract: SECDED can correct one bad bit, detect two, needs syndrome logic and wider storage, and requires policy for reporting and scrubbing corrected words.
The whole topic on one page, taken from each lesson's Remember box. Read it before an interview, or print it.
Failure Model and Protection Choice
Parity detects. SECDED corrects single bits and detects double bits.
A transient error clears on rewrite. A permanent fault recurs at the same cell and needs repair or retirement.
Latent faults accumulate until the word is read or scrubbed.
Rule of thumb: pick the weakest protection that meets the requirement on what happens after an error.
Parity Datapath
Store 32 data bits plus one even-parity bit. Check the XOR on read.
Parity detects any odd number of flips. Two flips cancel.
On an error, latch the address and context, count with a saturating counter, and never return the data without an error indication.
Rule of thumb: state the exact fault coverage in the claim, not just the word protected.
SECDED Encode and Syndrome
32 data bits need six Hamming check bits and one overall parity bit, 39 bits in all.
Nonzero syndrome with odd overall parity is a single-bit error: correct it, and reject a position beyond 38.
Nonzero syndrome with even overall parity is a double-bit error: report it and never correct.
Rule of thumb: freeze the bit layout in one package that encoder, decoder, injection and tests all use.
Correction and Reporting
Carry the request address and tag with the word, and raise one event per decoded read, even when the response is held.
An uncorrectable read must never look like normal data.
Define first-error or last-error capture, and keep it from being overwritten before software reads it.
Rule of thumb: report every correction: a rising rate is the early warning.
Partial Writes and Scrubbing
Read and decode the old word, merge the strobed bytes, re-encode the whole word, then write it back, atomically for that address.
Stop on an uncorrectable old word. Use the corrected data otherwise.
Revisit time = words x slot spacing + any bounded sleep. Starvation or unbounded sleep removes the bound.
Rule of thumb: a scrubber narrows the window for a second upset. It does not close it.
Initialization, Injection, and Signoff
Initialise data and check bits together, track line validity separately from the syndrome, or block reads until written.
A read-path XOR tests the decoder only. A persistent fault needs a test-only raw-codeword write, or a backdoor or MBIST write.
Lock injection controls in production and verify sticky flags, counters and first-error capture through the CSR interface.
Rule of thumb: treat the protection as unproven until every syndrome and response path has been injected.
SECDED on a 32-bit Word, Worked
Check bit 2^b covers every position with bit b set and makes that group even. P at 39 covers all 38 others and is in no check.
Odd parity with syndrome 1 to 38 corrects that position; syndrome 0 with odd parity is P alone; even parity with a nonzero syndrome is UE.
Odd parity with a syndrome above 38 is UE too. Position k lives at vector bit k-1.
Rule of thumb: trust the syndrome only when overall parity is odd and the syndrome names a real position.
Mini project: a two-master bus with decoder, default slave and timeout
Practice question: ECC memory RTL design
Code lab: Even parity generator
Code lab: SECDED encode
Practice question: Byte-enable RAM design with partial write support
Interview: run a mock interview on this topic