najaeda 0.1.8__cp313-cp313t-macosx_11_0_arm64.whl → 0.1.11__cp313-cp313t-macosx_11_0_arm64.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.

Potentially problematic release.


This version of najaeda might be problematic. Click here for more details.

@@ -16,16 +16,11 @@ build:
16
16
 
17
17
  # Build documentation in the "docs/" directory with Sphinx
18
18
  sphinx:
19
- configuration: src/najaeda/najaeda/docs/source/conf.py
20
-
21
- # Optionally build your docs in additional formats such as PDF and ePub
22
- # formats:
23
- # - pdf
24
- # - epub
19
+ configuration: src/najaeda/najaeda/docs/source/conf.py
25
20
 
26
21
  # Optional but recommended, declare the Python requirements required
27
22
  # to build your documentation
28
23
  # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
29
24
  python:
30
- install:
25
+ install:
31
26
  - requirements: src/najaeda/najaeda/docs/requirements.txt
@@ -1,5 +1,5 @@
1
- najaeda Complete API Documentation
2
- ==================================
1
+ Complete najaeda API Reference
2
+ ==============================
3
3
 
4
4
  .. automodule:: najaeda.netlist
5
5
  :members:
@@ -15,7 +15,7 @@ sys.path.insert(0, os.path.abspath('../../../'))
15
15
  project = 'najaeda'
16
16
  copyright = '2024, Naja authors'
17
17
  author = 'Naja authors'
18
- release = '0.1.8'
18
+ release = '0.1.9'
19
19
 
20
20
  # -- General configuration ---------------------------------------------------
21
21
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -31,10 +31,27 @@ autodoc_mock_imports = ["najaeda.snl"]
31
31
  templates_path = ['_templates']
32
32
  exclude_patterns = []
33
33
 
34
-
35
-
36
34
  # -- Options for HTML output -------------------------------------------------
37
35
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
38
36
 
39
37
  html_theme = 'sphinx_rtd_theme'
40
- html_static_path = ['_static']
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}")
@@ -1,11 +1,6 @@
1
1
  Equipotential Class
2
2
  ===================
3
3
 
4
- .. automodule:: najaeda.equipotential
5
- :members:
6
- :undoc-members:
7
- :show-inheritance:
8
-
9
4
  Equipotential Overview
10
5
  ----------------------
11
6
 
@@ -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
@@ -10,8 +10,10 @@ najaeda documentation
10
10
  :maxdepth: 2
11
11
  :caption: Contents:
12
12
 
13
+ introduction
13
14
  instance
14
15
  term
15
16
  net
16
17
  equipotential
17
- api
18
+ examples
19
+ api
@@ -1,18 +1,14 @@
1
1
  Instance Class
2
2
  ==============
3
3
 
4
- .. automodule:: najaeda.instance
5
- :members:
6
- :undoc-members:
7
- :show-inheritance:
8
-
9
4
  Instance Overview
10
5
  -----------------
11
6
 
12
- In `najaeda`, an `Instance` encapsulates the concept of an instance in its hierarchical context.
7
+ In **najaeda**, an :py:class:`najaeda.netlist.Instance` encapsulates the concept
8
+ of an instance in its hierarchical context.
13
9
 
14
- When an `Instance` is modified through editing methods,
15
- `najaeda` will automatically manage the necessary uniquification.
10
+ When an **Instance** is modified through editing methods,
11
+ **najaeda** will automatically manage the necessary uniquification.
16
12
 
17
13
  Instance Attributes
18
14
  -------------------
@@ -0,0 +1,53 @@
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
27
+ without relying on costly, proprietary EDA software.
28
+
29
+ **najaeda** empowers developers to innovate, adapt, and accelerate
30
+ their EDA processes with minimal overhead.
31
+
32
+ Information about the **najaeda** PyPI package is available at https://pypi.org/project/najaeda .
33
+
34
+ If you want more details about the underlying **naja** C++ library,
35
+ please visit the **naja** GitHub repository at https://github.com/najaeda/naja .
36
+
37
+ Installation
38
+ ------------
39
+ **najaeda** can be easily installed using pip:
40
+
41
+ .. code-block:: bash
42
+
43
+ pip install najaeda
44
+
45
+ Bug Reports
46
+ -----------
47
+ Please report any bugs to the `najaeda` issue tracker at
48
+ https://github.com/najaeda/naja/issues .
49
+
50
+ License
51
+ -------
52
+ This project is licensed under the Apache License 2.0.
53
+ See the `LICENSE <https://github.com/najaeda/naja/blob/main/LICENSE>`_ file for details.
@@ -1,15 +1,15 @@
1
1
  Net Class
2
2
  =========
3
3
 
4
- .. automodule:: najaeda.net
5
- :members:
6
- :undoc-members:
7
- :show-inheritance:
8
-
9
4
  Net Overview
10
5
  ------------
11
6
 
12
- The `Net` class is responsible for managing nets in the `najaeda` system.
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
13
 
14
14
  Net Attributes
15
15
  --------------
@@ -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()
@@ -1,15 +1,15 @@
1
1
  Term Class
2
2
  ==========
3
3
 
4
- .. automodule:: najaeda.term
5
- :members:
6
- :undoc-members:
7
- :show-inheritance:
8
-
9
4
  Term Overview
10
5
  -------------
11
6
 
12
- The `Term` class is responsible for managing terms in the `najaeda` system.
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
13
 
14
14
  Term Attributes
15
15
  ---------------
@@ -0,0 +1,13 @@
1
+ najaeda visitors
2
+ ================
3
+
4
+ Instance Visitor
5
+ ----------------
6
+
7
+ Instance Visitor Overview
8
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
9
+
10
+ .. autoclass:: najaeda.instance_visitor.Visitor
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
@@ -17,7 +17,7 @@ class VisitorConfig:
17
17
  ):
18
18
  """
19
19
  :param enter_condition: A callable that takes a node (dict)
20
- and returns True if the visitor should enter.
20
+ and returns True if the visitor should enter.
21
21
  :param callback: A callable that takes a node (dict) and performs an operation on it.
22
22
  :param args: Positional arguments to pass to the callback.
23
23
  :param kwargs: Keyword arguments to pass to the callback.
@@ -28,24 +28,16 @@ class VisitorConfig:
28
28
  self.kwargs = kwargs or {}
29
29
 
30
30
 
31
- class Visitor:
32
- def __init__(self, instance: netlist.Instance):
33
- """
34
- :param netlist: The hierarchical netlist to be traversed.
35
- """
36
- self.instance = instance
31
+ def visit(instance: netlist.Instance, config: VisitorConfig):
32
+ """Recursively visits nodes in the netlist hierarchy.
37
33
 
38
- def visit(self, instance: netlist.Instance, config: VisitorConfig):
39
- """
40
- Recursively visits nodes in the netlist hierarchy.
41
-
42
- :param instance: The current node in the netlist instance hierarchy.
43
- :param config: VisitorConfig object defining conditions and callbacks.
44
- """
45
- # Execute the callback
46
- config.callback(instance, *config.args, **config.kwargs)
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)
47
39
 
48
- # Check if we should proceed to children
49
- if config.enter_condition(instance):
50
- for child in instance.get_child_instances():
51
- self.visit(child, config)
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/libnaja_snl.dylib CHANGED
Binary file
Binary file