ProjectsSoftware & Development Tools
Forma
An early-stage declarative dataflow language and compiler that lowers streaming signal-processing pipelines to vendor-neutral VHDL. The compiler is tested against GHDL simulation; one composed design has been observed running on an FPGA board.
- Rust compiler, 7 crates
- VHDL out, GHDL-verified
- 1,105 tests passing (Oct 2026)
Evidence ledger
Every claim carries the strongest evidence that currently exists for it. Planned work is listed as planned.
- SimulatedThree pipelines verified standalone with real `ghdl -r` simulation (not just syntax analysis): a threshold alarm, a windowed-RMS event pipeline, and a direct windowed-RMS value stream.
- SimulatedTwo audio-level pipelines verified composed with a hand-written PDM-microphone and CIC-decimator front end, against an independent bit-exact Python model; the threshold value is derived by script, not guessed.
- SimulatedCompiler suite at the 2026-10-09 baseline: 1,105 passed, 0 failed, 37 ignored. Generated VHDL for ten canonical fixtures is hash-pinned so an unintended change in output is detected.
- Measured on hardwareBenchmark 2: a generated pipeline composed with a microphone shell was built remotely through Datum (Vivado 2019.2), loaded on a Nexys A7-100T, and manually observed to respond to loud speech — an event counter read 0x1C after roughly 3–4 vocalizations. This is a first input-to-output observation, not a timing or sensitivity qualification.
- PlannedMulti-file source graphs (a build accepts exactly one source file today) and testbench generation beyond one pipeline shape.
- PlannedMulti-clock top-level VHDL generation; clock-crossing building blocks are verified in simulation, but no source-level pipeline can reach a successful multi-clock build yet.
Key: Simulated · Measured on hardware · Planned
Engineering challenge
Signal-processing pipelines are easy to state — window the samples, take an RMS, compare to a threshold, emit an event — and tedious to get right in RTL: handshakes, frame boundaries, bit widths, thresholds and timing metadata all have to agree across every stage. Forma explores how much of that bookkeeping a small compiler can own, while still producing plain VHDL that any simulator or synthesis tool can consume.
Approach
A pipeline is written as a chain of stages (x -> window(..) -> rms() -> where(..) -> emit_event(..)). The compiler lowers it to a typed graph, runs semantic and timing-metadata passes over the graph, and only then emits VHDL — one design unit per file, never a monolith. The language is deliberately small; the repository states plainly which primitives cannot yet be written from source.
Architecture
Front end
- Lexer + parserforma-parser
- Target profileforma.toml · domains
Lowering
- AST → graphforma-ast · forma-ir
Analysis
- Type + sideband propagation
- Cadence + quantity passes
- Semantic checks
Back end
- Schedule + VHDL emitforma-codegen
Output
- VHDL units + GHDL runnerplus testbench for one shape
What makes it technically interesting
- Metadata travels with the stream, not in the type. Framing (start/end of a window), arrival cadence and quantity reference points are carried as properties of the connection between stages. A window’s output keeps the payload type of its input; grouping is a framing property. This keeps payload widths honest and lets each fact be derived exactly once, by one pass.
- Exact arithmetic for thresholds. A threshold written as a percentage of full scale is resolved at compile time with exact rational arithmetic — no floating point — into a plain integer comparison. A worked example is pinned by tests:
24.4140625 percent_fullscaleof a 0–2048 range lowers tos_data >= 501, identical to the hand-derived reference. Affinemapstages transform the reference points exactly or are rejected; they never silently invalidate them. - Fail-closed verification of external HDL. Hand-written VHDL can be declared as an external component. Forma stages it reproducibly, hashes its package and port contract, and checks the entity’s ports through GHDL’s own parsed interface. Results are
Verified,ContradictionorIndeterminate; a tool crash is never reported as a pass.
Implementation
The workspace is split by compiler stage: parser, AST and lowering, intermediate representation and passes, target profile, driver, VHDL code generation and the command-line tool. Generated designs include a simulation runner; --testbench additionally emits a VUnit testbench, currently for one pipeline shape only (anything else is refused rather than guessed). A committed script hashes the generated VHDL for every example so unintended output changes show up as a failing gate.
Verification and results
Simulation runs in a pinned Docker image with GHDL, because native GHDL on the development machine lacks the VHDL-2008 library. The most useful tests are behavioural: they compile a .forma file, simulate the generated design, and compare against an independent Python model.
Limitations and next steps
- The grammar is minimal; several primitives exist in the compiler but cannot be written in source yet.
- One source file per build; no imports or namespaces.
- Testbench generation covers one pipeline shape.
- No claim is made of novelty relative to existing hardware-description or high-level-synthesis research, and no performance comparison has been done.
- Next: choose between multi-clock top-level generation and wider primitive coverage.
Media
Terminal captures and a generated-VHDL excerpt will be added; the hardware observation has a lab note but no photograph yet.