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.

A Walking One Across the PadsEach column is one step of the recorded walk. The board drives one pad high, and GPIO IN must show that pad alone. IO1 stays high throughout: the board's UART line owns it.
01234567891011121314IO0IO1IO2IO3IO4IO5IO6IO7IO8IO9IO10IO11IO12IO13IO14IO15IO0IO2IO15
Scroll horizontally ↔
  1. Cycle 0

    Step 1: the board drives IO0 high. GPIO IN reads IO0, plus IO1, which the board's UART line holds high.

  2. Cycle 1

    Step 2: IO0 is low again and IO2 is high. IO1 was skipped: the board cannot drive it as a plain level.

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

Five questions this page answers
Question
1What is a walking one, and what does each step check?
2Why must every wire be checked at every step?
3Which faults does a toggle prove, and which does it only suggest?
4Why could the lab not walk IO1 from the board?
5When 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.

What a Walk Can ReachA pad has a driver on each side and can have several listeners. A walk tests only the paths it drives and the listeners it reads.
  • Test
  • Bus
  • Control / FSM
  • Peripheral
  • Manager
  • Data
  • Interrupt
What a Walk Can ReachA pad has a driver on each side and can have several listeners. A walk tests only the paths it drives and the listeners it reads. test Board model drives a pad the chipleaves alone bus Pad IOn one wire, many paths control Pin mux select 1: GPIO; 2, 3:other functions peripheral GPIO IN reads every pad peripheral Wake detector IO15 only, whilePD_PER is off manager Bus-manager seat reads GPIO IN a one, then a zerowalkednot walked in GPIOmodea second listenerthe whole word
  1. test Board modeldrives a pad the chip leaves alone
    • a one, then a zero → Pad IOn
  2. bus Pad IOnone wire, many paths
    • walked → GPIO IN
    • not walked in GPIO mode → Pin mux
    • a second listener → Wake detector
  3. peripheral GPIO INreads every pad
    • the whole word → Bus-manager seat
  4. manager Bus-manager seatreads GPIO IN
  5. control Pin muxselect 1: GPIO; 2, 3: other functions
  6. peripheral Wake detectorIO15 only, while PD_PER is off
  1. Drive

    The board drives one pad at a time; the chip leaves every pad alone.

  2. Read every pad

    GPIO IN sees all sixteen pads, and the seat checks the whole word each step.

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

New words on this page
WordMeaning
Toggle testA test that drives wires to both levels and checks where each level arrives.
Walking oneSteps in which exactly one wire is 1 and all others are 0; the 1 moves one wire per step.
Walking zeroThe mirror: one wire 0, all others 1.
ShortTwo wires joined by mistake, so driving one moves the other.
Stuck wireA wire that holds one level whatever drives it.
ListenerAny 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.

A walking one with pads 3 and 4 shorted
StepDriveSeenCheck of the whole word
0 to 2one of pads 0 to 2 highthe samepass
3pad 3 highpad 3 pulled low by pad 4fail
4pad 4 highpad 4 pulled low by pad 3fail
5 to 7one of pads 5 to 7 highthe samepass

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

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

  2. Rule 2: Check every wire at every step.

    A second wire moving is the symptom of a short or a cross; mask nothing out.

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

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

  5. Rule 5: Every listener needs its own step.

    A wire read by two blocks is half tested if only one of them is checked.

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

The first steps of the table (46 rows). Each step: the board sets a pad, the seat reads GPIO IN with mask 0xFFFF, the board clears the pad.
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 1

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

The same table on the good chip and on the seeded-fault chip Q064.
good chip: verdict=pass cycles=177 bench_errors=0
chip Q064: verdict=pass cycles=177 bench_errors=0

Now 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

ap_soc~12 blocks
Phone-class SoChundreds of blocks

This section looks ahead. ap_soc has sixteen IO pads; production chips have hundreds.

  1. Boundary scan

    Production chips add a scan chain around the pads (IEEE 1149.1). A tester then walks every pad on the assembled board.

  2. Pads in a proof

    Connectivity apps prove the pad ring's mux from the pin table, leaving the toggle for the board-level parts.

  3. 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?

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: step 3: drove 00001000, saw 00000000 step 4: drove 00010000, saw 00000000 steps that failed: 2 of 8

Check Yourself

Predict the outputThe toy now walks a zero across the same bus, with pads 3 and 4 still shorted. What is the last line printed?
// A walking zero across a toy bus of 8 pads. Pads 3 and 4 are shorted: each reads the
// AND of the two drivers (a short to a pad held low wins, as a wired AND).
module tb;
  logic [7:0] drive, seen;
  always @* begin
    seen = drive;
    seen[3] = drive[3] & drive[4];
    seen[4] = drive[3] & drive[4];
  end
  int bad = 0;
  initial begin
    for (int p = 0; p < 8; p++) begin
      drive = 8'hff;
      drive[p] = 1'b0;
      #1;
      if (seen !== drive) begin
        $display("step %0d: drove %b, saw %b", p, drive, seen);
        bad++;
      end
    end
    $display("steps that failed: %0d of 8", bad);
  end
endmodule
ConceptWhat does each step of a walking one check?
ConceptWhy did the lab skip IO1?
ConceptThe walk passed on chip Q064. What does that show?
ConceptWhen does a team write a toggle test instead of a proof?

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.

Practice

Report a problem with this page