ferrite-lithic811 tests ยท 21 designs

Documentation

Fifteen pages in reading order. Start with the four background pages: they explain what a clock edge is, where the design came from, and what Rust does and does not check. Then the nine tool crates, bottom-up โ€” bits, then the graph, then the two backends that read it.

Every page is a numbered walkthrough with the code samples transcribed from the crates themselves. Where something is a measured number, it is labelled as one, and where something is a known gap, it says so.

Background

How a circuit becomes a value

Combinational and sequential logic, clock edges, bit order, and what equivalence checking actually proves.

basics

OCaml, and the idea of a hardware DSL

The three ways to write hardware, what a hardware construction language is, and which OCaml features carry weight.

ocaml

Hardcaml, the design being ported

Signal.t, Reg_spec, wire and feedback, Cyclesim, ppx interfaces โ€” and the three checks inherited verbatim.

hardcaml

Why Rust, honestly

What the type system does not check, where compile-time width checking was traded away, and what actually verifies the design.

why-rust

Benchmarks, measured

Node counts, flops, bits of state and combinational depth for every design, derived from the IR rather than estimated.

benchmarks

The toolchain, bottom-up

Fixed-width bitvectors

ferrite-lithic-bits

Runtime-width integers over u64 words, with the width rules that make Verilog agree with you.

bits96 tests5 steps2 traps

The graph

ferrite-lithic-ir

Nodes, widths and dependencies. No behaviour, no types, no opinions about what hardware is.

ir116 tests5 steps2 traps

The front end

ferrite-lithic

Design is an arena behind builders, and a Signal is a node id with a cached width.

design58 tests5 steps2 traps

The cycle simulator

ferrite-lithic-sim

Combinational within a cycle, sequential at the edge, and the edge is a real boundary.

sim52 tests4 steps2 traps

The Verilog emitter

ferrite-lithic-rtl

One structural always block for the whole design, and a signature both backends agree on.

rtl52 tests4 steps1 traps

Ports by derive

ferrite-lithic-derive

A port list is a struct, and the derive reads the shape rather than a list of strings.

derive39 tests3 steps2 traps

Waveform data

ferrite-lithic-wave

Cycle-indexed values you assert on directly, plus a VCD rendering for when you want eyes.

wave42 tests5 steps1 traps

Verilator equivalence

ferrite-lithic-cosim

Two backends, one stimulus, compared cycle by cycle, with the first difference reported.

cosim33 tests4 steps3 traps

Step testbenches

ferrite-lithic-tb

Coroutine testbenches where every await is one clock edge.

tb17 tests4 steps2 traps

The corpus

ferrite-lithic-corpus

Twenty-one real algorithms written the way hardware would want them, each checked three ways.

corpus305 tests8 steps2 traps

What the corpus found

ferrite-lithic-corpus

Nine defects, and one shape: a constant that looks right, builds a graph of exactly the right width, and means the opposite of what it says.

findings9 steps2 traps