README.md

June 3, 2026 · View on GitHub

Naja Logo

Naja

PyPI Open Chapter 1 Join Matrix Chat → Ubuntu Build MacOS Build codecov License REUSE status

What is Naja?

Naja is an open source EDA framework for working with gate-level netlists — from SystemVerilog parsing through analysis, optimization, and transformation. It is usable from Python or C++.

  • SV/Verilog frontend — parse and elaborate gate-level designs
  • Netlist analysis — hierarchy, connectivity, equipotentials
  • Logic optimization — dead logic elimination, constant propagation
  • ECO transformations — direct netlist editing
  • Serialization — SNL interchange format (Cap'n Proto) and Verilog output

Naja Architecture

Get Started

The best entry point is the najaeda Python package:

pip install najaeda

Full documentation: najaeda.readthedocs.io

Tutorials

Six hands-on notebooks — open any of them in Colab with no local install needed:

#TopicColab
1Getting started — load Verilog, navigate hierarchy, visualizeOpen in Colab
2Liberty primitives — load a synthesised design with standard cellsOpen in Colab
3Editing a netlist — rename, disconnect, reconnect, deleteOpen in Colab
4SystemVerilog elaboration — load and browse an elaborated SV designOpen in Colab
5ibex RISC-V core — explore a real-world SV core, collect statsOpen in Colab
6Fanout analysis — compute fanout for every net, trace drivers, export to pandasOpen in Colab

naja_edit — Netlist CLI

naja_edit is a command-line tool for optimizing and translating netlists.

:tv: Presented at ORConf 2024.

# Translate Verilog → SNL
naja_edit -f verilog -t snl -i input.v -o output.snl

# Parse SystemVerilog with explicit top
naja_edit -f systemverilog -t verilog -i input.sv -o output.v --sv_top top

# Dead logic elimination
naja_edit -f snl -t snl -i input.snl -o output.snl -a dle

# Chain optimizations with Python scripts
naja_edit -f snl -t snl -i input.snl -o output.snl -a dle -e pre.py -z post.py

Available optimizations (-a): all (DLE + constant propagation + primitives), dle.

Python script examples: src/apps/naja_edit/examples
Regression suite: naja-regress

Building from Source

Dependencies

Ubuntu:

sudo apt-get install g++ libboost-dev python3-dev capnproto libcapnp-dev libtbb-dev pkg-config bison flex

macOS (Homebrew):

brew install cmake capnp tbb bison flex boost
export PATH="/opt/homebrew/opt/flex/bin:/opt/homebrew/opt/bison/bin:$PATH"

Nix:

nix-shell -p cmake boost python3 capnproto bison flex pkg-config tbb_2021_8

Build

git clone --recurse-submodules https://github.com/najaeda/naja.git
export NAJA_INSTALL=<install-dir>
mkdir build && cd build
cmake ../naja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$NAJA_INSTALL
make && make test && make install
# Add to your environment after install:
export PYTHONPATH=$PYTHONPATH:$NAJA_INSTALL/lib/python

C++ API

Naja exposes two complementary APIs:

  • SNL (Structured Netlist) — full read/write netlist representation
  • DNL (Dissolved Netlist) — fast, read-only flattened view for parallel analysis

Extended documentation: naja.readthedocs.io
C++ snippet: NLUniverseSnippet.cpp
App template (copy to start a new tool): src/app_snippet

Community

:star: If you find Naja useful, starring the repo helps spread the word.

Acknowledgement

Supported by NLNet through the NGI0 Entrust Fund.