agentsclimarketplace

Differential verification

Skill Midstall/claude-for-hardware/skills/differential-verification

Use when verifying a hardware DUT (a CPU core, FPGA, or netlist) against a golden reference model, building coverage-guided fuzzing, or detecting where silicon diverges from a simulator like Spike, an emulator, or SPICEFrom its SKILL.md

Install
npx -y skills add Midstall/claude-for-hardware --skill differential-verification

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

6.4 KB, as published. Nobody here has run it

Differential Verification

Overview

You trust a design by running it against something you already trust and comparing. The DUT (device under test) executes a stimulus; a golden reference model executes the same stimulus; you compare the resulting state. A mismatch is a bug in one of them, and finding which is the work.

Core principle: Same stimulus, two executors, compare state. Everything else (fuzzing, coverage, campaigns) exists to generate good stimulus and to localize the divergence. The comparison is only as good as the state you capture and how honestly you name it.

When to Use

  • Checking a CPU core against an ISA simulator (Spike, an emulator)
  • Checking an FPGA's observed outputs against a golden function
  • Checking a netlist against a circuit simulation (SPICE/ngspice)
  • Building a coverage-guided fuzzer for any of the above
  • Comparing silicon behavior to a simulator and chasing where they disagree

The Core Loop

generate stimulus -> run on DUT -> capture DUT state
                  -> run on golden model -> capture golden state
                  -> compare -> divergence? report : record coverage
  1. One stimulus, two runs. Drive the DUT and the reference with the identical input (the same program, the same vector, the same netlist excitation).
  2. Capture comparable state. Final register file, memory regions, PC, retired-instruction trace, or node activity, whatever both sides can produce.
  3. Compare honestly. A field you read but record as "absent" or false is a false pass waiting to happen. Make sure a captured value is actually compared.

Name State By The Hardware, Not The ABI

Capture and compare register state under raw hardware names: x0..x31, pc, raw CSR names. ABI aliases (a0, ra, sp) are a rendering concern for the frontend only. If the comparison layer speaks ABI names, two tools will eventually disagree about which physical register a0 is and you'll chase a phantom mismatch.

Coverage-Guided Fuzzing

Random stimulus plateaus fast. Close the loop with coverage:

  • Match the model to the hardware it stands in for. When the golden side is a sim model of a registered memory, give it the SAME read latency as the real FPGA primitive (a registered BRAM read is latency 1). A faster sim model verifies behavior the silicon will not have. See fpga-synthesis-fit.
  • Maintain a coverage map (which PCs/edges/encodings/nodes the corpus has exercised) fed by a real coverage source on the executor.
  • Favor novelty. A power scheduler should spend more energy on seeds that hit new coverage, less on seeds that retread.
  • Layer the generator. A structured layer emits legal programs (for a CPU, lower randomized IR to legal machine code, for example via a real codegen backend); a raw layer emits corner-case encodings the structured layer would never produce. You need both: legal-but-weird and illegal-but-revealing.

Coverage Divergence Is Itself A Signal

Track coverage on both the simulator and the silicon. When the same stimulus exercises different coverage on the two, that divergence is a finding in its own right, even before an architectural state mismatch shows up. An optional strict mode can flip the verdict on coverage divergence alone.

Localizing A Divergence

When state mismatches:

  1. Confirm the stimulus was truly identical (same entry PC, same loaded segments, same memory init). Plenty of "bugs" are setup skew.
  2. Shrink the stimulus to the minimal failing case.
  3. Compare step-by-step (per-instruction or per-cycle) to find the first point of divergence, not just the end state.
  4. Then decide which side is wrong. The golden model is not automatically right; reference models have bugs too.

Red Flags

SmellDo instead
Reading a value but recording it as absent/falseVerify captured fields are actually compared
State keyed by ABI namesKey by hardware names, render ABI on the frontend
Pure random fuzzingCoverage-guided with a novelty scheduler
Only comparing final stateFind the first diverging step
Assuming the golden model is correctLocalize, then decide which side is wrong
Strict checks toggled off to get a passFix the divergence; see silicon-grade-discipline
Test checks only that the transaction completedAssert the read-back data, not just the handshake
Model ignores byte-enables or leaves DQ/DQS as XCompare on a channel-faithful model or on hardware
Blaming silicon before the emulator ranReproduce on a golden model with perfect memory first
Two "identical" builds differ, editing RTLFASM-diff the bitstreams; byte-identical means a physical difference
Rebuilding the toolchain on a theorized root causeValidate a cheap fix empirically first; the cause may be secondary
Testing writes and reads together on a dead laneBisect with a read-only oracle (DDR MPR or pre-written pattern)

Midstall House Style

  • Heimdall is the reference: Rust post-silicon verification for Aegis FPGA and the River CPU, coverage-guided fuzzer, golden models include Spike (one-shot), a native emulator, and ngspice for netlists. State keys are x0..x31/pc/raw CSR; ABI names are render-only.
  • Library-first: the verification crates are usable as libraries, not just by the bundled CLI/daemon. Maximum test coverage, this goes to silicon.
  • After every structural RTL change, re-run the full matrix; it catches off-by-one stalls, stale reads, and extend bugs a hand-picked test misses. See rtl-area-timing.
  • See sim-honesty-and-false-passes.md in this directory: the false-pass modes (a model that drops byte-enables or DQ/DQS, an ACK-liveness-only test), the variance-vs-determinism rule that tells metastability from a logic bug, reproducing on perfect memory to exonerate the hardware, why a paced debug probe can lie, FASM-diffing two "identical" builds (byte-identical means a physical difference), validating a cheap fix before a toolchain rebuild, and bisecting a dead DDR lane with a read-only MPR oracle.
  • Write docs and comments in ASD-STE100 Simplified Technical English. No em dashes, no emoji. Pairs with codegen-validation (which uses this loop on generated code) and fpga-bringup.

What ships with it: 1 file

5.5 KB alongside SKILL.md

Gives 0 of the 12 instructions most quality gates skills give

Counted across 1,524 of the 2,830 authors here whose files we hold, read 2026-09-06

  • Read full output and check exit codein 45 of 1524, across 40 files
  • Verify output confirms the claimin 44 of 1524, across 39 files
  • Identify the command that proves the claimin 43 of 1524, across 39 files
  • Execute the full verification commandin 36 of 1524, across 30 files
  • Produce a verification reportin 34 of 1524, across 18 files
  • Review git diff changesin 30 of 1524, across 16 files
  • Fix build failures immediatelyin 29 of 1524, across 9 files
  • Group findings by severityin 28 of 1524
  • State claim only with evidencein 27 of 1524, across 22 files
  • Verify regression tests with red-green cyclein 26 of 1524, across 22 files
  • Run the full test suitein 26 of 1524, across 25 files
  • Run test suite with coveragein 25 of 1524, across 10 files

Said here and by no other author read

  • run identical stimulus on DUT and golden model
  • capture comparable state from both executors
  • compare captured state honestly
  • use raw hardware register names for state keys
  • maintain a coverage map for the stimulus corpus
  • favor seeds that exercise new coverage

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.

Keep looking

Skills are one crate of 626,045. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.