Twin generation and checks

How CircuitTwin builds twins from vendor documents on its own engine, cross-checks sources and validates cores and peripherals. Every number links to its evidence JSON.

Every record below carries the provisional label (nothing is labelled verified yet). 9 of 10 records come from a clean tree on 21 November 2026 at 287d49a4a after freezing release binaries; the remaining 1 is an older clean-tree record. Hardware checks use one unit per board.

Inputs

Every extracted fact stores its exact source so later sources can challenge it.

InputExtracted data
Datasheets & reference manuals (PDF)Register maps, reset values, memory maps, bus addresses, protocol timing and sensor behavior.
CMSIS-SVDPeripherals, registers, bit fields, reset values, interrupts and CPU core.
CMSIS packsResolved via Open-CMSIS-Pack index for register maps, memories, processor and startup region.
Vendor C headers (CMSIS / HAL)Base addresses, offsets, bit positions and interrupt numbers (no reset values).
Microchip ATDFClassic/modern AVR core selection and offsets; SAM pin signals.
Zephyr device trees (Apache-2.0)Memories, boot address, interrupts, core description and STM32 pin muxing.
Errata sheetsPer-revision silicon errata and workarounds (opt-in only; off by default).

Missing fields fall back to cited family tables (always overridden by supplied documents). Unbound peripherals stay register files and trigger the unmodelled policy. Assisted proposals are accepted only when deterministic code parses a verbatim quote from the cited page; disabling them leaves output byte-identical.

Fact ledger

Each extracted fact (register offset, bit width, IRQ number) lands in one of three states:

StateMeaning
agreeAll values match across at least two independent lineages.
disagreeSources report different values.
singleOne source, or multiple files sharing a single lineage.

SVD, CMSIS device headers and HAL headers share one vendor-database lineage and count as one witness. Community sources (Zephyr device trees, Linux drivers) are independent witnesses. Because the ledgers below compare SVD and CMSIS headers only, agree is 0; all listed disagreements are real.

PartDisagreeSingle sourceAgreeDisagreements (per bit field)
STM32F407VG3031,960027
STM32F103C81516,347013
STM32F767ZI12746,9670127
Record provenance (twin-generation/fact-ledger.json)

twin-generation/fact-ledger.json (2026-11-21, 287d49a4a, clean tree). Label: provisional.

Promotion gate

Evaluates a ledger for a part or path prefix (whole-segment match: peripherals.USART1 skips USART10). Prints pass with zero disagreements, block with the conflict list, or refuses uncovered parts. Report-only today; it does not auto-set capability labels.

Example: STM32F407VG returned block (30 disagreements, e.g. peripherals.FLASH.registers.CR.fields.SNB.bitWidth: SVD 4, CMSIS header 5). NOSUCHPART exited 2 (“the ledger does not cover NOSUCHPART”).

Record provenance (twin-generation/fact-ledger.json)

twin-generation/fact-ledger.json (2026-11-21, 287d49a4a, clean tree). Label: provisional.

Held-out reset values

Compares stable post-reset register reads from physical silicon against twins generated without that unit’s data. A hash-sealed variant commits expected values beforehand (proves non-tampering, not blind generation).

Part (unit)CheckedDocuments aloneWith family rules
ESP32-S3 (Adafruit Qualia ESP32-S3 rev v0.2 (ROM download mode))3,3722,9243,334
STM32F767ZI (NUCLEO-F767ZI rev Z)2,0821,9141,979
STM32U585AI (Arduino UNO Q (STM32U585))4,0723,3063,987
All three9,5268,144

Small sample (three parts, two families, one unit each, mostly zeros) from generator 0.1.0+policy.6 (not re-run since). Same record across 16 MCUs (SVD vs vendor header): 625 disagreements, 231,634 single-source; 67,946 matches share one vendor lineage and are not counted as independent agreement.

Record provenance (twin-generation/held-out-reset-values.json)

twin-generation/held-out-reset-values.json (2026-11-05, 08bfb0b91, clean tree). Label: provisional.

Peripheral oracles

Small firmware binaries checking single reference-manual rules (e.g. ADC trigger, DMA completion). Checks the model against the manual, not silicon.

23 of 23 pass on one frozen build:

