A Chip You Cannot Patch
Software ships a fix overnight. A chip cannot. See why every chip is checked before it is built and how the price of a bug grows. Then see why "it compiles" proves almost nothing.
You Will Be Able To
- Explain why hardware is verified before it is built.
- Describe how the cost of a bug grows from code to silicon, as a shape.
- Show that code which compiles and passes a few sums can still be wrong.
- Lesson
- B1.1
- Time
- 18 min
- Runs on
- Your browser
- Check
- 5 questions
A phone app ships with a bug on Monday and a fix on Tuesday. A chip ships with a bug, and the bug is in every copy, cut into silicon. There is no update button for a wire. So how do engineers find the bugs before the chip exists?
- File
- Design
- Test
- Tool
- Result
- Device
- Measure
- External
- Data
- The cheap part of the road
Everything up to layout is files. A bug found here is fixed by editing a line and running the checks again.
- Tape-out
The finished layout goes to the factory. From here on, the design is no longer a file you can edit.
- The expensive part
A bug found now needs new masks and another trip through the factory, or a software work-around, or a recall.
Read the diagram as text
- Idea and specification: what the chip must do
- RTL design: the chip as code
- Verification: simulate and check the code
- Synthesis and layout: code becomes gates, then shapes
- Tape-out: the point of no return
- Fabrication: masks and wafers
- First silicon: the real chip on a lab bench
- In customers' hands: millions of copies
- Idea and specification → RTL design: write
- RTL design → Verification: check
- Verification → Synthesis and layout: build
- Synthesis and layout → Tape-out: send
- Tape-out → Fabrication: make
- Fabrication → First silicon: test
- First silicon → In customers' hands: ship
The flow of a chip project, drawn as a road. Verification sits before tape-out because that is the last place a fix is only an edit.
Before You Start
You need only basic digital logic: gates, a binary adder, a flip-flop. If an adder is new to you, start with Half Adders, Full Adders and Ripple Carry. You have seen a little Verilog or SystemVerilog, enough to read an assign. Nothing else is assumed. This is the first lesson of the Design Verification domain.
| Question | |
|---|---|
| 1 | Why must a chip be checked before it is built? |
| 2 | Where on the road from idea to chip does a bug become expensive? |
| 3 | Why do "it compiles" and a few correct sums prove so little? |
| 4 | What does a check that tries every input find that a few hand checks miss? |
| 5 | Who finds which bugs, and where? |
The Idea: Find It While It Is Still Text
For most of a chip project, the chip is text. Engineers describe it in a hardware language, as RTL code. Tools turn that code into gates, and the gates into the shapes of a layout. While the chip is text, a bug costs an edit and a rerun.
Then comes tape-out. The layout goes to a factory, which makes glass masks and prints the chip onto silicon wafers. From that moment the design is physical. A wrong wire is wrong in every copy, and nothing you type will change it.
Design verification is the work of finding bugs in the design before tape-out. You simulate the RTL, drive its inputs, and check every output against what the chip is supposed to do. A verification engineer reads the same specification as the designer. Then they ask, on their own, "does this code really do that?"
New Words
| Word | Meaning |
|---|---|
| Specification | The document that says what the chip must do. Often shortened to "spec". |
| RTL | Register-transfer level: the chip written as code, flip-flops and the logic between them. |
| Synthesis | The tool step that turns RTL code into gates. |
| Design verification | Checking, before the chip is made, that the RTL does what the specification says. |
| Simulation | Running the RTL in a program, the simulator, that computes every signal, clock by clock. |
| Testbench | Code written around a design to drive its inputs and check its outputs. Often shortened to "bench". |
| Tape-out | Sending the finished layout to the factory. After it, the design can no longer be edited. |
| Smoke test | A quick first check that a design works at all, usually a few inputs picked by hand. |
| Respin | Making the chip again with corrected masks, because the first silicon had a bug. |
| First silicon | The first real chips back from the factory, tested on a lab bench. |
The Price of a Bug, as a Shape
The same bug costs very different amounts depending on where it is found. Read the table from top to bottom. The work grows at each step, and it jumps at tape-out.
| Found during | What the fix takes | Who usually finds it |
|---|---|---|
| Writing the RTL | Edit one line, run the block again | The designer, in a quick test |
| Block verification | Edit, rerun the tests that touch it | The verification engineer |
| Chip-level verification | Find which block, edit, rerun many tests | The chip verification team |
| After tape-out, before masks are made | Change the layout, redo the late checks | A late review, or a simulation of the gates |
| First silicon in the lab | New masks and a respin, or a software work-around | The lab bring-up team |
| In customers' hands | A work-around, a recall, a lost customer | The customer |
No row has a number, on purpose. Costs depend on the chip, the factory and the market. The shape is what matters: cheap and fast before tape-out, slow and expensive after it. One textbook gives a rough rule for that shape; the sources below name it.
The Rules
Rule 1: A chip cannot be patched.
After tape-out every copy carries the same wires. A design bug is fixed only by new masks, or worked around.
Rule 2: Find bugs while the chip is text.
Before tape-out a fix is an edit. Verification exists to move bug finding to this side of the road.
Rule 3: Compiling proves syntax, not behaviour.
A tool accepts any legal code, right or wrong. Only a check against the specification shows the code does the job.
Rule 4: A few right answers prove very little.
Each check covers the inputs it tried and nothing else. Untried inputs are unknown, not correct.
Sources for These Rules
Spear and Tumbush, SystemVerilog for Verification, 3rd ed. (2012), section 1.1: the verifier makes an independent reading of the specification; section 1.1.1: bugs found at block, integration and system level.
Spear and Tumbush (2012), section 1.15, gives a rough rule for the shape. The cost of a fix grows about tenfold at each step, from specification to the field. That is the book's figure, not a measurement on this site.
Mehta, ASIC/SoC Functional Design Verification (2018), section 1.1: verification takes a large share of project effort. Section 1.2 shows a market study from 2002 and 2004. In it, logic and functional flaws lead the causes of respins.
Mehta (2018), section 15.2: the product flow from specification to release. Section 15.5: verification should drive the design, not follow it.
The Lab: One Wrong Line
The lab holds adder4, a 4-bit adder written one bit at a time. Each bit adds a, b and the carry from the bit below. One line has a mistake. Here is the carry into bit 3:
assign c3 = (a[2] & b[2]) | (a[2] & c2); // one term is missingAn assign connects a wire to a logic expression, here an OR of ANDs. The line is legal code, so it compiles with no error and no warning. Nothing about it looks wrong at a glance.
Around the adder sits a testbench, the bench for short. It first does what people often do: a smoke test. It tries three sums by hand, to see that the design works at all. Then it tries all 256 pairs of 4-bit inputs and compares each sum with the right answer.
smoke test: 1 + 1 = 2
smoke test: 3 + 4 = 7
smoke test: 5 + 5 = 10
all 256 input pairs: 24 wrong; the first is 1 + 7 = 0Read the first three rows: 1 + 1 = 2, 3 + 4 = 7 and 5 + 5 = 10. All correct. Rule 4 says what they prove: those three sums, and nothing more. The last row tells the real story. 24 of the 256 sums are wrong, and the first is 1 + 7, which the adder says is 0.
Why did the hand checks miss it? The missing term matters only when bit 2 of a is 0, bit 2 of b is 1, and a carry arrives from below. None of the three hand-picked sums does all three at once.
Why Every Input Was Possible Here, and Rarely Is
This adder has 256 input pairs, so the bench could try them all in a blink. A 32-bit adder has about 18 billion billion pairs. No simulator can try them all before the chip is due.
So real verification cannot be "try everything". It is a set of methods for choosing what to try, knowing the right answer, and measuring what was missed. The rest of this track teaches those methods. The next lesson starts by separating verification from two jobs that sound like it.
Traps
The first trap is trusting the tools. The code compiled, the linter (a tool that flags risky coding style) was quiet, and the synthesis report looked normal. Each of those tools checks that the code is legal and buildable. None of them knows what an adder is for.
The second trap is the friendly test. A designer writes a quick test with the cases they were thinking about when they wrote the code. The test passes, because it shares the designer's blind spot. This is why verification is often done by a second person, reading the specification on their own.
The third trap is believing a bug is rare, so it does not matter. A wrong sum in 24 of 256 cases will appear the first time real software adds those numbers. A chip runs billions of operations a second, so a rare case comes up very soon.
At Scale
This section looks ahead. One adder is small; a real chip has thousands of blocks.
Many teams
Designers, verification engineers, layout engineers and software teams all work on one chip. Each hand-off is a place where a misunderstanding can hide.
Many layers of checks
Tests in simulation, rules checked on every clock, measures of what was tested, and mathematical proofs each catch bugs the others miss. This track meets each one in turn.
Where This Goes Next
This lesson named the problem. These lessons teach the tools and the language behind it.
| The idea from this page | Where it is taught |
|---|---|
| Simulating code and reading what it prints | Four-State vs Two-State Types |
| Writing the self-checking test of this lab yourself | The Simplest Test That Can Fail |
| Proving a property for every input instead of trying inputs | Simulation Covers Paths, Formal Covers States |
| How a whole chip is checked before tape-out | What the Block Bench Already Proved |
Try It
Run the lab. Read the three smoke tests, then the last line.
Add the missing term (b[2] & c2) to the carry into bit 3. Predict the last line before you run it.
Put the bug back and change a smoke test to 3 + 5. What does it print now?
smoke test: 1 + 1 = 2 smoke test: 3 + 4 = 7 smoke test: 5 + 5 = 10 all 256 input pairs: 24 wrong; the first is 1 + 7 = 0Check Yourself
Common Mistakes
Wrong Treat a clean compile as evidence the design works.
A compiler checks that the code is legal, not that it does the job.
Fix Check the behaviour against the specification, with a test that can fail.
Wrong Stop after a few correct hand-picked results.
They prove only those inputs; the bug may need a combination nobody picked.
Fix Try many inputs, chosen on purpose, and measure which ones were never tried.
Wrong Leave the checking to whoever wrote the code.
Their tests share their reading of the specification, and its blind spots.
Fix Have a second person read the specification and check the design independently.
Remember
- A chip cannot be patched: after tape-out every copy carries the same wires.
- The cost of a bug grows along the road and jumps at tape-out; find bugs while the chip is text.
- Compiling proves syntax; a few right answers prove only those inputs.
- Verification checks the design against the specification, independently of the designer.