March memory testing algorithm (March C-) and how to implement it
Codemia Knowledge Hub ·
A March test detects faults in semiconductor memory by stepping through every address in a fixed order and applying a short sequence of reads and writes to each cell. Each read checks that the cell still holds the value written earlier. March C- is a widely used choice: six elements that detect simple stuck-at and coupling faults.
Terminology
- March element: a sequence of operations applied to each memory cell, with an address order (ascending
↑or descending↓). - March test: a sequence of March elements applied to all cells in memory.
- Operation: a write (
w0,w1) or a read expecting a value (r0,r1).
March C- sequence
(w0)Write 0 to all memory cells.↑ (r0, w1)Read 0 and write 1 while incrementing through memory addresses.↑ (r1, w0)Read 1 and write 0 while incrementing.↓ (r0, w1)Read 0 and write 1 while decrementing through memory addresses.↓ (r1, w0)Read 1 and write 0 while decrementing.(r0)Read 0 from all memory cells.
It balances simplicity with effective detection of the standard faults.
Other March variants
- March A: detects simple address faults.
- March X: detects more complex fault types, including interaction faults between adjacent cells.
Implementation steps
- Initialize memory to a known value to establish a baseline.
- Execute the sequence of read/write operations. Choose the March test based on the faults you want to detect.
- Control the test environment (temperature, voltage variations) to mimic operating conditions.
Fault checks are often expressed in Boolean logic:
- Stuck-at faults: flags a fault when a '1' was written and a '0' is read.
- Address decoding faults: combinations of Boolean operations verify that the address lines work correctly.
Making March tests faster and more targeted
- Parallel testing: test several memory arrays at once to cut test time.
- Adaptive testing: adjust the test based on the first failures detected.
March sequences are usually chosen from fault models:
- Stuck-open faults: detected by consecutive opposite operations where a cell fails to hold the desired state.
- Transition faults: detected by operations that confirm a cell transitions correctly from one state to the other.
March test example
Below is March C- in C, treating each byte of a buffer as one cell. A real test runs on the memory under test with caching disabled:
Each loop is one March element from the sequence above, and the descending loops use i-- > 0 so the unsigned index stops cleanly at address 0.
Related reading
- Implementations of count_until and accumulate_until?
- Implementing a balanced binary search tree?
- Implementing a depth-first tree iterator in Python
- Implementing a Harris corner detector
- In Akka, how can network delays be simulated?
- In Python how should I test if a variable is None, True or False
- Implementing a rhyme finder
- Implementing a simple Trie for efficient Levenshtein Distance calculation - Java

DSA Fundamentals
Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.
View the courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.