OracleBoardResult
avr-adc-trigger-oraclearduino-unoPASS
nrf52-saadc-oraclenrf52840-dkPASS
stm32f0-hal-adc-oraclenucleo-f091rcPASS
stm32f0-hal-dma-oraclenucleo-f091rcPASS
stm32f0-hal-exti-oraclenucleo-f091rcPASS
stm32f0-hal-i2c-oraclenucleo-f091rcPASS
stm32f0-hal-spi-oraclenucleo-f091rcPASS
stm32f0-hal-tim-oraclenucleo-f091rcPASS
stm32f0-hal-uart-oraclenucleo-f091rcPASS
stm32f103-hal-adc-oraclenucleo-f103rbPASS
stm32f103-hal-dma-oraclenucleo-f103rbPASS
stm32f103-hal-exti-oraclenucleo-f103rbPASS
stm32f103-hal-i2c-oraclenucleo-f103rbPASS
stm32f103-hal-spi-oraclenucleo-f103rbPASS
stm32f103-hal-tim-oraclenucleo-f103rbPASS
stm32f103-hal-uart-oraclenucleo-f103rbPASS
stm32f407-hal-adc-oraclestm32f4-discoveryPASS
stm32h743-hal-tim-oraclenucleo-h743zi2PASS
stm32l476-hal-adc-oraclenucleo-l476rgPASS
stm32l476-hal-i2c-oraclenucleo-l476rgPASS
stm32l476-hal-spi-oraclenucleo-l476rgPASS
stm32l476-hal-uart-oraclenucleo-l476rgPASS
teensy41-edma-gpt-oracleteensy-4-1PASS
Record provenance (accuracy/peripheral-oracles-2026-11-21.json)

accuracy/peripheral-oracles-2026-11-21.json (2026-11-21, 287d49a4a, clean tree). Label: provisional.

Vendor-driver checks

Unmodified open-source drivers (pinned commits, minimal bus/console glue) run against generated twins and verify round-trip readings within datasheet bounds. Every part includes a negative control (out-of-tolerance stimulus or wrong bus address) that must fail.

10 of 10 pass positive runs; 10 of 10 negative controls fail as intended. Host: nucleo-f767zi (generator 0.1.0+policy.12).

PartDriver (commit, licence)StagesRound-trip error vs boundNegative control
MCP98082f534d26b, MITPASS (5 of 5)TEMPERATURE_mC error 0 of ±500 mCFails as intended: stimulus outside the datasheet tolerance
HDC1080265403c03, MITPASS (6 of 6)TEMPERATURE_mC error -1 of ±400 mC; HUMIDITY_m%RH error 0 of ±2,000 m%RHFails as intended: stimulus outside the datasheet tolerance
INA219266a1ee32, MITPASS (7 of 7)BUS_mV error 0 of ±4 mV; SHUNT_uV error 0 of ±310 uV; CURRENT_mA error -1 of ±3 mAFails as intended: stimulus outside the datasheet tolerance
PCA9685592c8ee64, MITPASS (7 of 7)FREQUENCY_Hz error 0 of ±1 Hz; DUTY_m% error -25 of ±25 m%Fails as intended: part at address 0x41 instead of 0x40
AT24C256Caa2a2a393, MITPASS (6 of 6)NEIGHBOUR_BYTES error 0 of ±0 sumFails as intended: part at address 0x51 instead of 0x50
ADXL345b15a89852, MITPASS (7 of 7)ACCEL_X_mg error -1 of ±40 mg; ACCEL_Y_mg error 0 of ±35 mg; ACCEL_Z_mg error -2 of ±50 mgFails as intended: stimulus outside the datasheet tolerance
MPU-60504b46e1ec3, MITPASS (8 of 8)ACCEL_X_mg error 0 of ±65 mg; ACCEL_Z_mg error 0 of ±110 mg; GYRO_X_mdps error 0 of ±23,000 mdps; TEMPERATURE_mC error 0 of ±1,000 mCFails as intended: stimulus outside the datasheet tolerance
SHT31-DIS4026a907a, BSD-3-ClausePASS (6 of 6)TEMPERATURE_mC error -2 of ±200 mC; HUMIDITY_m%RH error 0 of ±2,000 m%RHFails as intended: stimulus outside the datasheet tolerance
LSM6DSOb45daae59, BSD-3-ClausePASS (8 of 8)ACCEL_X_mg error 0 of ±21 mg; ACCEL_Z_mg error -1 of ±21 mg; GYRO_X_mdps error +3 of ±2,000 mdps; TEMPERATURE_mC error 0 of ±15,000 mCFails as intended: stimulus outside the datasheet tolerance
MAX318555f145c394, MITPASS (6 of 6)THERMOCOUPLE_mC error 0 of ±2,000 mC; JUNCTION_mC error 0 of ±63 mCFails as intended: stimulus outside the datasheet tolerance

