Skip to main content

Crate reticle

Crate reticle 

Source
Expand description

Reticle: a VHDL / Verilog compiler written from scratch in Rust.

Reticle takes hardware designs from source text through a unified intermediate representation (IR) to simulation, synthesis and physical targets. Both languages lower to the same IR, so mixed-language designs are handled uniformly by every later stage.

The crate is a library first; the reticle binary is a thin wrapper over it. The core never performs I/O: sources are handed in through a source::SourceMap and results are returned as values, so the compiler embeds cleanly in tests, build scripts and a WebAssembly playground.

Every stage is behind a Cargo feature (see Cargo.toml), and the plan for each is laid out in ROADMAP.md at the repository root.

§Layout

ModuleFeatureRole
sourcealwaysSource files, byte spans, line/column lookup
diagalwaysDiagnostics and their text rendering
fmt_docalwaysDocument printer and diff behind the formatters
internalwaysIdentifier interning (Symbol)
logicalwaysFour-state bit vectors and std_ulogic
verilogverilogVerilog / SystemVerilog frontend
vhdlvhdlVHDL frontend
iralwaysThe unified design IR
simsimEvent-driven simulator
synthsynthSynthesis passes and technology mapping
formalformalSAT solver, CNF encoding, model checking
asicasicLiberty, LEF and DEF readers and writers
fpgafpgaFPGA device database, primitive mapping, constraints
timingtimingStatic timing analysis and clock domain crossings
ipipIP and project manifests, bus interfaces, interconnect
lsplspLanguage server for Verilog and VHDL
cachecacheIncremental builds over a content-addressed store
viewerviewerSchematic and documentation HTML pages for a design
ffiffiC ABI for embedding the compiler in another tool
wasmwasmWebAssembly surface for the browser playground

§unsafe

unsafe_code is denied crate-wide rather than forbidden. forbid cannot be lifted even locally, and ffi and wasm have to hand raw pointers across an ABI boundary, which no safe formulation expresses. Those two modules are therefore the only place in the crate that opts back in, each with a file-scoped #![allow(unsafe_code)] and a comment on every block naming the invariant it relies on. Every other module stays safe; a compiler has no business touching raw memory.

Modules§

asic
ASIC targets: the Liberty, LEF and DEF formats, standard-cell mapping and the hand-off to a place-and-route tool.
cache
Incremental compilation over a content-addressed cache.
diag
Diagnostics: errors, warnings and notes tied to source spans.
ffi
The C ABI: embedding Reticle in a tool written in another language.
fmt_doc
A Wadler / Prettier-style document printer, shared by the source formatters.
formal
Formal verification: SAT solving, and the engines built on it.
fpga
FPGA targets: device database, primitive mapping, constraints, placement, routing, bitstreams and hand-off to other tools.
intern
Identifier interning.
ip
IP integration: manifests, dependency resolution, bus interfaces, interconnect generation and black boxes.
ir
The unified design IR.
logic
Four-state logic values: single bits, VHDL std_ulogic, and arbitrary-width bit vectors with Verilog operator semantics.
lsp
A language server (LSP) for Verilog and VHDL.
sim
Event-driven simulator over the IR’s process form.
source
Source files, spans and position lookup.
synth
This module is the technology-independent front half of phase 5 of ROADMAP.md. It takes a validated Design whose modules hold processes and continuous assignments, and rewrites every module into cells (dff, dlatch, pmux, memory ports) plus continuous assignments whose expression trees hold the combinational logic. The result is still the same IR, so it can be simulated, checked and emitted like any other design; the later half of the phase (arithmetic lowering, the AIG optimiser and LUT / cell mapping) will consume it.
timing
Static timing analysis and clock domain crossing analysis.
verilog
Verilog / SystemVerilog frontend (IEEE 1364-2005 and the synthesisable and testbench subset of IEEE 1800).
vhdl
VHDL frontend (IEEE 1076-2008, with 1993 compatibility).
viewer
The schematic and documentation viewer: a design rendered as a small static web site.
wasm
The WebAssembly surface: the compiler as plain functions over linear memory.

Constants§

VERSION
The crate version, as recorded in Cargo.toml.