Litz
v0.2.1Deterministic electronics and firmware simulation.
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
| Project | What it shows |
|---|---|
| blinky | An ESP32-C3 firmware and a test that reads the pin |
| mp-i2c-sensor | Stock MicroPython reading a sensor over I2C |
| circuitpython | CircuitPython booting to its REPL on a C3 |
| two-boards | Two MCUs sharing one circuit and one console |
| All examples | AVR, 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 testexits 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-2runs on native hosts, under Node and in the browser.
Chips
| Family | Chips | Backend |
|---|---|---|
| ESP32 · RISC-V | ESP32-C3, C6, P4, S31 | native and WebAssembly |
| ESP32 · Xtensa | ESP32, ESP32-S3 | native |
| AVR | ATmega328P (Uno, Nano, Pro Mini) | native and WebAssembly |
| ARM | RP2040 (Raspberry Pi Pico) | native and WebAssembly |
| Custom | litz:mcu-1, litz:mcu-2 | WebAssembly component |
Documentation
- Getting started — a first project
- CLI reference — every command and flag
- Rust reference — crates,
PartandChip - JavaScript reference — browser and Node
- Building firmware — toolchains and recipes
- Parts and boards — catalog and manifests
- Writing a chip — wasm MCUs and both ABIs
- MCP server — simulate from an editor
- File formats —
diagram.json,litz.toml - Architecture — how the crates fit
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.