Litz

v0.2.1

Deterministic electronics and firmware simulation.

esp32 · avr · rp2040 · micropython · webassembly · rust

Litz boots a real firmware image against a circuit the diagram describes. Pins, buses and analog nets are resolved at each simulated tick; a run produces console output, part state, timing and waveforms that can be asserted against.

There is no wall clock and no unseeded randomness. The same project produces the same transcript on every machine, which is what makes it usable as a test.

Install

$ cargo install litz-cli
$ litz test examples/blinky
  1/1 tests passed

The JavaScript package runs the same engine in a browser or under Node: JavaScript reference.

A project

litz.toml

[project]
diagram = "diagram.json"

[sim]
firmware = "firmware/blinky.bin"

[[test]]
name = "the LED blinks"
timeout = "2s"
expect = "litz: blinky"
expect_state = "led1:on"

terminal

$ litz test examples/blinky

== the LED on GPIO8 blinks ==
litz: blinky
1/1 tests passed

litz run runs the same project interactively; litz check validates the diagram without booting it.

Examples

ProjectWhat it shows
blinkyAn ESP32-C3 firmware and a test that reads the pin
mp-i2c-sensorStock MicroPython reading a sensor over I2C
circuitpythonCircuitPython booting to its REPL on a C3
two-boardsTwo MCUs sharing one circuit and one console
All examplesAVR, RP2040, Wi-Fi, displays and custom chips

What it simulates

Firmware
ESP32-C3, C6, P4 and S31 boot merged images through the mask ROM; ATmega328P and RP2040 boot their own formats. Stock MicroPython and CircuitPython builds reach their REPL and run a scripted file.
Circuit
Parts are TOML manifests with pins, buses and behavior. An MNA solver handles resistors, diodes, transistors, op-amps, capacitors and inductors, and reports node voltages and branch currents.
Instruments
Probes report frequency, duty, pulse width and voltage range. A run can write a scope CSV, a VCD or a PCAP, and decode UART, I2C and SPI from the recorded transitions.
Checks
litz test exits non-zero on a failed expectation and prints stable JSON with --json. It runs the same way locally, in a GitHub Action and through the MCP server.
Extensions
Parts and MCUs can be WebAssembly components. A component built against litz:mcu-2 runs on native hosts, under Node and in the browser.

Chips

FamilyChipsBackend
ESP32 · RISC-VESP32-C3, C6, P4, S31native and WebAssembly
ESP32 · XtensaESP32, ESP32-S3native
AVRATmega328P (Uno, Nano, Pro Mini)native and WebAssembly
ARMRP2040 (Raspberry Pi Pico)native and WebAssembly
Customlitz:mcu-1, litz:mcu-2WebAssembly component

Documentation

Project

The source, examples and issue tracker are on GitHub. Releases are tagged v0.2.x for the JavaScript package and published separately to crates.io for the Rust crates.