๐“ƒ
Open-Source Memory Compiler

๐“ƒ Khnum

The ram-headed god shaped every being on his potter's wheel. This Khnum shapes every memory your silicon needs โ€” on a laptop.

A zero-dependency, laptop-class generator of verified SRAM, register-file, FIFO and ECC-protected memories โ€” each instance shipped with its own self-checking testbench, manifest, embedded formal proof, and a proven path to both FPGA and ASIC.

6MEMORY KINDS
0PIP DEPENDENCIES
185+AUTOMATED CHECKS, 0 FAIL
16 GBLAPTOP-SAFE, HARD LIMIT
The Vision

Correct, verified memories โ€” right now, on your laptop.

Most designs don't need a hand-crafted 6T bitcell macro from a seven-figure PDK toolchain. They need correct, verified, portable memories today โ€” SRAMs, register files, FIFOs, ECC โ€” that synthesize to real BRAM on FPGA and harden to real standard-cell layouts through OpenROAD on ASIC, backed by proofs instead of promises.

Honesty is the brand: a checked roadmap box that isn't mechanically true destroys the point of the project. Every claim below is backed by a test, a formal proof, or a routed GDSII layout you can inspect yourself.

The Potter's Wheel

Six memory kinds, one generator.

Every kind ships Verilog-2001 RTL, a self-checking testbench, and a JSON manifest โ€” from one command.

sram_1rw

Single shared read/write port, synchronous read, read-first RDW. The everyday scratchpad.
BRAM-proven โœ“

sram_1r1w

Separate write + read ports, same clock. Dual-port scratchpad / cache way.
BRAM-proven โœ“

sram_2r1w

One write port, two independent read ports. Register-file-style access.
BRAM-proven โœ“

rf_2r1w_ff

Flop-based register file, asynchronous (combinational) reads, depth โ‰ค 64. The CPU-GPR workhorse.
shipped โœ“

fifo_sync

Single-clock FIFO โ€” FWFT, full/empty/level flags, every boundary tested.
shipped โœ“

fifo_async

Dual-clock CDC FIFO โ€” Cummings gray-coded pointers, 2-FF synchronizers.
shipped โœ“

Plus: transparent --ecc (Hamming SECDED, single-correct/double-detect) on any SRAM kind, and --bank-depth/--bank-width composable tiling into larger arrays.

The Proof

Proofs, not promises โ€” at every level.

โœ“

Self-checking testbenches

Every generated instance ships a Verilator-driven TB with a shadow-model scoreboard โ€” init sweep, random phase, final sweep.

๐“‚€

Formal proofs (yosys + z3)

Read-first (incl. per-byte-lane), FIFO occupancy and gray-pointer-validity properties โ€” 9 configs proven, vacuity-checked and mutation-tested.

โšก

A third method: cocotb

Independent Python golden models vs. Verilator sim for all 6 kinds โ€” a verification path distinct from both the Verilog TB and the formal proofs.

โŠž

Real FPGA BRAM inference

All 3 SRAM kinds ร— byte-en on/off genuinely infer RAMB18E1/RAMB36E1 (Xilinx) and SB_RAM40_4K (iCE40) โ€” 12/12 proven via synth_xilinx/synth_ice40, not just asserted.

The Foundry

Real ASIC layouts, on a 16 GB laptop.

DFFRAM-style standard-cell hardening through OpenROAD/ORFS, tuned to stay laptop-safe. Two sizes hardened so far:

designplatformarea (ยตmยฒ)utilWNS (ns)route DRCpeak RAMstatus
khnum_sram_1rw_256x32sky130hd374,73643%0.000 viol2.17 GBโœ… timing closed
khnum_sram_1rw_1024x32sky130hd1,572,50325%-0.390 viol8.19 GB๐Ÿ”ง routes clean, retuning

Full numbers, gotchas, and the exact recipes: harden/HARDEN_RESULTS.md.

The Methodology

A disciplined seven-phase lifecycle.

Every phase ends with a checkpoint commit; nothing advances until tools/test_all.py exits 0. A "partial" is never checked as "done."

P0GenesisPackage + 3 SRAM kinds.
P1Potter's WheelRF, FIFOs, ECC, banking.
P2The ProofFormal + cocotb, vacuity-checked.
P3FPGA GateReal BRAM inference proven.
P4The FoundryOpenROAD/ORFS ASIC hardening.
P5The ScribeDocs, demo, characterization.
P6AscensionPyPI release, v1.0.0.
Why Another Memory Compiler?

A niche neither OpenRAM nor DFFRAM covers.

KhnumOpenRAMDFFRAM
Dependencieszero (Python stdlib)Python + packages + PDK setupPython + packages
Self-checking TB per instanceโœ… always, automaticallypartialโ€”
Formal proof per instanceโœ… yosys-smtbmc + z3, vacuity + mutation checkedโ€”โ€”
FPGA + ASIC from one configโœ… portable RTL, BRAM-inference verifiedASIC onlyASIC only
Runs on a 16 GB laptopโœ… hard design constraintheavymoderate