Toggle Tests in Simulation
Where no proof is available, drive each wire alone and watch all of them. A walking one finds shorts, stuck wires and crossed pairs. It only suggests the rest.
You Will Be Able To
- Run a walking one across a group of wires and read which faults each step can reveal.
- Say why the whole word must be checked at each step, not only the driven wire.
- List what a toggle test cannot see: other selections, other listeners, timing hidden by a wait.
- Decide when a toggle test is worth writing and when a proof replaces it.
- Lesson
- V8.2
- Time
- 24 min
- Runs on
- Your browser
- Check
- 5 questions
A board arrives back from the lab with one pad that never moves. Every test had driven that pad, but only together with its neighbour, and only high.
A toggle test drives each wire alone and looks at all of them. It is the wiring check you write when no proof can reach.
- Cycle 0
Step 1: the board drives IO0 high. GPIO IN reads IO0, plus IO1, which the board's UART line holds high.
- Cycle 1
Step 2: IO0 is low again and IO2 is high. IO1 was skipped: the board cannot drive it as a plain level.
- Cycle 14
Step 15: IO15 alone. Every step passed on the good chip.
The expected words of the walk's GPIO IN reads, 15 steps, which all passed on ap_soc v1.5 (Verilator 5.052 2026-09-05, +core=bfm).
Before You Start
Read Taking the Core Out and Bit Bash, Aliasing and Unmapped Space first: this page uses the bus-manager seat and walking ones.
| Question | |
|---|---|
| 1 | What is a walking one, and what does each step check? |
| 2 | Why must every wire be checked at every step? |
| 3 | Which faults does a toggle prove, and which does it only suggest? |
| 4 | Why could the lab not walk IO1 from the board? |
| 5 | When does a team write a toggle test instead of a proof? |
The Idea: One Wire at a Time, All Wires Watched
A connectivity proof needs the wires written down as a table and a formal tool to read it. Some wires have neither. Think of a pad that leaves the chip, a net added by hand, or a model of a board. For these, you drive the wire and look.
Driving all wires high at once tells you little. A short between two pads looks fine when both are high. So you drive one wire at a time, with all the others low, and you check every wire at each step. That pattern is a walking one. Its mirror, one wire low with all others high, is a walking zero.
Sixteen steps cover sixteen wires. Yet each step tests the driven wire against all fifteen others. So the walk checks all 120 pairs a short could join. That is why the walk scales well, and why it is still written on chips that have proofs.
- Test
- Bus
- Control / FSM
- Peripheral
- Manager
- Data
- Interrupt
- Drive
The board drives one pad at a time; the chip leaves every pad alone.
- Read every pad
GPIO IN sees all sixteen pads, and the seat checks the whole word each step.
- What stays dark
The other selections of the pin mux, and the wake detector on IO15, are paths the walk never used.
Read the diagram as text
- Board model: drives a pad the chip leaves alone
- Pad IOn: one wire, many paths
- Pin mux: select 1: GPIO; 2, 3: other functions
- GPIO IN: reads every pad
- Wake detector: IO15 only, while PD_PER is off
- Bus-manager seat: reads GPIO IN
- Board model → Pad IOn: a one, then a zero
- Pad IOn → GPIO IN: walked
- Pad IOn → Pin mux: not walked in GPIO mode
- Pad IOn → Wake detector: a second listener
- GPIO IN → Bus-manager seat: the whole word
soc_tb's board model and the pin mux of ap_soc v1.5 (facts §27.11, §27.12).
New Words
| Word | Meaning |
|---|---|
| Toggle test | A test that drives wires to both levels and checks where each level arrives. |
| Walking one | Steps in which exactly one wire is 1 and all others are 0; the 1 moves one wire per step. |
| Walking zero | The mirror: one wire 0, all others 1. |
| Short | Two wires joined by mistake, so driving one moves the other. |
| Stuck wire | A wire that holds one level whatever drives it. |
| Listener | Any logic that reads a wire. A pad can have more than one: GPIO IN and the wake detector both read IO15. |
The Smallest Example: Eight Pads and a Short
Take eight pads, with pads 3 and 4 shorted on the die. Each reads the AND of the two drivers: a pad held low wins. Walk a one across them and write what each step sees.
| Step | Drive | Seen | Check of the whole word |
|---|---|---|---|
| 0 to 2 | one of pads 0 to 2 high | the same | pass |
| 3 | pad 3 high | pad 3 pulled low by pad 4 | fail |
| 4 | pad 4 high | pad 4 pulled low by pad 3 | fail |
| 5 to 7 | one of pads 5 to 7 high | the same | pass |
Worked by hand; the runnable example below runs the same toy on Icarus.
Two steps fail, and they name the two pads. Had the short been an OR instead, pads 3 and 4 would both rise at step 3. Only a check of the whole word sees the second pad rise. A check of the driven pad alone passes.
The Rules
Rule 1: Drive one wire at a time.
All others at the opposite level, so a short or a crossing has something to disagree with.
Rule 2: Check every wire at every step.
A second wire moving is the symptom of a short or a cross; mask nothing out.
Rule 3: Every wire sees both levels.
Each wire is 1 in its own step and 0 in all the others. A wire stuck at either level fails a step.
Rule 4: A toggle proves only the selection it ran in.
A pad walked as GPIO says nothing about the SPI or UART path through the same pad.
Rule 5: Every listener needs its own step.
A wire read by two blocks is half tested if only one of them is checked.
Rule 6: A wait hides timing.
A step that reads after a few cycles passes a wire that arrives one cycle late.
Sources for These Rules
The board model: which pads the board drives, IO1 the UART line, IO6 wired to IO7. See soc_tb.sv and facts §27.12.
GPIO IN reads every pad whatever PINMUX says (facts §27.11). The sequence-table rows tb gpio_set and core r: bench manual, "The sequence table".
Simulation finds some connectivity bugs but cannot cover every wire and value; formal does: MEHTA-DV 10.9.
The Lab: A Walk into the Pads
The bus-manager seat cannot drive a pad from outside, but the board can. So the lab leaves PINMUX at its reset value, where no pad is driven by the chip. The board then raises one pad at a time, and the seat reads GPIO IN, which sees every pad whatever PINMUX says.
tb gpio_set 00000000 00000001 ffffffff 00000000 0 1
core r 10001004 00000000 0000ffff 00000003 4 1
tb gpio_set 00000000 00000000 ffffffff 00000000 0 1
tb gpio_set 00000002 00000001 ffffffff 00000000 0 1
core r 10001004 00000000 0000ffff 00000006 4 1
tb gpio_set 00000002 00000000 ffffffff 00000000 0 1
tb gpio_set 00000003 00000001 ffffffff 00000000 0 1Rule 2 at work: every read uses mask 0000ffff, and expects the driven pad plus IO1. The run passed on the good chip in 177 cycles. IO1 is missing from the walk. The board's UART line owns it and idles high, so the board cannot drive it as a plain level. That is a real limit of a toggle: it reaches only what the board can drive.
good chip: verdict=pass cycles=177 bench_errors=0
chip Q064: verdict=pass cycles=177 bench_errors=0Now rule 4. Q064 is the chip whose SPI data input samples the clock pad, met in the fundamentals module. The walk passed on it, with the same cycle count. Every pad reaches GPIO IN, so the walk has nothing to complain about. The miswire sits on a path the walk never selected. The next lesson takes each pad function through the pin mux and catches it.
The graded problem walks the other direction: every pad as a GPIO output, and IO15's second listener, the wake detector.
Why It Is Built This Way
Why test wires in simulation at all, when a proof covers every value? Because some wires have no table to prove, and some checks need the board. A proof of connect.csv stops at the pad ring. Whether the board's model, its straps and its wiring agree with the chip is a question for a run.
Why one wire at a time, and not a random pattern? Random patterns find shorts too, but slowly and without naming the wire. A walking one finds every short in N steps and names the two wires in the failing step. It costs almost nothing, so it stays in the smoke set.
Traps
The first trap is masking out the neighbours. An engineer writes each read with the driven bit as its mask, because the other pads "are not part of this step". The walk then passes a pad that copies its neighbour. The whole point of the walk is the other bits.
The second trap is a walk in one mode reported as "pads tested". The walk ran with every pad as GPIO, and the release notes say "all pads toggled". A UART pad crossed with a PWM output still passes it, because the walk never selected either. The lab's run on Q064 shows the same blind spot. Name a toggle by the selection it ran in.
The third trap is the generous wait. A step waits ten cycles before it reads, to be safe. A pad that arrives one cycle late, through a missing synchronizer stage, passes. If arrival time matters, read at the exact cycle the specification gives.
At Scale
This section looks ahead. ap_soc has sixteen IO pads; production chips have hundreds.
Boundary scan
Production chips add a scan chain around the pads (IEEE 1149.1). A tester then walks every pad on the assembled board.
Pads in a proof
Connectivity apps prove the pad ring's mux from the pin table, leaving the toggle for the board-level parts.
Toggles in the smoke set
The lab's walk took 177 cycles. A walk that cheap stays in the first gate of every regression.
Try It
Run it: steps 3 and 4 fail, naming the shorted pads.
Change WALK to 0 for a walking zero (the predict question below). Which steps fail now?
Change the short to an OR. Which check would you need to see it?
step 3: drove 00001000, saw 00000000 step 4: drove 00010000, saw 00000000 steps that failed: 2 of 8Check Yourself
Common Mistakes
Wrong Mask each read down to the driven wire.
A short or a crossing shows as another wire moving; the mask hides it.
Fix Check every wire at every step, with the full mask.
Wrong Report "all pads toggled" after a walk in one PINMUX selection.
Each selection is a different path through the pad.
Fix Name the selection, and test each function separately.
Wrong Read only GPIO IN for a pad with two listeners.
The second listener, such as the wake detector, is never checked.
Fix Give every listener its own step.
Remember
- Drive one wire at a time and check every wire at every step.
- Each wire is 1 once and 0 in every other step, so a stuck wire fails too.
- A toggle proves only the selection it ran in and the listeners it read.
- The board limits what a toggle can reach.