CPU made of DMA on Raspberry Pi Pico.
The DMA controller in the RP2 microcontroller family (RP2040, RP2350, and
compatible chips) is Turing-complete. This project builds a full toolchain
for it: an emulator, an assembler/linker, a program loader, LLVM/Clang
support, and eventually an xv6-derived kernel running entirely on DMA
channels. See prompts/overview.md for the design analysis, the phased
development plan, and references.
The tree is split by where code runs: host/ is the Go toolchain that runs
on your dev machine, target/ is the C that runs on the Pico. Everything
else is docs, examples, and vendored dependencies.
host/emu/—dmaemucore: a deterministic, DMA-machine-level emulator of the RP2 DMA subsystem (channels, triggers, chaining, DREQ credits, pacing timers, sniffer, atomic register aliases). Both SKUs are supported viaemu.Variant(emu.RP2040,emu.RP2350) — the CTRL bit layout, register offsets, sizes, and DREQ numbers differ between them, so programs are assembled per SKU. The golden tests inhost/emu/machine_test.gobuild the machine's ALU and control-flow idioms block by block, run the whole suite on both SKUs, and prove out the interrupt-dispatch design fromprompts/overview.md§3.2.host/dmaasm/— the assembler: SKU-portable.dasmsources (labels, literal pools, instruction-field addressing, the ABI v0 register file and macro instruction set — seereferences/design_docs/abi.md) assembled into SKU-specific DMX executables with a symbol table. Validated on silicon: the HIL firmware runs assembler-produced binaries.host/dmacc/+host/llir/— the C toolchain:llirparses clang's LLVM IR,dmacclowers it to SKU-portable.dasm. Differential tests inhost/dmacc/testdata/pin it against host clang.host/img/— the DMX executable format (references/design_docs/dmx.md): builder, encoder/decoder, and the reference loader with Tier-2 relocation (same image runs at any placement).host/fsimg/builds xv6 filesystem images.host/boards/— deployable-target descriptors (SKU, memory partition, flash sections, installed apps);host/prog/hil/holds the HIL test programs as embedded.dasmassets.host/cmd/— the CLIs:dmaemu(runs a raw block image or DMX executable under a JSON config, reporting JSON),dmaasm,dmacc,dmxgen(bakes emulator expectations into the firmware header), andsldgen.
target/loader/— the DMX loader for the RP2 side; parses DMX, relocates, and starts the machine. No SDK dependency; build with-DDMX_TARGET_RP2350for RP2350 (RP2040 is the default). Validated on RP2350 silicon.target/firmware/— the HIL (hardware-in-the-loop) runner:dmxgenbakes emulator-computed expectations into the firmware, which runs the images on the real DMA machine and reports expected-vs-observed over UART. The emulator is silicon-calibrated against a Pico 2; seeprompts/004-hw-calibration.mdfor the results (all golden tests pass on hardware at ~10 M blocks/s).target/libc/— the DMA machine's C library: DMA-specific config and glue (committed) plus the vendored picolibc submodule (target/libc/picolibc) it is compiled from.make libcturns the curated picolibc sources into the IR goldens intarget/libc/ll/, whichdmacclinks into programs — seetarget/libc/README.md.target/game/is the DMA-driven game console;target/xv6/is the xv6-derived kernel port (target/xv6/PORT.md).
docs/— human-facing guides: how to build the firmware (building-firmware.md) and how to wire the hardware (building-hardware.md).prompts/— the phased design log: the analysis inoverview.mdand a per-phase results document for each step.references/— material to consult, none of it built into the product:datasheets/(the RP2040/RP2350 and peripheral datasheets),design_docs/(the project's own specs —abi.mdanddmx.md), and reference-only git submodules studied but never compiled. Contrasttarget/libc/picolibc, which is compiled and linked. Copyrighted material stays untracked (see Coding rules inprompts/overview.md).examples/— standalone programs built through the toolchain.
$ make build # builds bin/dmaemu, bin/dmaasm, bin/dmacc
$ make test # go vet + golden testsRequires Go ≥ 1.26. No dependencies outside the standard library.
This project is heavily inspired by the original idea published by the authors in Cornell University.