najaeda 0.3.3__cp314-cp314-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- najaeda/__init__.py +20 -0
- najaeda/_version.py +16 -0
- najaeda/docs/.readthedocs.yaml +26 -0
- najaeda/docs/requirements.txt +7 -0
- najaeda/docs/source/api.rst +7 -0
- najaeda/docs/source/common_classes.rst +11 -0
- najaeda/docs/source/conf.py +57 -0
- najaeda/docs/source/equipotential.rst +15 -0
- najaeda/docs/source/examples.rst.in +66 -0
- najaeda/docs/source/index.rst +17 -0
- najaeda/docs/source/instance.rst +34 -0
- najaeda/docs/source/introduction.rst +68 -0
- najaeda/docs/source/net.rst +20 -0
- najaeda/docs/source/netlist_classes.rst +11 -0
- najaeda/docs/source/preprocessor.py +73 -0
- najaeda/docs/source/term.rst +20 -0
- najaeda/docs/source/visitors.rst +13 -0
- najaeda/instance_visitor.py +43 -0
- najaeda/naja.pyd +0 -0
- najaeda/naja_bne.dll +0 -0
- najaeda/naja_dnl.dll +0 -0
- najaeda/naja_metrics.dll +0 -0
- najaeda/naja_nl.dll +0 -0
- najaeda/naja_opt.dll +0 -0
- najaeda/naja_python.dll +0 -0
- najaeda/native/__init__.py +0 -0
- najaeda/native/stats.py +341 -0
- najaeda/net_visitor.py +53 -0
- najaeda/netlist.py +1990 -0
- najaeda/pandas_stats.py +32 -0
- najaeda/primitives/__init__.py +0 -0
- najaeda/primitives/utils.py +19 -0
- najaeda/primitives/xilinx.py +541 -0
- najaeda/primitives/yosys.py +288 -0
- najaeda/stats.py +410 -0
- najaeda-0.3.3.dist-info/DELVEWHEEL +2 -0
- najaeda-0.3.3.dist-info/METADATA +108 -0
- najaeda-0.3.3.dist-info/RECORD +44 -0
- najaeda-0.3.3.dist-info/WHEEL +5 -0
- najaeda-0.3.3.dist-info/licenses/AUTHORS +7 -0
- najaeda-0.3.3.dist-info/licenses/LICENSE +201 -0
- najaeda.libs/msvcp140.dll +0 -0
- najaeda.libs/tbb12.dll +0 -0
- najaeda.libs/tbbmalloc.dll +0 -0
najaeda/__init__.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 The Naja authors
|
|
2
|
+
# <https://github.com/najaeda/naja/blob/main/AUTHORS>
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# start delvewheel patch
|
|
8
|
+
def _delvewheel_patch_1_11_2():
|
|
9
|
+
import os
|
|
10
|
+
if os.path.isdir(libs_dir := os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'najaeda.libs'))):
|
|
11
|
+
os.add_dll_directory(libs_dir)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
_delvewheel_patch_1_11_2()
|
|
15
|
+
del _delvewheel_patch_1_11_2
|
|
16
|
+
# end delvewheel patch
|
|
17
|
+
|
|
18
|
+
from ._version import version, git_hash
|
|
19
|
+
|
|
20
|
+
__all__ = ["version", "git_hash"]
|
najaeda/_version.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 The Naja authors
|
|
2
|
+
# <https://github.com/najaeda/naja/blob/main/AUTHORS>
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
from najaeda import naja
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def version():
|
|
10
|
+
"""Get the version of Naja."""
|
|
11
|
+
return naja.getVersion()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def git_hash():
|
|
15
|
+
"""Get the git hash of Naja."""
|
|
16
|
+
return naja.getGitHash()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 The Naja authors <https://github.com/najaeda/naja/blob/main/AUTHORS>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
# .readthedocs.yaml
|
|
5
|
+
# Read the Docs configuration file
|
|
6
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
7
|
+
|
|
8
|
+
# Required
|
|
9
|
+
version: 2
|
|
10
|
+
|
|
11
|
+
# Set the OS, Python version and other tools you might need
|
|
12
|
+
build:
|
|
13
|
+
os: ubuntu-22.04
|
|
14
|
+
tools:
|
|
15
|
+
python: "3.12"
|
|
16
|
+
|
|
17
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
18
|
+
sphinx:
|
|
19
|
+
configuration: src/najaeda/najaeda/docs/source/conf.py
|
|
20
|
+
|
|
21
|
+
# Optional but recommended, declare the Python requirements required
|
|
22
|
+
# to build your documentation
|
|
23
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
24
|
+
python:
|
|
25
|
+
install:
|
|
26
|
+
- requirements: src/najaeda/najaeda/docs/requirements.txt
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
|
|
6
|
+
# -- Project information -----------------------------------------------------
|
|
7
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
8
|
+
|
|
9
|
+
import sys
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
# Add the src directory to sys.path
|
|
13
|
+
sys.path.insert(0, os.path.abspath('../../../'))
|
|
14
|
+
|
|
15
|
+
project = 'najaeda'
|
|
16
|
+
copyright = '2024, Naja authors'
|
|
17
|
+
author = 'Naja authors'
|
|
18
|
+
release = '0.1.22'
|
|
19
|
+
|
|
20
|
+
# -- General configuration ---------------------------------------------------
|
|
21
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
22
|
+
|
|
23
|
+
extensions = [
|
|
24
|
+
'sphinx.ext.autodoc', # Enables the automodule directive
|
|
25
|
+
'sphinx.ext.napoleon', # (Optional) Supports Google and NumPy-style docstrings
|
|
26
|
+
'sphinx.ext.viewcode', # (Optional) Links to source code in docs
|
|
27
|
+
'sphinx.ext.todo', # (Optional) For TODOs in the documentation
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
autodoc_mock_imports = ["najaeda.naja"]
|
|
31
|
+
templates_path = ['_templates']
|
|
32
|
+
exclude_patterns = []
|
|
33
|
+
|
|
34
|
+
# -- Options for HTML output -------------------------------------------------
|
|
35
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
36
|
+
|
|
37
|
+
html_theme = 'sphinx_rtd_theme'
|
|
38
|
+
|
|
39
|
+
# Run preprocessing step if building in a specific environment
|
|
40
|
+
import os
|
|
41
|
+
print("Running preprocessing script for Sphinx documentation...")
|
|
42
|
+
preprocessor_script = os.path.abspath('./preprocessor.py')
|
|
43
|
+
source_dir = os.path.abspath('../../../examples')
|
|
44
|
+
source_rst = os.path.abspath('./examples.rst.in')
|
|
45
|
+
dest_rst = os.path.abspath('./examples.rst')
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
import subprocess
|
|
49
|
+
subprocess.call([
|
|
50
|
+
'python', preprocessor_script,
|
|
51
|
+
'--source_dir', source_dir,
|
|
52
|
+
'--source_rst', source_rst,
|
|
53
|
+
'--dest_rst', dest_rst
|
|
54
|
+
])
|
|
55
|
+
print("Preprocessing completed successfully.")
|
|
56
|
+
except Exception as e:
|
|
57
|
+
print(f"Error during preprocessing: {e}")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Equipotential Class
|
|
2
|
+
===================
|
|
3
|
+
|
|
4
|
+
Equipotential Overview
|
|
5
|
+
----------------------
|
|
6
|
+
|
|
7
|
+
The `Equipotential` class is responsible for managing equipotentials in the `najaeda` system.
|
|
8
|
+
|
|
9
|
+
Equipotential Attributes
|
|
10
|
+
------------------------
|
|
11
|
+
|
|
12
|
+
.. autoclass:: najaeda.netlist.Equipotential
|
|
13
|
+
:members:
|
|
14
|
+
:undoc-members:
|
|
15
|
+
:show-inheritance:
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
najaeda code examples
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
Load a design from liberty and Verilog
|
|
5
|
+
--------------------------------------
|
|
6
|
+
|
|
7
|
+
Following snippet shows how to load primitive cells from a liberty file
|
|
8
|
+
and a netlist from a Verilog file.
|
|
9
|
+
|
|
10
|
+
.. snippet:: load_design_liberty
|
|
11
|
+
|
|
12
|
+
Load a design with pre-existing libraries
|
|
13
|
+
-----------------------------------------
|
|
14
|
+
|
|
15
|
+
In FPGA design environments, Liberty files are often unavailable.
|
|
16
|
+
|
|
17
|
+
To address this, the following example demonstrates how to load primitives
|
|
18
|
+
without relying on Liberty files.
|
|
19
|
+
|
|
20
|
+
Naja EDA comes with pre-configured libraries to simplify this process.
|
|
21
|
+
Currently, it includes support for partial Xilinx primitives, but this can be
|
|
22
|
+
easily extended in the future. Don't hesitate to reach out if you need help.
|
|
23
|
+
|
|
24
|
+
.. snippet:: load_xilinx_design
|
|
25
|
+
|
|
26
|
+
Print all the instances in the netlist
|
|
27
|
+
--------------------------------------
|
|
28
|
+
|
|
29
|
+
Next example shows how to browse all the netlist and print all its content recursively.
|
|
30
|
+
|
|
31
|
+
.. snippet:: print_design_recursive
|
|
32
|
+
|
|
33
|
+
Similar to the previous example, but utilizing an instance visitor.
|
|
34
|
+
This approach allows you to perform operations on each instance while
|
|
35
|
+
also defining conditions for stopping or continuing exploration.
|
|
36
|
+
|
|
37
|
+
.. snippet:: print_design_visitor
|
|
38
|
+
|
|
39
|
+
Counting the number of leaves in a netlist
|
|
40
|
+
------------------------------------------
|
|
41
|
+
|
|
42
|
+
The instance visitor provides a tool for collecting various types of information
|
|
43
|
+
about a netlist.
|
|
44
|
+
|
|
45
|
+
The following example demonstrates how to use the visitor’s callback
|
|
46
|
+
function to transmit user-defined arguments, allowing for flexible data processing.
|
|
47
|
+
|
|
48
|
+
This specific use case shows how to count the number of leaf instances in a netlist.
|
|
49
|
+
|
|
50
|
+
.. snippet:: count_leaves
|
|
51
|
+
|
|
52
|
+
Design Statistics
|
|
53
|
+
-----------------
|
|
54
|
+
|
|
55
|
+
This example demonstrates how to use **najaeda** stats.
|
|
56
|
+
The code below generates a text report file, `design.stats`,
|
|
57
|
+
containing detailed statistics for each module in the design.
|
|
58
|
+
|
|
59
|
+
.. snippet:: design_stats
|
|
60
|
+
|
|
61
|
+
DLE (Dead Logic Elimination)
|
|
62
|
+
----------------------------
|
|
63
|
+
|
|
64
|
+
This example demonstrates how to perform Dead Logic Elimination (DLE) on a netlist.
|
|
65
|
+
|
|
66
|
+
.. snippet:: dle
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.. najaeda documentation master file, created by
|
|
2
|
+
sphinx-quickstart on Mon Dec 16 16:39:26 2024.
|
|
3
|
+
You can adapt this file completely to your liking, but it should at least
|
|
4
|
+
contain the root `toctree` directive.
|
|
5
|
+
|
|
6
|
+
najaeda documentation
|
|
7
|
+
=====================
|
|
8
|
+
|
|
9
|
+
.. toctree::
|
|
10
|
+
:maxdepth: 2
|
|
11
|
+
:caption: Contents:
|
|
12
|
+
|
|
13
|
+
introduction
|
|
14
|
+
netlist_classes
|
|
15
|
+
common_classes
|
|
16
|
+
examples
|
|
17
|
+
api
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Instance Class
|
|
2
|
+
==============
|
|
3
|
+
|
|
4
|
+
Instance Overview
|
|
5
|
+
-----------------
|
|
6
|
+
|
|
7
|
+
In **najaeda**, an :py:class:`najaeda.netlist.Instance` encapsulates the concept
|
|
8
|
+
of an instance in its hierarchical context.
|
|
9
|
+
|
|
10
|
+
When an **Instance** is modified through editing methods,
|
|
11
|
+
**najaeda** will automatically manage the necessary uniquification.
|
|
12
|
+
|
|
13
|
+
Generic Gates (and, or, etc.)
|
|
14
|
+
-----------------------------
|
|
15
|
+
|
|
16
|
+
**najaeda** supports **generic gates** as defined in Verilog, specifically:
|
|
17
|
+
|
|
18
|
+
- **n-input gates**: `and`, `nand`, `or`, `nor`, `xor`, `xnor`
|
|
19
|
+
- **n-output gates**: `buf`, `not`
|
|
20
|
+
|
|
21
|
+
In this model:
|
|
22
|
+
|
|
23
|
+
- **n-input gates** have a **single scalar output** and a **bus input terminal** (of size *n*).
|
|
24
|
+
- **n-output gates** have a **scalar input** and a **bus output terminal** (of size *n*).
|
|
25
|
+
|
|
26
|
+
All terminals in these generic instances are **unnamed** (see :py:attr:`najaeda.netlist.Instance.is_unnamed`).
|
|
27
|
+
|
|
28
|
+
Instance Attributes
|
|
29
|
+
-------------------
|
|
30
|
+
|
|
31
|
+
.. autoclass:: najaeda.netlist.Instance
|
|
32
|
+
:members:
|
|
33
|
+
:undoc-members:
|
|
34
|
+
:show-inheritance:
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Introduction
|
|
2
|
+
============
|
|
3
|
+
**najaeda** is a an Electronic Design Automation (EDA) Python package
|
|
4
|
+
that provides open source data structures and APIs for the development
|
|
5
|
+
of post logic synthesis EDA algorithms
|
|
6
|
+
such as: netlist simplification (constant and dead logic propagation),
|
|
7
|
+
logic replication, netlist partitioning, ASIC and FPGA place and route, ...
|
|
8
|
+
|
|
9
|
+
**najaeda** provides a powerful yet simple framework designed
|
|
10
|
+
to help software **AND** hardware developers efficiently navigate and
|
|
11
|
+
manipulate electronic design automation (EDA) workflows.
|
|
12
|
+
|
|
13
|
+
With **najaeda**, it is possible to:
|
|
14
|
+
|
|
15
|
+
* **Explore Netlists with Ease**:
|
|
16
|
+
* Navigate netlist hierarchy and connectivity effortlessly.
|
|
17
|
+
* Browse at multiple levels of detail:
|
|
18
|
+
* Bit-level or bus-level granularity.
|
|
19
|
+
* Instance-by-instance exploration or flattened views at the primitives level.
|
|
20
|
+
* Localized per-instance connections or comprehensive equipotential views.
|
|
21
|
+
* **Perform ECO (Engineering Change Order) Transformations**:
|
|
22
|
+
* Seamlessly apply and manage changes to your designs.
|
|
23
|
+
* **Prototype EDA Ideas Quickly**:
|
|
24
|
+
* Use an intuitive API to experiment with new EDA concepts and workflows.
|
|
25
|
+
* **Develop Custom EDA Tools**:
|
|
26
|
+
* Build fast, tailored tools for solving specific challenges without relying on costly, proprietary EDA software.
|
|
27
|
+
|
|
28
|
+
**najaeda** empowers developers to innovate, adapt, and accelerate
|
|
29
|
+
their EDA processes with minimal overhead.
|
|
30
|
+
|
|
31
|
+
Information about the **najaeda** PyPI package is available at https://pypi.org/project/najaeda .
|
|
32
|
+
|
|
33
|
+
If you want more details about the underlying **naja** C++ library,
|
|
34
|
+
please visit the **naja** GitHub repository at https://github.com/najaeda/naja .
|
|
35
|
+
|
|
36
|
+
Quick Start
|
|
37
|
+
===========
|
|
38
|
+
|
|
39
|
+
To get started with **najaeda**, try out the interactive notebook in Google Colab:
|
|
40
|
+
|
|
41
|
+
.. image:: https://colab.research.google.com/assets/colab-badge.svg
|
|
42
|
+
:target: https://colab.research.google.com/github/najaeda/najaeda-tutorials/blob/main/notebooks/01_getting_started.ipynb
|
|
43
|
+
:alt: Open in Colab
|
|
44
|
+
|
|
45
|
+
Installation
|
|
46
|
+
------------
|
|
47
|
+
**najaeda** can be easily installed using pip:
|
|
48
|
+
|
|
49
|
+
.. code-block:: bash
|
|
50
|
+
|
|
51
|
+
pip install najaeda
|
|
52
|
+
|
|
53
|
+
Bug Reports
|
|
54
|
+
-----------
|
|
55
|
+
|
|
56
|
+
If you encounter any bugs, please report them on the `najaeda` issue tracker:
|
|
57
|
+
https://github.com/najaeda/naja/issues
|
|
58
|
+
|
|
59
|
+
You’re also welcome to join the discussion on Matrix:
|
|
60
|
+
|
|
61
|
+
.. image:: https://img.shields.io/badge/Matrix-Join%20Chat-success?logo=matrix
|
|
62
|
+
:target: https://matrix.to/#/#naja:fossi-chat.org
|
|
63
|
+
:alt: Join the Matrix chat
|
|
64
|
+
|
|
65
|
+
License
|
|
66
|
+
-------
|
|
67
|
+
This project is licensed under the Apache License 2.0.
|
|
68
|
+
See the `LICENSE <https://github.com/najaeda/naja/blob/main/LICENSE>`_ file for details.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Net Class
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
Net Overview
|
|
5
|
+
------------
|
|
6
|
+
|
|
7
|
+
In **najaeda**, a :py:class:`najaeda.netlist.Net` can represent the following scenarios:
|
|
8
|
+
|
|
9
|
+
1. **Simple Scalar Net**: A net that represents a single scalar signal. See :py:meth:`najaeda.netlist.Net.is_scalar`.
|
|
10
|
+
2. **Full Bus Net**: A net that encompasses an entire bus. See :py:meth:`najaeda.netlist.Net.is_bus`.
|
|
11
|
+
3. **Single Bit of a Bus**: A net that corresponds to an individual bit within a bus. See :py:meth:`najaeda.netlist.Net.is_bus_bit`.
|
|
12
|
+
4. **Concatenation of Bits**: A net created by combining multiple bits. See :py:meth:`najaeda.netlist.Net.is_concat`.
|
|
13
|
+
|
|
14
|
+
Net Attributes
|
|
15
|
+
--------------
|
|
16
|
+
|
|
17
|
+
.. autoclass:: najaeda.netlist.Net
|
|
18
|
+
:members:
|
|
19
|
+
:undoc-members:
|
|
20
|
+
:show-inheritance:
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import re
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
class RSTSnippetInserter:
|
|
6
|
+
def __init__(self, source_dir, source_rst, dest_rst):
|
|
7
|
+
self.source_dir = Path(source_dir)
|
|
8
|
+
self.source_rst = Path(source_rst)
|
|
9
|
+
self.dest_rst = Path(dest_rst)
|
|
10
|
+
self.snippet_pattern = re.compile(r"# snippet-start: (.+?)\n(.*?)# snippet-end: \1", re.DOTALL)
|
|
11
|
+
self.placeholder_pattern = re.compile(r"\.\. snippet:: (.+)")
|
|
12
|
+
|
|
13
|
+
def extract_snippets(self):
|
|
14
|
+
snippets = {}
|
|
15
|
+
for file in self.source_dir.rglob("*.py"):
|
|
16
|
+
with file.open("r") as f:
|
|
17
|
+
print(f"Extracting snippets from {file}")
|
|
18
|
+
content = f.read()
|
|
19
|
+
for match in self.snippet_pattern.finditer(content):
|
|
20
|
+
snippet_name = match.group(1)
|
|
21
|
+
snippet_code = match.group(2).strip()
|
|
22
|
+
print(f"Extracted snippet {snippet_name} from {file}")
|
|
23
|
+
snippets[snippet_name] = snippet_code
|
|
24
|
+
return snippets
|
|
25
|
+
|
|
26
|
+
def replace_placeholders(self, snippets):
|
|
27
|
+
if not self.source_rst.exists():
|
|
28
|
+
print(f"Source RST {self.source_rst} does not exist.")
|
|
29
|
+
return
|
|
30
|
+
|
|
31
|
+
target_rst = open(self.dest_rst, "w")
|
|
32
|
+
|
|
33
|
+
content = self.source_rst.read_text()
|
|
34
|
+
for match in self.placeholder_pattern.finditer(content):
|
|
35
|
+
snippet_name = match.group(1)
|
|
36
|
+
if snippet_name in snippets:
|
|
37
|
+
code_block = f"\n.. code-block:: python\n\n {snippets[snippet_name].replace('\n', '\n ')}"
|
|
38
|
+
content = content.replace(f".. snippet:: {snippet_name}", code_block)
|
|
39
|
+
else:
|
|
40
|
+
raise ValueError(f"Snippet {snippet_name} not found in source files. Available snippets: {snippets.keys()}")
|
|
41
|
+
|
|
42
|
+
target_rst.write(content)
|
|
43
|
+
print(f"Created {target_rst} with code snippets.")
|
|
44
|
+
|
|
45
|
+
def run(self):
|
|
46
|
+
snippets = self.extract_snippets()
|
|
47
|
+
self.replace_placeholders(snippets)
|
|
48
|
+
|
|
49
|
+
def main():
|
|
50
|
+
parser = argparse.ArgumentParser(description="Insert code snippets into RST files.")
|
|
51
|
+
parser.add_argument(
|
|
52
|
+
"--source_dir",
|
|
53
|
+
required=True,
|
|
54
|
+
help="Directory containing source files with snippets.",
|
|
55
|
+
)
|
|
56
|
+
parser.add_argument(
|
|
57
|
+
"--source_rst",
|
|
58
|
+
required=True,
|
|
59
|
+
help="source RST file to update with snippets.",
|
|
60
|
+
)
|
|
61
|
+
parser.add_argument(
|
|
62
|
+
"--dest_rst",
|
|
63
|
+
required=True,
|
|
64
|
+
help="dest RST file.",
|
|
65
|
+
)
|
|
66
|
+
args = parser.parse_args()
|
|
67
|
+
|
|
68
|
+
inserter = RSTSnippetInserter(args.source_dir, args.source_rst, args.dest_rst)
|
|
69
|
+
inserter.run()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
if __name__ == "__main__":
|
|
73
|
+
main()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Term Class
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
Term Overview
|
|
5
|
+
-------------
|
|
6
|
+
|
|
7
|
+
In **najaeda**, a :py:class:`najaeda.netlist.Term` (also referred to as a Port in Verilog terminology)
|
|
8
|
+
can represent the following scenarios:
|
|
9
|
+
|
|
10
|
+
1. **Single Bit Scalar Terminal**: A terminal representing a single scalar signal. See :py:meth:`najaeda.netlist.Term.is_scalar` .
|
|
11
|
+
2. **Full Bus Terminal**: A terminal representing an entire bus. See :py:meth:`najaeda.netlist.Term.is_bus` .
|
|
12
|
+
3. **Single Bus Bit Terminal**: A terminal representing a single bit of a bus. See :py:meth:`najaeda.netlist.Term.is_bus_bit` .
|
|
13
|
+
|
|
14
|
+
Term Attributes
|
|
15
|
+
---------------
|
|
16
|
+
|
|
17
|
+
.. autoclass:: najaeda.netlist.Term
|
|
18
|
+
:members:
|
|
19
|
+
:undoc-members:
|
|
20
|
+
:show-inheritance:
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 The Naja authors
|
|
2
|
+
# <https://github.com/najaeda/naja/blob/main/AUTHORS>
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
from typing import Callable
|
|
7
|
+
from najaeda import netlist
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class VisitorConfig:
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
enter_condition: Callable[[netlist.Instance], bool] = lambda node: True,
|
|
14
|
+
callback: Callable[..., None] = lambda node, *args, **kwargs: None,
|
|
15
|
+
args: tuple = (),
|
|
16
|
+
kwargs: dict = None,
|
|
17
|
+
):
|
|
18
|
+
"""
|
|
19
|
+
:param enter_condition: A callable that takes a node (dict)
|
|
20
|
+
and returns True if the visitor should enter.
|
|
21
|
+
:param callback: A callable that takes a node (dict) and performs an operation on it.
|
|
22
|
+
:param args: Positional arguments to pass to the callback.
|
|
23
|
+
:param kwargs: Keyword arguments to pass to the callback.
|
|
24
|
+
"""
|
|
25
|
+
self.enter_condition = enter_condition
|
|
26
|
+
self.callback = callback
|
|
27
|
+
self.args = args
|
|
28
|
+
self.kwargs = kwargs or {}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def visit(instance: netlist.Instance, config: VisitorConfig):
|
|
32
|
+
"""Recursively visits nodes in the netlist hierarchy.
|
|
33
|
+
|
|
34
|
+
:param instance: The current node in the netlist instance hierarchy.
|
|
35
|
+
:param config: VisitorConfig object defining conditions and callbacks.
|
|
36
|
+
"""
|
|
37
|
+
# Execute the callback
|
|
38
|
+
config.callback(instance, *config.args, **config.kwargs)
|
|
39
|
+
|
|
40
|
+
# Check if we should proceed to children
|
|
41
|
+
if config.enter_condition(instance):
|
|
42
|
+
for child in instance.get_child_instances():
|
|
43
|
+
visit(child, config)
|
najaeda/naja.pyd
ADDED
|
Binary file
|
najaeda/naja_bne.dll
ADDED
|
Binary file
|
najaeda/naja_dnl.dll
ADDED
|
Binary file
|
najaeda/naja_metrics.dll
ADDED
|
Binary file
|
najaeda/naja_nl.dll
ADDED
|
Binary file
|
najaeda/naja_opt.dll
ADDED
|
Binary file
|
najaeda/naja_python.dll
ADDED
|
Binary file
|
|
File without changes
|