{"id":13773111,"url":"https://github.com/najaeda/naja","last_synced_at":"2025-05-11T05:34:24.893Z","repository":{"id":37427831,"uuid":"414906187","full_name":"najaeda/naja","owner":"najaeda","description":"Structural Netlist API (and more) for EDA post synthesis flow development","archived":false,"fork":false,"pushed_at":"2025-04-23T18:18:43.000Z","size":16476,"stargazers_count":94,"open_issues_count":7,"forks_count":14,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-01T12:02:28.515Z","etag":null,"topics":["asic","cpp","eda","fpga","netlist","semiconductor","verilog"],"latest_commit_sha":null,"homepage":"","language":"Verilog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/najaeda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-08T08:28:13.000Z","updated_at":"2025-04-28T07:15:17.000Z","dependencies_parsed_at":"2023-02-12T11:47:46.484Z","dependency_job_id":"564247be-f759-4c77-9cd7-226ecf9aaa5b","html_url":"https://github.com/najaeda/naja","commit_stats":null,"previous_names":["najaeda/naja"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/najaeda%2Fnaja","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/najaeda%2Fnaja/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/najaeda%2Fnaja/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/najaeda%2Fnaja/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/najaeda","download_url":"https://codeload.github.com/najaeda/naja/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253523690,"owners_count":21921815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asic","cpp","eda","fpga","netlist","semiconductor","verilog"],"created_at":"2024-08-03T17:01:11.532Z","updated_at":"2025-05-11T05:34:24.884Z","avatar_url":"https://github.com/najaeda.png","language":"Verilog","funding_links":[],"categories":["Circuit Compilers"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg width=\"150\" alt=\"Naja Logo\" src=\"./docs/images/Naja-Logo.png\"\u003e\u003ch1\u003eNaja\u003c/h1\u003e\n\u003c/div\u003e\n\n![Ubuntu Build](https://github.com/najaeda/naja/actions/workflows/ubuntu-build.yml/badge.svg)\n![MacOS Build](https://github.com/najaeda/naja/actions/workflows/macos-build.yml/badge.svg)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b224740790e24c80a381a6eede28cad8)](https://app.codacy.com/gh/najaeda/naja?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=najaeda/naja\u0026utm_campaign=Badge_Grade_Settings)\n[![codecov](https://codecov.io/gh/najaeda/naja/branch/main/graph/badge.svg?token=59ZKZ74HFP)](https://codecov.io/gh/najaeda/naja)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![REUSE status](https://api.reuse.software/badge/github.com/najaeda/naja)](https://api.reuse.software/info/github.com/najaeda/naja)\n\n## Introduction\n\nNaja is an Electronic Design Automation (EDA) project that provides open source data structures and APIs for the development of post logic synthesis EDA algorithms such as: netlist simplification (constant and dead logic propagation), logic replication, netlist partitioning, ASIC and FPGA place and route, ...\n\n### Quick Start with `najaeda`\n\nThe easiest way to get started with **Naja** is through the\n[najaeda](https://pypi.org/project/najaeda/) Python package.\nComprehensive online documentation for `najaeda` is available\n[here](https://najaeda.readthedocs.io/en/latest/index.html).\n\n`najaeda` provides a powerful yet simple framework designed to help software\n`AND` hardware developers efficiently navigate and manipulate electronic design\nautomation (EDA) workflows.\n\nWith `najaeda`, you can:\n\n- **Explore Netlists with Ease**:  \n  - Navigate netlist hierarchy and connectivity effortlessly.  \n  - Browse at multiple levels of detail:\n    - Bit-level or bus-level granularity.  \n    - Instance-by-instance exploration or flattened views at the primitives level.  \n    - Localized per-instance connections or comprehensive equipotential views.  \n\n- **Perform ECO (Engineering Change Order) Transformations**:  \n  - Seamlessly apply and manage changes to your designs.\n\n- **Prototype EDA Ideas Quickly**:  \n  - Use an intuitive API to experiment with new EDA concepts and workflows.\n\n- **Develop Custom EDA Tools**:  \n  - Build fast, tailored tools for solving specific challenges without relying on costly, proprietary EDA software.\n\n`najaeda` empowers developers to innovate, adapt, and accelerate their EDA processes with minimal overhead.\n\nAnother entry point for **Naja** is [`naja-edit`](#naja_edit), a tool focused on netlist optimization with Dead Logic Elimination (DLE) or constant propagation.\n\nFor advanced use cases, EDA developers can build custom tools on top of naja C++ APIs.\nSee some simple examples [here](#snippets).\n\n### Acknowledgement\n\n[\u003cimg src=\"https://nlnet.nl/logo/banner.png\" width=100\u003e](https://nlnet.nl/project/Naja)\n[\u003cimg src=\"https://nlnet.nl/image/logos/NGI0Entrust_tag.svg\" width=100\u003e](https://nlnet.nl/project/Naja)\n\nThis project is supported and funded by NLNet through the [NGI0 Entrust](https://nlnet.nl/entrust) Fund.\n\n## naja_edit\n\n`naja_edit`, located in the `$NAJA_INSTALL/bin` directory, is a tool designed for\noptimizing, editing and translating netlists.\n\n:tv: We presented naja_edit’s latest features and results at [ORConf 2024](https://fossi-foundation.org/orconf/2024). You can watch the full presentation [here](https://www.youtube.com/watch?v=JpwZGCuWekU).\n\n### Workflow Overview\n\nThe workflow for `naja_edit` is outlined in the schema below. It's important to note that the only mandatory step in the process is the initial loading of the input netlist.\n\n![Naja-Edit](./docs/images/Naja-Edit.png)\n\n### Workflow Details\n\n- **Input/Output format**: Supports structural (gate-level) Verilog and [SNL Interchange Format](#snl-interchange-format).\nConvert netlists between formats by specifying the input (`-f`) and output (`-t`) options.\n\n```bash\n#translation from verilog to SNL\nnaja_edit -f verilog -t snl -i input.v -o output.snl\n```\n\n- **Python Netlist Manipulation/Editing**: Leverage the [SNL Python API](#python)\nfor netlist manipulations such as browsing, computing stats or direct editing.\nScripts can be applied after loading (`-e` option) or before saving (`-z` option) the netlist.\n\n```bash\n#translation from verilog to SNL with intermediate editing\nnaja_edit -f verilog -t snl -i input.v -o output.snl -e script.py\n```\n\n- **Netlist Logic optimizations across hierarchy boundaries**: Utilize built-in\noptimization algorithms to refine the netlist across hierarchical boundaries\nwith minimal uniquification. Available optimizations include:\n\n- All optimizations (option `-a all`): will apply Dead Logic Elimination (DLE), Constant Propagation and Primitives Optimization.\n- Dead Logic Elimination only (option `-a dle`): will apply only DLE.\n\n```bash\n# -1: Load input netlist from SNL format.\n# -2: Apply pre_edit.py script on the netlist\n# -3: Apply Dead Logic Optimization\n# -4: Apply post_edit.py on the resulting netlist\n# -5: Save netlist in SNL format to output.snl\nnaja_edit -f snl -t snl -i input.snl -o output.snl -a dle \\ \n          -e pre_script.py -z post_edit.py\n```\n\n👉🐍 This [page](README_pages/naja-edit-python-examples.md) provides a collection of example Python scripts for using the naja_edit API.\n\n`naja_edit` editing script examples are also available [here](https://github.com/najaeda/naja/blob/main/src/apps/naja_edit/examples).\n\nThe [Naja Regress](https://github.com/najaeda/naja-regress) repository features a collection of examples\nshowcasing extensive use of `naja_edit`.\n\n\u003cdiv align=\"right\"\u003e[ \u003ca href=\"#Introduction\"\u003e↑ Back to top ↑\u003c/a\u003e ]\u003c/div\u003e\n\n---\n\n## Naja\n\nNaja contains three primary API components:\n\n1. SNL (Structured Netlist) API housed in this repository.\n2. DNL (Dissolved Netlist) API associated to SNL also in this repository.\n3. [naja-verilog](https://github.com/najaeda/naja-verilog), a data structure independent structural verilog parser.\n\n### Why Naja ?\n\n#### Enhanced Fidelity in Data Representation\n\nIn most EDA flows, data exchange is done by using standard netlist formats (Verilog, LEF/DEF, EDIF, …)\nwhich were not designed to represent data structures content with high fidelity.\nTo address this problem, `SNL` relies\non [Cap'n Proto](https://github.com/capnproto/capnproto) open source interchange format.\n\n`DNL` provides a uniquified view of `SNL`, specifically designed for efficient multi-threaded traversal\nand analysis of netlist data.\nKey features of `DNL` include:\n\n- Read-only Data Structure: Ensures data integrity and stability during analysis.\n- Fast Construction: `DNL` is quickly built from `SNL`, facilitating rapid transitions between representations.\n- Index-based Minimal Details: Reduces overhead and focuses on essential connectivity information.\n- Connectivity Representation: Utilizes equipotentials between terminals to represent connections effectively.\n\nTogether, `SNL` and `DNL` enhance the fidelity, performance, and efficiency of netlist data handling in EDA workflows.\n\n#### Optimized for Parallelization and Cloud Computing\n\nSNL is engineered with a focus on parallelization, particularly for cloud computing applications. It features a robust object identification mechanism that streamlines the partitioning and merging of data across networks, facilitating efficient EDA applications.\n\nSNL is summarized in below's image.\n\n![SNL](./docs/images/Naja-SNL.png)\n\n:information_desk_person: If you have any questions, please [Contact Us](mailto:contact@keplertech.io)\n\n:star: If you find Naja interesting, and would like to stay up-to-date, consider starring this repo to help spread the word.\n\n### Documentation\n\n:eyeglasses: Naja's extended and API [documentation](https://naja.readthedocs.io/en/latest/) is available online.\n\n### Compilation\n\n#### Getting sources\n\n```bash\n# First clone the repository and go inside it\ngit clone --recurse-submodules https://github.com/najaeda/naja.git\n```\n\n#### Dependencies\n\nMandatory dependencies:\n\n1. Boost\n2. [cmake](https://cmake.org): at least 3.22 version.\nFor system-specific cmake installation options, please refer to [this link](https://cmake.org/download/).\n3. Python3: for building the SNL Python3 interface. This interface is used to load primitive cells (associated to Verilog parsing)\nand their associated characteristics (for instance: ressource count, timing characteristics, ...).\n\nOptional dependencies:\n\n1. [Doxygen](https://www.doxygen.nl): for the documentation generation.\n\nEmbedded dependencies, through git sub modules:\n\n1. [naja-verilog](https://github.com/najaeda/naja-verilog): for verilog parsing.\n2. [google test](https://github.com/google/googletest) for unit testing.\n\nOn Ubuntu:\n\n```bash\nsudo apt-get install g++ libboost-dev python3.9-dev capnproto libcapnp-dev libtbb-dev pkg-config bison flex doxygen\n```\n\nUsing [nix-shell](https://nixos.wiki/wiki/Development_environment_with_nix-shell):\n\n```bash\nnix-shell -p cmake boost python3 doxygen capnproto bison flex pkg-config tbb_2021_8\n```\n\nOn macOS, using [Homebrew](https://brew.sh/):\n\n```bash\nbrew install cmake doxygen capnp tbb bison flex boost\n```\n\nEnsure the versions of `bison` and `flex` installed via Homebrew take precedence over the macOS defaults by modifying your $PATH environment variable as follows:\n\n```bash\nexport PATH=\"/opt/homebrew/opt/flex/bin:/opt/homebrew/opt/bison/bin:$PATH\"\n```\n\n#### Building and Installing\n\n```bash\n#First define an env variable that points to the directory where you want naja to be installed:\nexport NAJA_INSTALL=\u003cpath_to_installation_dir\u003e\n# Create a build dir and go inside it\nmkdir build\ncd build\ncmake \u003cpath_to_naja_sources_dir\u003e -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$NAJA_INSTALL\n#For instance: cmake ~/srcs/naja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$NAJA_INSTALL\nmake\nmake test\nmake install\n```\n\n#### Building and Installing Documentation\n\n```bash\n#make sure that doxygen was available when launching the cmake command\ncd build\nmake docs\nmake install\n```\n\nDocumentation will be installed in $NAJA_INSTALL/doc directory. Starting file to open in browser is: $NAJA_INSTALL/doc/html/index.html.\n\n\u003cdiv align=\"right\"\u003e[ \u003ca href=\"#Introduction\"\u003e↑ Back to top ↑\u003c/a\u003e ]\u003c/div\u003e\n\n---\n\n### Use\n\n#### Environment\n\nAfter building and installing, start by setting up a runtime environment.\n\n```bash\nexport NAJA_INSTALL=\u003cpath_to_installation_dir\u003e\n#For Naja python interface and in particular primitives loading\nexport PYTHONPATH=$PYTHONPATH:$NAJA_INSTALL/lib/python\n```\n\n#### Inputs/Outputs\n\n##### SNL Interchange Format\n\nSNL relies on [Cap'n Proto](https://github.com/capnproto/capnproto) for data serialization and streaming. Schema files and C++ implementation can be found [here](https://github.com/najaeda/naja/tree/main/src/nl/nl/serialization/capnp).\n\nFiles composing the dump are created in a directory usually named \"snl\", composed of the following files:\n\n- **Manifest File (`snl.mf`):** This file encapsulates essential meta-information such as the schema version and other relevant details.\n- **Interface Definition File (`db_interface.snl`):** This file outlines the interfaces of modules: terminals and parameters.\n- **Implementation Specification File (`db_implementation.snl`):** Contained within this file are the detailed implementations of modules: instances, nets and connectivity between them.\n\nSNL files can be examined using the `capnp` tool.\n\n```bash\ncapnp decode --packed snl_interface.capnp DBInterface \u003c snl/db_interface.snl \u003e interface.txt\ncapnp decode --packed snl_implementation.capnp DBImplementation \u003c snl/db_implementation.snl \u003e implementation.txt\n```\n\n##### Verilog\n\nFor Verilog parsing, Naja relies on naja-verilog [submodule](https://github.com/najaeda/naja-verilog).\n\nA Verilog dumper is included in SNL API. See [here](https://github.com/najaeda/naja/blob/main/src/nl/formats/verilog/backend/SNLVRLDumper.h).\n\n\u003cdiv align=\"right\"\u003e[ \u003ca href=\"#Introduction\"\u003e↑ Back to top ↑\u003c/a\u003e ]\u003c/div\u003e\n\n---\n\n### Snippets\n\n#### c++\n\nThis [snippet](https://github.com/najaeda/naja/blob/main/src/app_snippet/src/NLUniverseSnippet.cpp) shows various SNL API netlist construction, manipulation and browsing examples.\n\n#### Python\n\nThis [snippet](https://github.com/najaeda/naja/blob/main/src/nl/snippets/python/naja_snippet.py) shows an equivalent example using Python interface.\n\n#### Application snippet\n\nAn application snippet can be found [here](https://github.com/najaeda/naja/blob/main/src/app_snippet).\n\nThis \"app\" directory and its contents can be copied to start a new application.\n\n\u003cdiv align=\"right\"\u003e[ \u003ca href=\"#Introduction\"\u003e↑ Back to top ↑\u003c/a\u003e ]\u003c/div\u003e\n\n---\n\n### Issues / Bugs\n\nPlease use [GitHub Issues](https://github.com/najaeda/naja/issues) to create and track requests and bugs.\n\n\u003cdiv align=\"right\"\u003e[ \u003ca href=\"#Introduction\"\u003e↑ Back to top ↑\u003c/a\u003e ]\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnajaeda%2Fnaja","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnajaeda%2Fnaja","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnajaeda%2Fnaja/lists"}