Blog
A readout whose mapping to state is unestablished is not an instrument — four rules written after a week of hardware debugging where the rig lied and the design was fine.
Every rule below exists because I got a reading, believed it, and it was the rig talking rather than the design. None of them is about a particular chip.
Drive a fixed asymmetric pattern and look at it. 4’b0011 is the minimum useful one: it fixes both the polarity and the index mapping in a single observation.
active-HIGH : led0,led1 lit led2,led3 dark
active-LOW : led0,led1 dark led2,led3 lit
What happened without it: a design drove led = {2’b00, s2, s1} and the two hardwired zeros came back lit. The board is active-low, so "all four lit" meant all four bits zero — the opposite of the reading I first took. I concluded "both edges capture" when the data said neither does.
A readout whose mapping to state is not established is not an instrument.
Both leave it at 0. Report AND as well as OR over the same window.
| OR | AND | state |
|---|---|---|
| 0 | 0 | stuck low |
| 1 | 1 | stuck high |
| 1 | 0 | toggling |
| 0 | 1 | impossible — a consistency check on the rig itself |
Initialise the AND register to 1 and the OR to 0. Then the AND leaving 1 also proves the clock ran, which is a second thing the OR cannot show. The fourth row is the useful one: it can never occur, so if it does, the rig is broken and not the design.
Readings arrived as "LED 0 / 1 / 3 / 4", then "LED 1 / 2 / 3 / 4" — mixed 0-based and 1-based with one index skipped. I mapped both to led[0..3] without noticing, and the two mappings give opposite answers to the question being asked.
Design the readout so the answer does not depend on which indicator is which:
Run the baseline, run the change, run the baseline again. If the two baselines disagree, the rig moved and the middle run means nothing. It costs a third run and it is the only thing that separates "the change did something" from "something changed".
The sticky-OR remedy in rule 2 is the same one our own theorem prescribes for saturating indicators. I had been applying that rule to other people’s code all day and not to my own bench.
Every figure above is measured, and the limits are named with it.