One datasheet per twin, except MPU-6050 (2 docs). Defaulted reads logged: HDC1080 (3), INA219 (1), LSM6DSO (8). Host board notes (2): energy.not-estimated (info) and mcu.fixed-word-upper-defaulted (warning).

Record provenance (accuracy/driver-oracles-2026-11-21.json)

accuracy/driver-oracles-2026-11-21.json (2026-11-21, 287d49a4a, clean tree). Label: provisional.

CPU differential testing

Seeded random valid programs execute identically on our core and an independent emulator, comparing all registers, flags, stores and faults. Planted bugs (negative controls) must be rejected.

ProfileReferenceProgramsDisagreements
ARMv6-MUnicorn 2.1.4 (QEMU 5.0.1), Cortex-M0 model20,0000
ARMv7-MUnicorn 2.1.4 (QEMU 5.0.1), Cortex-M3 model20,0000
ARMv7E-M, FPv4-SPUnicorn 2.1.4 (QEMU 5.0.1), Cortex-M4 model20,0000
ARMv7E-M, FPv5-D16Unicorn 2.1.4 (QEMU 5.0.1), Cortex-M7 model20,0000
ARMv8-M BaselineUnicorn 2.1.4 (QEMU 5.0.1), Cortex-M33 model (no Cortex-M23 in reference)20,0000
ARMv8-M MainlineUnicorn 2.1.4 (QEMU 5.0.1), Cortex-M33 model20,0000
Xtensa LX6 (ESP32)qemu-xtensa (Espressif fork), esp_develop_9.2.2_2026041720,0000
Xtensa LX7 (ESP32-S3)qemu-xtensa (Espressif fork), esp_develop_9.2.2_2026041720,0000
Xtensa LX7 (ESP32-S3), FPUqemu-xtensa (Espressif fork), esp_develop_9.2.2_2026041720,0000
RISC-V rv32imacUnicorn, SiFive E3120,0000
RISC-V rv32ecUnicorn, SiFive E3120,0000
RISC-V rv32 bitmanipQEMU user mode20,0000
RISC-V rv32imafcQEMU user mode20,0000
RISC-V rv32imafdcQEMU user mode20,0000

Arm retired 1,973,189 instructions. Rejected controls: EOR is computed as ORR (Thumb 16-bit) (24/9,000); ADDX2 shifts the first operand by 2 instead of 1 (10/1,500); floating-point rounding ignores the rounding-mode register (16/1,500); XOR is computed as OR (12/4,500); the rounding modes round-down and round-up are swapped (8/8,000).

16-bit Arm sweep (excluding SVC, 59,136/profile): 0 undocumented differences; documented reference deviations across profiles: 1,288, 46, 46, 46, 296, 78. Found and fixed 7 core bugs; logged 26 reference deviations. Cumulative across 13 runs: 12,200,000 programs, 0 disagreements (8 lack revision stamps, so only the stamped run is tabulated). Excludes exception entry/return, NVIC and MPU (absent in Unicorn).

Record provenance (accuracy/cpu-differential.json)

accuracy/cpu-differential.json (2026-11-21, 287d49a4a, clean tree). Label: provisional.

Additional cores run at both cited and default test counts:

Core & profileReferenceCited countDefault count
CasesDisagreementsCasesDisagreements
AVR, atmega2560simavr 1.620004,0000
AVR, atmega328psimavr 1.620004,0000
Renesas RXv1, rxv1qemu-system-rx (RX62N, gdbsim-r5f562n8 machine) 10.2.44,0000samesame
STM8, stm8ucsim sstm8 (from SDCC 4.2.0) 0.6.420002,0008
PIC24F/H, pic24specification model written by the project (not an executing reference, not independent of the core author)40002,704 of 6,0008

Default-count disagreements: STM8 (2,000 programs) has 8 (reference bug on Z flag after division); PIC24F/H has 8 in the stack-limit path and uses a same-team specification model (no independent reference). Details in Accuracy report.

Record provenance (4 JSON files)

accuracy/avr-differential.json (2026-11-21, 287d49a4a, clean tree); accuracy/rx-differential.json (2026-11-21, 287d49a4a, clean tree); accuracy/stm8-differential.json (2026-11-21, 287d49a4a, clean tree); accuracy/pic24-differential.json (2026-11-21, 287d49a4a, clean tree). Label: provisional.

Unmodelled registers

Unmodelled accesses are logged with register, direction and count. When all assertions pass, policy sets the verdict:

