# Agent benchmark

26 seeded firmware bugs across 17 STM32F407 tasks, run unchanged on CircuitTwin, Renode v1.17.0 and QEMU 10.0.13.

## Scope

43 unmodified STM32F407 ELFs across 17 tasks: 17 correct (`v0`) and 26 buggy versions spanning 16 bug classes. Every ELF runs offline on CircuitTwin, Renode v1.17.0 and QEMU 10.0.13 and prints a `CT-BENCH` PASS/FAIL line. Tasks were authored by CircuitTwin (not sampled from external agent sessions), and the initial pass was used to fix twin bugs. All figures carry the `provisional` label pending physical STM32F407VG validation; commit revisions and binary hashes are in [Provenance](#provenance).

## Scoring rules

| Outcome              | Rule                                                                                                                                                                                                                                                   |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Caught               | Non-clean run on a buggy version: firmware self-check FAIL, hang (timeout), fault, or (CircuitTwin only) a twin diagnostic or non-pass verdict. Renode and QEMU use identical self-check / hang / fault rules; log warnings are kept as evidence only. |
| Missed               | Buggy version passes cleanly.                                                                                                                                                                                                                          |
| Working build passed | Correct v0 binary ran cleanly and printed PASS.                                                                                                                                                                                                        |
| Distinct catch       | Signal differs from what the same task’s v0 produced on that platform.                                                                                                                                                                                 |
| Platform signal      | Caught by at least one signal beyond firmware self-check.                                                                                                                                                                                              |

## Results

| Platform                                         | Buggy versions | Caught (raw) | Missed | Working builds passed | Caught and different from the correct version | Caught by a platform signal |
| ------------------------------------------------ | -------------- | ------------ | ------ | --------------------- | --------------------------------------------- | --------------------------- |
| CircuitTwin (ct 0.1.0, stm32f4-discovery)        | 26             | 24           | 2      | 17 of 17              | 24                                            | 16                          |
| Renode v1.17.0 (stm32f4\_discovery.repl default) | 26             | 12           | 14     | 15 of 17              | 11                                            | 5                           |
| QEMU 10.0.13 (olimex-stm32-h405)                 | 26             | 20           | 6      | 10 of 17              | 8                                             | 5                           |

_Manual `cpu PerformanceInMips 16` on Renode: 13/26 (12 distinct, 15/17 working builds passed). None of the 43 ELFs has run on physical STM32F407 silicon yet._

| Pairwise overlap                | Both | First only                                                 | Second only                                                | Neither                          |
| ------------------------------- | ---- | ---------------------------------------------------------- | ---------------------------------------------------------- | -------------------------------- |
| CircuitTwin vs. Renode v1.17.0  | 12   | 12                                                         | 0                                                          | 2 (i2c\_nack v2, reset\_vals v1) |
| CircuitTwin vs. QEMU 10.0.13    | 19   | 5 (baud v1, clk\_timer v1, irq\_chain v3, race v1, wdg v1) | 1 (i2c\_nack v2, matches QEMU’s broken v0 build)           | 1 (reset\_vals v1)               |
| Renode v1.17.0 vs. QEMU 10.0.13 | 10   | 2 (irq\_chain v3, race v1)                                 | 10 (8 matching QEMU’s broken v0 builds + unaligned v1, v2) | 4                                |

Renode models STM32F4 GPIO, DMA2, RCC/PLL, and TIM3 interrupts. That improves working builds passed over QEMU from 10/17 to 15/17, and raises distinct catches from 8/26 to 11/26\. CircuitTwin passed all 17/17 working builds. All 43 runs were 100% deterministic across two offline passes. These are raw counts over 26 versions (no confidence interval).

### By task

| Task        | Bug class                                                   | Buggy versions | Twin caught | Renode caught | QEMU caught | Correct version flagged by |
| ----------- | ----------------------------------------------------------- | -------------- | ----------- | ------------- | ----------- | -------------------------- |
| baud        | wrong UART baud versus the peer                             | 1              | 1           | 0             | 0           | None                       |
| clk\_gpio   | missing peripheral clock enable                             | 1              | 1           | 0             | 1           | QEMU                       |
| clk\_timer  | missing peripheral clock enable                             | 1              | 1           | 0             | 0           | None                       |
| dma\_m2m    | DMA misconfiguration                                        | 3              | 3           | 1             | 3           | QEMU                       |
| gpio\_mode  | wrong register bit or field                                 | 1              | 1           | 0             | 1           | QEMU                       |
| i2c\_nack   | I2C NACK not handled                                        | 2              | 1           | 1             | 2           | Renode and QEMU            |
| irq\_chain  | forgotten interrupt enable, interrupt flag not cleared      | 4              | 4           | 4             | 3           | None                       |
| nvic\_prio  | wrong NVIC priority                                         | 1              | 1           | 1             | 1           | None                       |
| pll         | wrong register bit or field, polling a flag that never sets | 2              | 2           | 0             | 2           | QEMU                       |
| poll\_flag  | polling a flag that never sets                              | 1              | 1           | 1             | 1           | None                       |
| psc         | timer prescaler off by one                                  | 1              | 1           | 1             | 1           | Renode and QEMU            |
| race        | race between ISR and main                                   | 1              | 1           | 1             | 0           | None                       |
| reset\_vals | reliance on undocumented reset values                       | 1              | 0           | 0             | 0           | None                       |
| ro\_write   | writing to a read-only register                             | 2              | 2           | 1             | 2           | QEMU                       |
| stack       | stack overflow                                              | 1              | 1           | 1             | 1           | None                       |
| unaligned   | unaligned access                                            | 2              | 2           | 0             | 2           | None                       |
| wdg         | unkicked watchdog                                           | 1              | 1           | 0             | 0           | None                       |

### By bug class

| Bug class                             | Buggy versions | Twin caught | Renode caught | QEMU caught |
| ------------------------------------- | -------------- | ----------- | ------------- | ----------- |
| DMA misconfiguration                  | 3              | 3           | 1             | 3           |
| forgotten interrupt enable            | 3              | 3           | 3             | 3           |
| I2C NACK not handled                  | 2              | 1           | 1             | 2           |
| interrupt flag not cleared            | 1              | 1           | 1             | 0           |
| missing peripheral clock enable       | 2              | 2           | 0             | 1           |
| polling a flag that never sets        | 2              | 2           | 1             | 2           |
| race between ISR and main             | 1              | 1           | 1             | 0           |
| reliance on undocumented reset values | 1              | 0           | 0             | 0           |
| stack overflow                        | 1              | 1           | 1             | 1           |
| timer prescaler off by one            | 1              | 1           | 1             | 1           |
| unaligned access                      | 2              | 2           | 0             | 2           |
| unkicked watchdog                     | 1              | 1           | 0             | 0           |
| writing to a read-only register       | 2              | 2           | 1             | 2           |
| wrong NVIC priority                   | 1              | 1           | 1             | 1           |
| wrong register bit or field           | 2              | 2           | 0             | 2           |
| wrong UART baud versus the peer       | 1              | 1           | 0             | 0           |

## CircuitTwin’s 2 misses

**`i2c_nack` v2** (I2C NACK not handled): Twin produced `CT-BENCH PASS sensor read done; verdict=pass stop=marker; issues=bus.no-target x1`, identical to v0 (`CT-BENCH PASS NACK seen and handled; verdict=pass stop=marker; issues=bus.no-target x1`). Renode missed it too; QEMU flagged it identically to v0 (`CT-BENCH FAIL no start condition`).

**`reset_vals` v1** (reliance on undocumented reset values): With default zeroed SRAM all three printed `CT-BENCH PASS scratch zero`. A separate twin run with `--uninitialized-memory seeded:1` catches it (not counted in the 24 above).

## Renode v1.17.0: 2 broken working builds and sensitivity checks

On unmodified `platforms/boards/stm32f4_discovery.repl`, Renode passed 15 of 17 working builds and broke 2: `i2c_nack` v0 (no `SR1.AF` on unregistered 0x68) and `psc` v0 (`stm32f4.repl` hardcodes `systickFrequency: 72000000` and `timer3` `frequency: 10000000` regardless of 16 MHz HSI).

| Task      | Renode v1.17.0 output (v0)                                    | Twin output (v0)                                                                       |
| --------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| i2c\_nack | CT-BENCH FAIL no NACK and no ACK; warnings=4 (gpioPortB,i2c1) | CT-BENCH PASS NACK seen and handled; verdict=pass stop=marker; issues=bus.no-target x1 |
| psc       | CT-BENCH FAIL TIM3 tick rate outside 2%                       | CT-BENCH PASS TIM3 at 1 MHz; verdict=pass stop=marker                                  |

| Sensitivity check        | Observed effect                                                                                                                                                                                                                                                                                                                                        |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| cpu PerformanceInMips 16 | Default 100 MIPS lets wdg v1 finish in 20 ms virtual time (under the 31 ms IWDG period). Setting 16 MIPS catches wdg v1 as a hang (watchdog reset loop; RCC\_CSR.IWDGRSTF unlatched) while keeping v0 clean: Renode moves from 12/26 (11 distinct) to 13/26 (12 distinct, 15/17 working builds passed; 11 twin-only, 0 Renode-only vs default 12 / 0). |
| Log signals              | Counting \[ERROR\] adds 0 catches (only stack v1, already a hang). Counting \[WARNING\] breaks 3 extra working builds (dma\_m2m, pll, i2c\_nack v0).                                                                                                                                                                                                   |
| Where QEMU beats Renode  | QEMU traps misaligned LDRD (unaligned v1) and CCR.UNALIGN\_TRP (unaligned v2) with UsageFault, and enforces read-only flash (ro\_write v2). Renode passes both unaligned cases and maps flash writable (Memory.MappedMemory).                                                                                                                          |

## QEMU broke 7 of 17 working builds

QEMU passed 10 of 17 working builds and broke 7 because unimplemented STM32 peripherals return zero. CircuitTwin passed all 17 of 17 working builds.

| Task       | QEMU output (v0)                                                              | Twin output (v0)                                                                       |
| ---------- | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| clk\_gpio  | CT-BENCH FAIL PD12 did not go high; unimplemented-device log: GPIOA,GPIOD     | CT-BENCH PASS PD12 high; verdict=pass stop=marker                                      |
| dma\_m2m   | CT-BENCH FAIL no transfer-complete flag; unimplemented-device log: DMA2,GPIOA | CT-BENCH PASS 16 words copied; verdict=pass stop=marker                                |
| gpio\_mode | CT-BENCH FAIL PD12 reads low; unimplemented-device log: GPIOA,GPIOD           | CT-BENCH PASS PD12 reads high; verdict=pass stop=marker                                |
| i2c\_nack  | CT-BENCH FAIL no start condition; unimplemented-device log: GPIOA,GPIOB,I2C1  | CT-BENCH PASS NACK seen and handled; verdict=pass stop=marker; issues=bus.no-target x1 |
| pll        | CT-BENCH FAIL HSE not ready; unimplemented-device log: GPIOA                  | CT-BENCH PASS running from the PLL; verdict=pass stop=marker                           |
| psc        | CT-BENCH FAIL TIM3 tick rate outside 2%; unimplemented-device log: GPIOA      | CT-BENCH PASS TIM3 at 1 MHz; verdict=pass stop=marker                                  |
| ro\_write  | CT-BENCH FAIL PD12 low; unimplemented-device log: GPIOA,GPIOD                 | CT-BENCH PASS PD12 high; verdict=pass stop=marker                                      |

**Provenance, runner binaries & SHA-256 hashes**

- Record `results/2026-11-22/summary.json` (`agent-bench` `c7cb6da0f`), [/evidence/agent-benchmark/summary.json](https://circuittwin.ai/evidence/agent-benchmark/summary.json), schema `ct.agent-bench-summary/1`, dated 2026-11-22, SHA-256 `35b044498694f61ddf526bd2f298d02f1845dcc1b08b396f08a74231b1cd99df`.
- CircuitTwin revision `287d49a4a6b9254b66f5a8f12637a53945bee637` (clean tree).
- CircuitTwin build `ct 0.1.0`, board `stm32f4-discovery`, twin `twin:1a1b7140c278c3f0`, `ct.exe` SHA-256 `3c5ab24e7a1cf3a8ee5519f3cddaf0ba90af1d7a4c30b65337ba121a80d598d4` (2026-11-21).
- Renode build: official Antmicro Renode `v1.17.0` (`1.17.0+20260907gitf1dd1b4af`, .NET 8.0.12), `platforms/boards/stm32f4_discovery.repl`, container `agent-bench/renode:1.17.0-1`, archive SHA-256 `4ba7c68b59e2447f188ef4b4b112fcccd2802582c460beedceb63b84e5605a5f`, binary SHA-256 `822209a27168e2ce2e5e679ed481686b555c8e154745431b25d8b4104c34138f` (2026-11-22, `--network none`, 100% deterministic across 2 runs; [/evidence/compare/renode-benchmark-setup.json](https://circuittwin.ai/evidence/compare/renode-benchmark-setup.json)).
- QEMU build `qemu-system-arm 10.0.13`, machine `olimex-stm32-h405` (2026-11-21).
- Label: provisional. All figures come from published JSON records; none is verified on STM32F407VG silicon yet.

## Reproduce

Harness (MIT, tag [v2026.11.21](https://gitlab.com/apanter265/agent-bench/-/tree/v2026.11.21), commit `b62421fc1`): <https://github.com/CircuitTwin/agent-bench> (GitHub) and <https://gitlab.com/apanter265/agent-bench> (GitLab). The 2026-11-22 record runs pinned offline Renode v1.17.0 on the exact same 43 ELFs.

Totals on 43 unmodified ELFs: CircuitTwin caught 24/26 bugs and passed 17/17 working builds; Renode v1.17.0 caught 12/26 (11 distinct) and passed 15/17 working builds; QEMU 10.0.13 caught 20/26 (8 distinct) and passed 10/17 working builds. Install `ct` on macOS or Linux via `curl -fsSL https://circuittwin.ai/install.sh | sh` or on Windows (PowerShell) via `irm https://circuittwin.ai/install.ps1 | iex`, sign in free and run the harness locally.
