Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • RTL Foundations36
  • Combinational Design25
  • Sequential Design27
  • FSM & Control27
  • Timing & Clocking39
  • Reset & CDC34
  • Memory & Buses57
    • SRAM and ROM
    • Register Files
    • Valid/Ready Handshake
    • AXI-Lite
    • AXI-Stream
    • Bus Integration
    • Synchronous FIFO
    • Register-Map and CSR RTL
    • Memory Reliability
      • Failure Model and Protection Choice
      • Parity Datapath
      • SECDED Encode and Syndrome
      • Correction and Reporting
      • Partial Writes and Scrubbing
      • Initialization, Injection, and Signoff
      • SECDED on a 32-bit Word, Worked
    • Peripheral RTL Integration
    • Full AXI4: RTL Roadmap
  • Advanced RTL28
  • Senior & Interview76
  • Glossary and Notation
Loading lesson

‹Memory Reliability
  1. Topics
  2. RTL Design
  3. Memory & Buses
  4. Memory Reliability
  5. Partial Writes and Scrubbing

Part 7 · Memory & Buses · Intermediate

Partial Writes and Scrubbing

Protect byte writes with read-modify-write and periodically rewrite corrected words.

On this page

    Why this matters

    ECC covers the whole word, so a byte write must rebuild the check bits, and a scrubber that writes back an old word can overwrite a newer functional write. Scrubbing also gives no repair guarantee without a service budget.

    After this lesson you can: build an atomic read-modify-write for a byte write, and compute a scrub revisit time from the arbitration budget.

    Why byte writes are hard

    ECC covers the whole word. Updating one byte requires the unchanged bytes to participate in a new codeword.

    A byte write to the running SRAM therefore enters a small read-modify-write transaction. Normal access and scrub arbitration reserve that address until corrected old data has been merged, encoded, and written back, preventing a stale scrub result from overwriting a newer functional write.

    1. Read and decode the old protected word.

    2. Stop if it is uncorrectable; use corrected data if correctable.

    3. Merge selected bytes using write strobes.

    4. Encode and write the complete new protected word.

    This read-modify-write sequence needs arbitration against normal reads/writes and must be atomic for the selected address.

    Flow: reserve the address, which the scrubber also uses; read and decode the old word; if the word is uncorrectable, stop and report with no write; otherwise merge the strobed bytes into the corrected word, encode 39 bits, write the whole word and release the address.
    A byte write to an ECC memory as one locked read-modify-write: reserve the address, decode the old word, stop on an uncorrectable error, otherwise merge, re-encode all 39 bits, write and release

    Read the flow from the top: the address stays reserved from the first box to the last, so no other write or scrub can slip in between.

    • Merge into the corrected word, not the raw one. A correctable error in an untouched byte is repaired by the same write.

    • Stop on UE. Merging into data that cannot be trusted would store bad bits under a fresh, valid codeword.

    • Scrub takes the same lock, so its rewrite of a stale value can never overwrite a newer byte write.

    Scrubbing

    A scrubber walks memory, reads each word, rewrites corrected words, and reports UEs. Scrubbing reduces the window for accumulating faults; it cannot guarantee repair before a second upset. Worst-case revisit time needs a guaranteed service budget, including arbitration, correction writes and sleep.

    Worked bound: 1024 words, single port, one cycle read plus one cycle rewrite reserved for every word, and arbitration guaranteeing those two slots within each 16 active cycles. At 100 MHz a sweep takes at most 1024 x 16 = 16384 active cycles = 163.84 us. If cumulative clock-off time between visits is bounded by 1 ms, maximum revisit including repair is 1.16384 ms. Unbounded functional starvation or sleep removes the finite bound. A pipelined decoder must fit the reserved slots or increase the budget.

    Worked model, assuming independent (Poisson) upsets: assume total upset rate lambda=1e-6 per word-second, no correlated multi-bit upsets, perfect single-bit repair and initialized words. Given a first upset, probability of another before the next repair is at most 1-exp(-lambdaT), approximately 1.164e-9 at that revisit bound. A conservative whole-array pair-rate bound is 1024lambda^2*T = 1.192e-12 per second (about 4.29e-9 per hour). Compare this conditional model to an explicitly allocated residual-risk budget, for example 1e-8 per hour; it is not a device reliability claim. Real signoff needs characterized rates, correlated faults, permanent defects, decoder faults and actual service/sleep bounds.

    Scrubber concern

    Design response

    Functional traffic

    Low-priority arbitration with bounded starvation

    Power

    Programmable rate and sleep awareness

    Reset/init

    Do not scrub until contents and check bits are valid

    Permanent fault

    Escalate repeated-address corrections to repair/retirement

    Check yourself Why can a partial write not simply update the selected data byte and leave ECC unchanged?

    The stored ECC describes the old complete data word. After any data bit changes, the check bits must be regenerated for the merged full word.

    Remember

    • 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.

    How this was checked

    The sweep bound (1024 words at 100 MHz and 16 active cycles per word: 163.84 us, or 1.16384 ms with 1 ms of clock-off time) and the Poisson pair-rate figures are worked arithmetic, not measured results and not a device reliability claim.

    Keep going

    • Practice: Byte-enable RAM design with partial write support

    • Interview: run a mock interview on this topic

    Related topics

    • Initialization, injection, and signoff

    Previous

    236 / 350

    Next: Initialization, Injection, and Signoff

    Up next

    Up nextInitialization, Injection, and Signoff

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Failure Model and Protection Choice
    • Parity Datapath
    • SECDED Encode and Syndrome