A cycle-accurate control-flow and resource-abstraction HDL framework. Describe control flow and hardware resources at a high level in Python — keep full cycle-accurate control, and emit clean Verilog from a Rust core.
Hardware modeling tools trade off two things: how much they abstract control
flow and resources, and how much cycle-accurate control they leave you.
Traditional HDLs (Verilog, VHDL) and framework-assisted approaches (Chisel) give
you cycle accuracy but leave you writing structural RTL — every state
machine and wire by hand.
High-level synthesis abstracts the control away — and takes cycle accuracy with
it.
Kathryn is a Framework-Assisted Approach (FAA) that refuses that trade-off.
You construct the register-transfer-level model directly in Python — every
register, wire, and control step is something you wrote — while three
abstractions (below) remove the manual control-flow and routing burden. The
Rust-powered compiler emits exactly that model as synthesizable Verilog. It is
not high-level synthesis: it never guesses micro-architecture from
algorithmic code.
flowchart LR
subgraph HLS["High-Level Synthesis"]
direction TB
H1["High abstraction"]
H2["✗ loses cycle accuracy"]
end
subgraph HDLFAA["HDL / classic FAA"]
direction TB
D1["Cycle-accurate"]
D2["✗ structural RTL and routing"]
end
subgraph KAT["Kathryn (FAA)"]
direction TB
K1["Cycle-accurate"]
K2["✓ abstracts control & routing"]
end
HLS -. "give up control" .-> K
HDLFAA -. "give up abstraction" .-> K
K(["Kathryn bridges the gap"])
KAT --> K
All three abstractions exist in both implementations — the current Python
DSL and the legacy C++ core; only the surface syntax differs.
Hybrid Design Flow (HDF)
An abstract model for hardware control flow. Sequential, parallel, and
conditional blocks — seq, par, cif, sif, zif — and pipeline halves
pip / zync are plain Python context managers that compile to explicit,
cycle-accurate state machines. Comparable control to HDL, without the manual
FSM bookkeeping. The legacy C++ core provides the same blocks as C++ macros.
Decentralized Update
Relax centralized control logic. Any block may update a hardware resource’s
value; multiple writers to one register are legal and deterministic, because
every assignment carries a priority and conflicts resolve exactly as
declared — no hand-routed valid/select trees.
Hardware Aggregator
The Table & Slot abstraction bundles many hardware components into one
entity: multi-dimensional arrays with named fields, static and dynamic
indexing (binary or one-hot), spread writes, and hardware reduce trees —
the machinery behind structures like a reservation station. Exposed as
karray in Python, and as Table & Slot in the legacy C++ core.
The same model is written the same way in the legacy C++ implementation,
where Kathryn began as a C++-embedded HDL — the
Kathryn C++ book documents it in
full:
Kathryn is on PyPI. The wheels carry the Rust core already compiled, so
Python 3.9+ is the only requirement — no Rust toolchain, no build step:
Terminal window
pipinstallkathryn
pip install "kathryn[sim]" adds the simulation stack (cocotb and Verilator).
Platforms without a wheel, and work on Kathryn itself, build from source with
maturin — see Installation.
Build pipelines from pip and zync halves with stall, bubble, and flush
behavior driven by a shared arbiter — no hand-rolled valid/ready wiring.
Plain-Python modules
Hierarchy is ordinary Python classes with @init and @flow methods —
nest, inherit, and parameterize with the full language.
Rust core
A generational-arena model store in Rust: memory-safe, fast, and reachable
from Python through lightweight copy-by-value handles.
Clean Verilog out
Deterministic elaboration, cross-module IO routing, and a backend that only
reads the model — never redesigns it — so the emitted Verilog mirrors what
you wrote.
Legacy C++ core
The original C++-embedded implementation ships its own toolbox: a
cycle-accurate Hybrid Simulator with VCD waveforms and the ZEP cycle
profiler, plus a synthesizable-Verilog generator — all documented in the
Kathryn C++ book.
Built on Kathryn: Carolyne (work in progress)
Direction: a universal microarchitecture generator with a user-defined
ISA. Today it’s one engine — an out-of-order core written against a µop
contract, adapting itself at elaboration time to whatever ISA description
it’s handed. Unpublished and actively changing — see
the Carolyne page.
UserbookLearn to build hardware with Kathryn: installation, signals, flow control, pipelines, Karray and its element records, the combinational helpers, and a gallery of 39 worked examples.
DevbookHow the compiler works inside: the model arena, ident handles, flow-block build pipeline, update events, the complex-hardware layer, and the Verilog backend.
Kathryn C++ (Legacy)The legacy C++ implementation — the version evaluated in the Kathryn paper. A User Guide (Hybrid Design Blocks, decentralized update, hardware aggregators, the backends, and the Kride out-of-order CPU case study) plus a Developer Guide on the compiler internals.
The Kathryn paper describes the framework and its evaluation:
KATHRYN: A Cycle-Accurate Control Flow and Resource Abstraction HDL
Framework: A Case Study of a RISC-V Out-of-Order Superscalar CPU
Under review at IEEE Transactions on Computer-Aided Design of Integrated
Circuits and Systems (TCAD) — submitted 6 March 2026; the revised
manuscript is currently under review.
Read the paper (PDF)Preprint of the manuscript under review — not the final published version.
Kathryn is an academic research project on cycle-accurate, control-flow and
resource-abstraction hardware design. Come build with us, or explore the
original C++ edition.
PyPIThe released kathryn package — pip install kathryn.
Kathryn C++ book (Legacy)The legacy C++ implementation — the version evaluated in the Kathryn paper.
Carolyne (work in progress)A universal microarchitecture generator with a user-defined ISA, built on Kathryn — the idea, the ISA/microarchitecture contract, and where the project stands.
AI tools assisted in drafting this documentation site. The maintainers have
reviewed all of it and verified the content against the Kathryn source code.