Memory Self-Test and the Handoff of the Port
A scan chain cannot reach the cells of a memory. So a small controller on the chip writes every word, reads it back and reports two bits. While it works, it owns the memory.
You Will Be Able To
- Explain why a memory gets a test controller of its own, and what the controller reports.
- Show why a pattern must be followed by its opposite.
- Describe the handoff of the memory port, and what the test does to the content.
- Lesson
- S8.11
- Time
- 25 min
- Runs on
- Your browser
- Check
- 5 questions
A scan test passed, and the chip still lost data in the field. The fault sat in one cell of the memory, a cell that always read 1. No scan flip-flop had ever stored a bit in it.
Before You Start
You need Test Hooks at Chip Level: the tester, and why a chip carries routes for test alone.
You need Memory and Caches in One Picture: a memory is words at addresses, reached by a read or a write.
| Question | |
|---|---|
| 1 | Why does a memory need a test of its own? |
| 2 | What does the test controller report, and through how many bits? |
| 3 | Why is one pattern not enough? |
| 4 | Who may use the memory while the test runs? |
| 5 | A memory, two patterns and one faulty cell: which read goes wrong? |
The Idea: The Chip Tests Its Own Memory
A memory holds most of the transistors of many chips. Its cells are not flip-flops, and no scan chain runs through them. The only way to a cell is the port: give an address, then write or read.
A tester could do that through the pins, word by word. It would take far too long. So the chip does the work itself. A small state machine sits next to the memory. It writes a known pattern to every word, reads every word back, and compares. This is a built-in self-test, and for a memory it is called MBIST.
The tester only says start, and waits. The answer is two bits. The done bit says that the test has finished. The fail bit says that at least one read came back wrong.
Two things follow. One pattern cannot find every bad cell, so the controller writes a second one. And the memory has one port, so the test and the function cannot both use it. The port is handed over, and handed back.
New Words
| Word | Meaning |
|---|---|
| Built-in self-test | A test that the chip runs on itself, with logic added for that purpose. |
| MBIST | Memory built-in self-test: a controller that writes a memory, reads it back and compares. |
| Test controller | The state machine that runs a self-test. Here it makes the addresses, the data and the comparison. |
| Checkerboard | A pattern of 0s and 1s in turn, such as 0101 in one word and 1010 in the next. |
| Stuck cell | A faulty memory cell that reads the same value whatever is written to it. |
| Done bit and fail bit | The two result bits of a self-test: it has finished, and it found a wrong read. This page calls them done and fail. |
| Handoff of the port | The moment at which the right to use the memory port passes to the test, or back to the function side. |
One Picture: Two Users, One Port
- Processor
- Debug
- Control / FSM
- Memory
- At work
The function side reads and writes the memory through its one port. No scan chain runs through the cells.
- A controller on the chip
A small state machine next to the memory can write every word and read it back. It needs no tester for that, only a start.
- One owner
A mux at the port chooses the owner. While the test owns the port, the function side is shut out.
- Two bits
The whole answer is two bits. Done says that the test has finished. Fail says that some read came back wrong.
Read the diagram as text
- Function side: the logic that uses the memory in normal work
- Test controller: a small state machine: it writes, reads back and compares
- Port mux: one owner at a time: function or test
- Memory: words of cells, reached only through its port
- Result: two bits: done and fail
- Function side → Port mux: address, data, write
- Port mux → Memory: the port
- Test controller → Port mux: address, data, write
- Memory → Test controller: read data
- Test controller → Result: done, fail
Memory self-test. The pins of the chip carry a start and two result bits, not the data of the memory.
The Smallest Example, Worked by Hand
Take a memory of two words, four bits each. One cell is faulty: bit 0 of word 0 always reads 1. No simulator yet. The controller writes 0101 to even words and 1010 to odd words. Then it writes the opposite.
| Pass | Word | Written | Read back | Verdict |
|---|---|---|---|---|
| 1 | 0 | 0101 | 0101 | Good. The pattern wants a 1 in bit 0, and the stuck cell gives a 1. |
| 1 | 1 | 1010 | 1010 | Good. |
| 2 | 0 | 1010 | 1011 | Bad. The pattern wants a 0 in bit 0, and the cell still gives a 1. |
| 2 | 1 | 0101 | 0101 | Good. |
Read the first row. The fault is there, and the read is right. A stuck cell agrees with any pattern that happens to want its value.
Read the third row. The opposite pattern asks the same cell for a 0. Now the read is wrong, and fail becomes 1. After both passes every cell has been asked for a 0 and for a 1.
The Rules
Rule 1: A memory is tested through its port, by a controller on the chip.
The tester gives a start and reads two bits.
Rule 2: Every cell must be asked for a 0 and for a 1.
So a pattern is followed by its opposite. One pattern leaves half the stuck cells unseen.
Rule 3: Fail means something only when done is 1.
Fail at 0 with done at 0 is a test that has not finished, or never started.
Rule 4: The port has one owner at a time.
A mux at the address, the data and the write input gives it to the function side or to the test.
Rule 5: The test destroys the content.
After it, every word holds the last pattern. Whatever the function had stored is gone.
Rule 6: The handoff is planned in the function, not added after it.
The function must finish its last write and stop asking before the test takes the port.
Sources for These Rules
Memory self-test with a mux on the address, data and control inputs, a state machine, a checkerboard and then its opposite: Weste and Harris, CMOS VLSI Design, fourth edition, section 15.6.3.2.
Built-in self-test in general: the same book, section 15.6.3.
Rules 3, 5 and 6 are common practice. Our reference library holds no standard for memory self-test, and no source that states them.
The two words, the four bits and the edges of the controller are choices of our lab.
Now Run It
The lab at the end of this page has a memory of two words, the port mux and a test controller. Test code plays both the function side and the tester. This memory is healthy.
e2 function writes word 0: 1001
the test controller owns the port
e4 start
e5 test writes word 0: 0101
e6 function write refused: the test owns the port
e6 test writes word 1: 1010
e7 test reads word 0: wants 0101, gets 0101
e8 test reads word 1: wants 1010, gets 1010
e9 test writes word 0: 1010
e10 test writes word 1: 0101
e11 test reads word 0: wants 1010, gets 1010
e12 test reads word 1: wants 0101, gets 0101
e12 done=1 fail=0 bad reads=0
the function side owns the port
e14 function reads word 0: 1010Rule 4 at work, in the row at e6 that says "refused". The function side tried to write while the test owned the port. Its write did not reach the memory.
Rule 2, in the rows from e5 to e12. Pass 1 writes 0101 and 1010 and reads them back. Pass 2 writes the opposite and reads again. Every cell held a 0 once and a 1 once.
Rule 3, in the row "done=1 fail=0". Both bits are needed to say that this memory passed.
Rule 5, in the last row. Before the test, word 0 held 1001. After the handoff back, the function side reads 1010: the pattern of pass 2.
Now the stuck cell of the hand example. With that fault in the lab, the read at e7 still gets 0101. The read at e11 prints "wants 1010, gets 1011, a bad read", and the result row reads "done=1 fail=1 bad reads=1".
This lab leaves things out. The controller is test code, not a circuit of the chip. Two patterns find a cell that is stuck. They do not find every fault of a real memory, such as one cell that disturbs its neighbour.
Why It Is Built This Way
| Design choice | The alternative | What the choice buys, and costs |
|---|---|---|
| A controller on the chip | The tester writes and reads each word through the pins | The test runs at the speed of the chip and needs three pins. The controller and the mux take area. |
| A mux at the port | Test the memory through the function logic | The test reaches every address directly. The mux sits in the fastest path of the memory. |
| Two result bits | Send every wrong word to the tester | A simple answer for the factory. To find which cell failed, more logic is needed. |
The Trap: A Test That Never Started
A start-up program ran the memory test on every power-up. It wrote the start bit, read fail, saw 0 and went on. For a year every chip passed. Then someone found that the test had never run.
The handoff was missing. The port mux still pointed at the function side, so the controller ignored the start. Our lab shows it: "start ignored: the function side owns the port", and ten edges later "done=0 fail=0". The program had read only half of the answer. Fail at 0 proves nothing until done is 1.
A second trap is the content. A chip ran its memory test in the field, as a health check, and came back with an empty buffer. The test had done what rule 5 says. Anything the function still needs must be saved before the handoff, or the test must wait.
The third trap is a late write. A DMA job was still running when the test took the port. Its last bytes were refused, as in row e6, and nobody was told.
At Scale
This section looks ahead. Two words become millions, and one memory becomes hundreds.
Longer sequences
Real controllers walk through the addresses several times, up and down. That also finds a cell which disturbs its neighbour.
Many memories, few controllers
One controller can serve several memories in turn. Running them all at once may draw more power than the chip can supply.
Repair
A large memory carries spare rows. A controller that reports which word failed lets the factory switch a spare in.
A ROM
A ROM cannot be written. Its content is read out and pressed into one short number, which is compared with the right one.
Try It
Run the lab. Find the four rows that start with "test reads", and check each against the pattern of its pass.
Find the line under the comment "One faulty cell to study", and change its 0 to 1. Bit 0 of word 0 now always reads 1. Which read goes wrong, and in which pass?
Set WORDS to 4. On which edge does done rise now?
Names Printed by the Lab
| Name | Meaning |
|---|---|
| e1, e2, ... | Rising edges of the clock. A row shows what happened on that edge. |
| word 0, word 1 | The two words of the memory. Each has four bits, written from bit 3 down to bit 0. |
| wants, gets | The pattern that the controller wrote to that word, and what the read returned. |
| bad reads | How many reads returned something other than the pattern. |
e2 function writes word 0: 1001 the test controller owns the port e4 start e5 test writes word 0: 0101 e6 function write refused: the test owns the port e6 test writes word 1: 1010 e7 test reads word 0: wants 0101, gets 0101 e8 test reads word 1: wants 1010, gets 1010 e9 test writes word 0: 1010 e10 test writes word 1: 0101 e11 test reads word 0: wants 1010, gets 1010 e12 test reads word 1: wants 0101, gets 0101 e12 done=1 fail=0 bad reads=0 the function side owns the port e14 function reads word 0: 1010Check Yourself
Common Mistakes
Wrong Read fail and ignore done.
A test that never ran also shows fail at 0.
Fix Wait for done at 1, then read fail.
Wrong Write one pattern and call the memory tested.
A stuck cell agrees with a pattern that wants its value.
Fix Follow each pattern with its opposite.
Wrong Expect the content to survive the test.
Every word ends with the last pattern.
Fix Save what the function needs, or run the test before the memory is used.
Remember
- A controller on the chip writes the memory, reads it back and reports done and fail.
- A pattern is followed by its opposite, so that every cell holds a 0 and a 1.
- Fail means something only when done is 1.
- The port has one owner, and the test destroys the content.