Metadata-Version: 2.1
Name: najaeda
Version: 0.1.3
Summary: Naja EDA Python package
Author-Email: Naja Authors <contact@keplertech.io>
License: Apache License 2.0
Project-URL: Homepage, https://github.com/najaeda/naja
Requires-Python: >=3.8
Description-Content-Type: text/x-rst

Naja EDA Python Package
=======================

Naja EDA is a Python package that provides data structures and APIs for developing post-synthesis Electronic Design Automation (EDA) algorithms.
It serves as the Python counterpart to the `Naja C++ project <https://github.com/najaeda/naja>`_.

Installation
------------

Install Naja EDA using pip:

.. code-block:: bash

    pip install najaeda

Examples
--------

Load a design from a liberty file and a Verilog file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Following snippet shows how to load primitive cells from a liberty file and
a netlist from a Verilog file.

.. code-block:: python

    from os import path
    import sys
    from najaeda import netlist
    
    benchmarks = path.join('..','benchmarks')
    liberty_files = [
        'NangateOpenCellLibrary_typical.lib',
        'fakeram45_1024x32.lib',
        'fakeram45_64x32.lib'
    ]
    liberty_files = list(map(lambda p:path.join(benchmarks, 'liberty', p), liberty_files))
        
    netlist.load_liberty(liberty_files)
    top = netlist.load_verilog([path.join(benchmarks, 'verilog', 'tinyrocket.v')])
    
    top.dump_verilog('.', 'tinyrocket_naja.v')

Print all the instances in the netlist
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Next example shows how to browse all the netlist and print all its content.

.. code-block:: python

    def print_netlist(instance):
        for child_instance in instance.get_child_instances():
            print(f"{child_instance}:{child_instance.get_model_name()}")
            print_netlist(child_instance)

Documentation
-------------

Naja documentation is available on the `Naja GitHub repository <https://github.com/najaeda/naja>`_.

License
-------

This project is licensed under the Apache License 2.0. See the `LICENSE <https://github.com/najaeda/naja/blob/main/LICENSE>`_ file for details.