PolicyVerdict
behavioural (default)Inconclusive on writes/polls to register-file peripherals, reserved/undocumented offsets, unmapped/unclocked addresses, RO-memory stores or log overflow. Plain reads of documented registers are logged only.
strictAny unmodelled access (including plain reads) exits inconclusive.
allowStays pass; accesses remain logged. No built-in vendor allowlist exists.
  • ESP32-S3 ESP-IDF hello: default exits 4 (inconclusive, 40 accesses across 8 registers: APB_SARADC, UART0); allow exits 0. Twister exits 5 default / 0 with allow.
  • NUCLEO-F767ZI servo-sweep: passes with 0 unmodelled accesses.
  • CH32V003 (unmodelled I2C1/ADC1 writes): default and strict exit 4; allow exits 0.
Record provenance (accuracy/unmodelled-access-2026-11-21.json)

accuracy/unmodelled-access-2026-11-21.json (2026-11-21, 287d49a4a, clean tree). Label: provisional.

Evidence labels

LabelMeaning
provisionalModelled or measured without clean-tree independent multi-unit confirmation.
unsupportedUnmodelled, refused or reported as register-file only.
verifiedIndependent reproducible reference on a clean tree (2+ physical units for boards). Nothing carries verified today.

Labels stay scoped: a peripheral result never transfers to another part’s memory map, clocks, pin muxing, reset values or errata. Current checks use one physical unit per board, same-lineage SVD and CMSIS headers for fact ledgers, and user-mode Arm differential coverage (excluding exceptions, NVIC and MPU). See Board dashboard and Accuracy report.

Source records, commit revisions & SHA-256 hashes

Summary records retain numbers, revision, tree state and source SHA-256 without local build paths.

RecordScopeRevision & treeProduct repo source (SHA-256)
twin-generation/fact-ledger.jsonFact ledger and promotion gate287d49a4a, clean tree, 2026-11-21eval-results/final-2026-11-21/final-13/results.json at d02ef5052 (f2787153ed090fa86efb19f9a673768ffb12c3cc1ffb312b50c505feee641d84)
twin-generation/held-out-reset-values.jsonHeld-out reset values08bfb0b91, clean tree, 2026-11-05eval-results/generator-confidence-2026-11-05.json (9348ffbc73f4f2d3af7b352ad1a36521b82cd202bbccfefa49771370ab9665a6)
accuracy/peripheral-oracles-2026-11-21.jsonPeripheral oracles287d49a4a, clean tree, 2026-11-21eval-results/final-2026-11-21/oracles/results.json at d02ef5052 (1d0e8112288f85b94468b6a97ff06c1cb9c8cd3ce31dd07f93cf9f83d539c424)
accuracy/driver-oracles-2026-11-21.jsonVendor-driver checks287d49a4a, clean tree, 2026-11-21eval-results/final-2026-11-21/F-Drivers/evidence-drivers.json at d02ef5052 (dd20a19b84c9c621d08efd6e5a6e8f68c9bd18bc41e4a08ca809a8ffbad871c1)
accuracy/cpu-differential.jsonCPU differential: Arm, Xtensa, RISC-V287d49a4a, clean tree, 2026-11-21eval-results/cpu-differential.json at d02ef5052 (bc589b5e21f2204c88a7270eff622af7cb138d8615bbc0c955554f7663812395)
accuracy/avr-differential.jsonCPU differential: AVR287d49a4a, clean tree, 2026-11-21eval-results/avr-differential.json at d02ef5052 (efd99be5e19fb7cc587c0814f1f9a53d3ba9249ad41d7bc6d70d531a1bdefc7c)
accuracy/rx-differential.jsonCPU differential: RXv1287d49a4a, clean tree, 2026-11-21eval-results/rx-differential.json at d02ef5052 (e9b5ef1d203e750b05414855a268c67a14d80d6f89d571d8b22e2c0cf18c19a5)
accuracy/stm8-differential.jsonCPU differential: STM8287d49a4a, clean tree, 2026-11-21eval-results/stm8-differential.json at d02ef5052 (117983692b6b0dd61582b7bebb80fca1be93a70a41f78ee4470c97ff22d24b3a)
accuracy/pic24-differential.jsonCPU differential: PIC24287d49a4a, clean tree, 2026-11-21eval-results/pic24-differential.json at d02ef5052 (d1342a12815ea2f1bbd3d013a0a76e19dced267da2c39854d0f0254434ece36e)
accuracy/unmodelled-access-2026-11-21.jsonUnmodelled-register policy runs287d49a4a, clean tree, 2026-11-21eval-results/final-2026-11-21/F-Honesty/results.json at d02ef5052 (2081c44c531afeca7bdaf94e19fa1ff6591b1413ad2015aad133b3449a2c7ae8)