najaeda 0.1.11__cp312-cp312-macosx_11_0_arm64.whl → 0.1.12__cp312-cp312-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.
- najaeda/docs/source/common_classes.rst +11 -0
- najaeda/docs/source/index.rst +2 -4
- najaeda/docs/source/netlist_classes.rst +11 -0
- najaeda/libnaja_snl.dylib +0 -0
- najaeda/libnaja_snl_python.dylib +0 -0
- najaeda/netlist.py +27 -3
- najaeda-0.1.12.dist-info/METADATA +79 -0
- {najaeda-0.1.11.dist-info → najaeda-0.1.12.dist-info}/RECORD +11 -9
- najaeda-0.1.11.dist-info/METADATA +0 -203
- {najaeda-0.1.11.dist-info → najaeda-0.1.12.dist-info}/WHEEL +0 -0
- {najaeda-0.1.11.dist-info → najaeda-0.1.12.dist-info}/licenses/AUTHORS +0 -0
- {najaeda-0.1.11.dist-info → najaeda-0.1.12.dist-info}/licenses/LICENSE +0 -0
najaeda/docs/source/index.rst
CHANGED
najaeda/libnaja_snl.dylib
CHANGED
|
Binary file
|
najaeda/libnaja_snl_python.dylib
CHANGED
|
Binary file
|
najaeda/netlist.py
CHANGED
|
@@ -727,12 +727,24 @@ class Attribute:
|
|
|
727
727
|
return str(self.snlAttribute)
|
|
728
728
|
|
|
729
729
|
def get_name(self):
|
|
730
|
+
"""
|
|
731
|
+
:return: the name of the attribute.
|
|
732
|
+
:rtype: str
|
|
733
|
+
"""
|
|
730
734
|
return self.snlAttribute.getName()
|
|
731
735
|
|
|
732
736
|
def has_value(self):
|
|
737
|
+
"""
|
|
738
|
+
:return: True if the attribute has a value.
|
|
739
|
+
:rtype: bool
|
|
740
|
+
"""
|
|
733
741
|
return self.snlAttribute.hasValue()
|
|
734
742
|
|
|
735
743
|
def get_value(self):
|
|
744
|
+
"""
|
|
745
|
+
:return: the value of the attribute.
|
|
746
|
+
:rtype: str
|
|
747
|
+
"""
|
|
736
748
|
return self.snlAttribute.getValue()
|
|
737
749
|
|
|
738
750
|
|
|
@@ -774,6 +786,7 @@ class Instance:
|
|
|
774
786
|
def get_leaf_children(self):
|
|
775
787
|
"""Iterate over the leaf children of this Instance.
|
|
776
788
|
Equivalent to the underlying leaves of the instanciation tree.
|
|
789
|
+
|
|
777
790
|
:return: an iterator over the leaf children Instance of this Instance.
|
|
778
791
|
:rtype: Iterator[Instance]
|
|
779
792
|
"""
|
|
@@ -801,7 +814,7 @@ class Instance:
|
|
|
801
814
|
return len(self.pathIDs) == 0
|
|
802
815
|
|
|
803
816
|
def is_assign(self) -> bool:
|
|
804
|
-
"""
|
|
817
|
+
"""(assign a=b) will create an instance of assign connecting
|
|
805
818
|
the wire a to the output of the assign and b to the input.
|
|
806
819
|
|
|
807
820
|
:return: True if this is an assign. Assigns are represented with
|
|
@@ -1041,8 +1054,11 @@ class Instance:
|
|
|
1041
1054
|
yield Term(self.pathIDs, term)
|
|
1042
1055
|
|
|
1043
1056
|
def get_flat_output_terms(self):
|
|
1044
|
-
"""
|
|
1045
|
-
|
|
1057
|
+
"""Iterate over all scalar output terms and bus output term bits
|
|
1058
|
+
of this Instance.
|
|
1059
|
+
|
|
1060
|
+
:return: the flat output terms of this Instance.
|
|
1061
|
+
:rtype: Iterator[Term]
|
|
1046
1062
|
"""
|
|
1047
1063
|
for term in self.__get_snl_model().getTerms():
|
|
1048
1064
|
if term.getDirection() != snl.SNLTerm.Direction.Input:
|
|
@@ -1053,6 +1069,11 @@ class Instance:
|
|
|
1053
1069
|
yield Term(self.pathIDs, term)
|
|
1054
1070
|
|
|
1055
1071
|
def get_attributes(self):
|
|
1072
|
+
"""Iterate over the attributes of this Instance.
|
|
1073
|
+
|
|
1074
|
+
:return: the attributes of this Instance.
|
|
1075
|
+
:rtype: Iterator[Attribute]
|
|
1076
|
+
"""
|
|
1056
1077
|
leaf_object = self.__get_leaf_snl_object()
|
|
1057
1078
|
for attribute in leaf_object.getAttributes():
|
|
1058
1079
|
yield Attribute(attribute)
|
|
@@ -1191,6 +1212,7 @@ class Instance:
|
|
|
1191
1212
|
|
|
1192
1213
|
def create_bus_term(self, name: str, msb: int, lsb: int, direction) -> Term:
|
|
1193
1214
|
"""Create a bus Term in this Instance with the given name, msb, lsb and direction.
|
|
1215
|
+
|
|
1194
1216
|
:param str name: the name of the Term to create.
|
|
1195
1217
|
:param int msb: the most significant bit of the Term to create.
|
|
1196
1218
|
:param int lsb: the least significant bit of the Term to create.
|
|
@@ -1328,7 +1350,9 @@ def load_liberty(files: list):
|
|
|
1328
1350
|
|
|
1329
1351
|
def load_primitives(name: str):
|
|
1330
1352
|
"""Loads a primitive library embedded in najaeda.
|
|
1353
|
+
|
|
1331
1354
|
Currently supported libraries are:
|
|
1355
|
+
|
|
1332
1356
|
- xilinx
|
|
1333
1357
|
"""
|
|
1334
1358
|
if name == "xilinx":
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: najaeda
|
|
3
|
+
Version: 0.1.12
|
|
4
|
+
Summary: Naja EDA Python package
|
|
5
|
+
Author-Email: Naja Authors <contact@keplertech.io>
|
|
6
|
+
License: Apache License 2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/najaeda/naja
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Description-Content-Type: text/x-rst
|
|
10
|
+
|
|
11
|
+
Naja EDA Python Package
|
|
12
|
+
=======================
|
|
13
|
+
|
|
14
|
+
Naja EDA is a Python package that provides data structures and APIs for developing post-synthesis Electronic Design Automation (EDA) algorithms.
|
|
15
|
+
|
|
16
|
+
Naja EDA provides a powerful yet simple framework designed to help software
|
|
17
|
+
and hardware developers efficiently navigate and manipulate electronic
|
|
18
|
+
design automation (EDA) workflows.
|
|
19
|
+
|
|
20
|
+
With Naja EDA, you can:
|
|
21
|
+
|
|
22
|
+
* Explore Netlists with Ease:
|
|
23
|
+
|
|
24
|
+
* Navigate netlist hierarchy and connectivity effortlessly.
|
|
25
|
+
* Browse at multiple levels of detail:
|
|
26
|
+
|
|
27
|
+
* Bit-level or bus-level granularity.
|
|
28
|
+
* Instance-by-instance exploration or flattened views at the primitives level.
|
|
29
|
+
* Localized per-instance connections or comprehensive equipotential views.
|
|
30
|
+
|
|
31
|
+
* Perform ECO (Engineering Change Order) Transformations:
|
|
32
|
+
|
|
33
|
+
* Seamlessly apply and manage changes to your designs.
|
|
34
|
+
|
|
35
|
+
* Prototype EDA Ideas Quickly:
|
|
36
|
+
|
|
37
|
+
* Use an intuitive API to experiment with new EDA concepts and workflows.
|
|
38
|
+
|
|
39
|
+
* Develop Custom EDA Tools:
|
|
40
|
+
|
|
41
|
+
* Build fast, tailored tools for solving specific challenges without relying on costly, proprietary EDA software.
|
|
42
|
+
|
|
43
|
+
Naja EDA empowers developers to innovate, adapt, and accelerate their EDA
|
|
44
|
+
processes with minimal overhead.
|
|
45
|
+
|
|
46
|
+
Naja EDA is the Python counterpart of the `Naja C++ project <https://github.com/najaeda/naja>`_.
|
|
47
|
+
|
|
48
|
+
If you’re interested in this project, please consider starring it on GitHub.
|
|
49
|
+
Feel free to reach out to us anytime at `contact@keplertech.io <mailto:contact@keplertech.io>`_.
|
|
50
|
+
|
|
51
|
+
Installation
|
|
52
|
+
------------
|
|
53
|
+
|
|
54
|
+
Install Naja EDA using pip:
|
|
55
|
+
|
|
56
|
+
.. code-block:: bash
|
|
57
|
+
|
|
58
|
+
pip install najaeda
|
|
59
|
+
|
|
60
|
+
Documentation
|
|
61
|
+
-------------
|
|
62
|
+
|
|
63
|
+
Naja EDA online documentation is available `here <https://najaeda.readthedocs.io/en/latest/index.html>`_.
|
|
64
|
+
|
|
65
|
+
Examples
|
|
66
|
+
--------
|
|
67
|
+
|
|
68
|
+
A list of examples can be found in this
|
|
69
|
+
documentation `section <https://najaeda.readthedocs.io/en/latest/examples.html>`_.
|
|
70
|
+
|
|
71
|
+
Support
|
|
72
|
+
-------
|
|
73
|
+
If you encounter any issues or have questions, please report them on the
|
|
74
|
+
`Naja issue tracker <https://github.com/najaeda/naja/issues>`_.
|
|
75
|
+
|
|
76
|
+
License
|
|
77
|
+
-------
|
|
78
|
+
This project is licensed under the Apache License 2.0. \
|
|
79
|
+
See the `LICENSE <https://github.com/najaeda/naja/blob/main/LICENSE>`_ file for details.
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
najaeda
|
|
2
|
-
najaeda
|
|
3
|
-
najaeda-0.1.11.dist-info/METADATA,sha256=Kl445PNmMAaclhm5MqkBms6A5AmGvDpGs8aFr36wyMw,7218
|
|
4
|
-
najaeda-0.1.11.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
-
najaeda-0.1.11.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
|
|
6
|
-
najaeda/netlist.py,sha256=xutSwtSsMHtXefn8vG1JVMUm_XZMOv_6wQfxywDvF8U,46275
|
|
7
|
-
najaeda/libnaja_snl_python.dylib,sha256=MOxwcsPWDKcAMCg4fmDQo2RtC0SKLXg5Z4bc0XWzZtc,825616
|
|
1
|
+
najaeda/netlist.py,sha256=8p0iHWDNbsMo-DndUBKLc43j7agtgb_jhlQdgkoYpvU,46750
|
|
2
|
+
najaeda/libnaja_snl_python.dylib,sha256=4G2S6jvPYE2Us6x08zaELur4TbqfUYK7e3QVYkfiw_Q,825616
|
|
8
3
|
najaeda/pandas_stats.py,sha256=yOb4ka965U7rN4D6AwvSGmRyeT_O7Ed-5cmT8BFbfeo,1070
|
|
9
4
|
najaeda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
najaeda/libnaja_snl.dylib,sha256=
|
|
5
|
+
najaeda/libnaja_snl.dylib,sha256=T76kBcwP4dGXUXS5aD1mcNr5hBAL8ou-nJGQNg7tXIA,574160
|
|
11
6
|
najaeda/snl.so,sha256=v80hVD1Hzs7kL5p_rZVfno3pyUd_cuuL5F9IhI_I7D8,98272
|
|
12
7
|
najaeda/stats.py,sha256=xWiIHa-S9yCHgAjyi6fVtx9C96o9v4MkYU7x5GdRKwA,16250
|
|
13
8
|
najaeda/instance_visitor.py,sha256=JMsPSQaWNiDjxS05rxg83a0PIsrOIuTi9G35hkwdibs,1530
|
|
14
9
|
najaeda/docs/requirements.txt,sha256=1XIBGTIplm2arC9HhDCfLuAjozGdVSXkqmOj8ybuT6U,121
|
|
15
10
|
najaeda/docs/.readthedocs.yaml,sha256=nN_Psro-YdfPcIiueZkJcZepts68g23rqVThhKnmVRw,790
|
|
16
|
-
najaeda/docs/source/index.rst,sha256=
|
|
11
|
+
najaeda/docs/source/index.rst,sha256=80VMfeEGHObnOUXRBxIzISQsG_HNkgT-pUpsDZsCfOY,387
|
|
17
12
|
najaeda/docs/source/instance.rst,sha256=7B2IBB0p32Tb4qvOCE77OlrQaYpFADvmTlq1q8eyVqw,458
|
|
18
13
|
najaeda/docs/source/conf.py,sha256=iSeerg2pJlZlhtwkJ9edRRYrLEdx3R1p7GWi78dHP1o,2019
|
|
19
14
|
najaeda/docs/source/preprocessor.py,sha256=TK4LsTdNbv2dxkKQaJ7cEyo9PU5v_56vlrFCJYIPKf8,2625
|
|
@@ -21,8 +16,15 @@ najaeda/docs/source/term.rst,sha256=QKWT6u1xjEjusvcZYknKQ-M83ibohO5y1EYTQnnXqak,
|
|
|
21
16
|
najaeda/docs/source/net.rst,sha256=i6YEir8ZOldSY8-UmPxgVJ4Ot3y-Q6seRkBr2H-KmXc,732
|
|
22
17
|
najaeda/docs/source/visitors.rst,sha256=KScCr7BytrhFxWfZPyYWIrr3CEJuk5Tx-LjEuDnnBaA,227
|
|
23
18
|
najaeda/docs/source/examples.rst.in,sha256=4ZStOA3N5VHbKZgdn2kaEQZL7wPoJwODS2E1BO54uFY,2091
|
|
19
|
+
najaeda/docs/source/common_classes.rst,sha256=o20u3mcpFYINwy0sVdye90ZPMQcPqoH3V4ERKcG7SZI,181
|
|
24
20
|
najaeda/docs/source/equipotential.rst,sha256=0MDi-4fPEsX7K_ezWj5DB3mCalnhqN-sicYbQKYQfNc,335
|
|
21
|
+
najaeda/docs/source/netlist_classes.rst,sha256=Zrha9MQVEdEwxmP2zhgC0K3iioZXXerzeFoOz5SrOXM,132
|
|
25
22
|
najaeda/docs/source/introduction.rst,sha256=kE4qxEJCgcAswiT3rIJS21oBYIMg1cyT_rKmOzQgvsI,2095
|
|
26
23
|
najaeda/docs/source/api.rst,sha256=47VCPyF4Py_1cklZ3q9fmOMhqqI17rxwU_VUJETfCwY,151
|
|
27
24
|
najaeda/primitives/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
25
|
najaeda/primitives/xilinx.py,sha256=fuu4KxEIuC0ueCK4C_gds6hzgtJsLE3tjDtOHtY9McM,25947
|
|
26
|
+
najaeda-0.1.12.dist-info/RECORD,,
|
|
27
|
+
najaeda-0.1.12.dist-info/WHEEL,sha256=bS2kxwU1pioFffhNQmlfvjD0H1flBf5ZtxV4jDj8Nvc,114
|
|
28
|
+
najaeda-0.1.12.dist-info/METADATA,sha256=SlRgiK7xMLvNflXb_hKnXr7WamPV2wijr-qtmyqUH20,2475
|
|
29
|
+
najaeda-0.1.12.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
30
|
+
najaeda-0.1.12.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: najaeda
|
|
3
|
-
Version: 0.1.11
|
|
4
|
-
Summary: Naja EDA Python package
|
|
5
|
-
Author-Email: Naja Authors <contact@keplertech.io>
|
|
6
|
-
License: Apache License 2.0
|
|
7
|
-
Project-URL: Homepage, https://github.com/najaeda/naja
|
|
8
|
-
Requires-Python: >=3.8
|
|
9
|
-
Description-Content-Type: text/x-rst
|
|
10
|
-
|
|
11
|
-
Naja EDA Python Package
|
|
12
|
-
=======================
|
|
13
|
-
|
|
14
|
-
Naja EDA is a Python package that provides data structures and APIs for developing post-synthesis Electronic Design Automation (EDA) algorithms.
|
|
15
|
-
|
|
16
|
-
Naja EDA provides a powerful yet simple framework designed to help software
|
|
17
|
-
and hardware developers efficiently navigate and manipulate electronic
|
|
18
|
-
design automation (EDA) workflows.
|
|
19
|
-
|
|
20
|
-
With Naja EDA, you can:
|
|
21
|
-
|
|
22
|
-
* Explore Netlists with Ease:
|
|
23
|
-
|
|
24
|
-
* Navigate netlist hierarchy and connectivity effortlessly.
|
|
25
|
-
* Browse at multiple levels of detail:
|
|
26
|
-
|
|
27
|
-
* Bit-level or bus-level granularity.
|
|
28
|
-
* Instance-by-instance exploration or flattened views at the primitives level.
|
|
29
|
-
* Localized per-instance connections or comprehensive equipotential views.
|
|
30
|
-
|
|
31
|
-
* Perform ECO (Engineering Change Order) Transformations:
|
|
32
|
-
|
|
33
|
-
* Seamlessly apply and manage changes to your designs.
|
|
34
|
-
|
|
35
|
-
* Prototype EDA Ideas Quickly:
|
|
36
|
-
|
|
37
|
-
* Use an intuitive API to experiment with new EDA concepts and workflows.
|
|
38
|
-
|
|
39
|
-
* Develop Custom EDA Tools:
|
|
40
|
-
|
|
41
|
-
* Build fast, tailored tools for solving specific challenges without relying on costly, proprietary EDA software.
|
|
42
|
-
|
|
43
|
-
Naja EDA empowers developers to innovate, adapt, and accelerate their EDA
|
|
44
|
-
processes with minimal overhead.
|
|
45
|
-
|
|
46
|
-
Naja EDA is the Python counterpart of the `Naja C++ project <https://github.com/najaeda/naja>`_.
|
|
47
|
-
|
|
48
|
-
Installation
|
|
49
|
-
------------
|
|
50
|
-
|
|
51
|
-
Install Naja EDA using pip:
|
|
52
|
-
|
|
53
|
-
.. code-block:: bash
|
|
54
|
-
|
|
55
|
-
pip install najaeda
|
|
56
|
-
|
|
57
|
-
Documentation
|
|
58
|
-
-------------
|
|
59
|
-
|
|
60
|
-
Naja EDA online documentation is available `here <https://najaeda.readthedocs.io/en/latest/index.html>`_.
|
|
61
|
-
|
|
62
|
-
Examples
|
|
63
|
-
--------
|
|
64
|
-
|
|
65
|
-
Load a design from a liberty file and a Verilog file
|
|
66
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
67
|
-
Following snippet shows how to load primitive cells from a liberty file and
|
|
68
|
-
a netlist from a Verilog file.
|
|
69
|
-
|
|
70
|
-
.. code-block:: python
|
|
71
|
-
|
|
72
|
-
benchmarks = path.join('..','benchmarks')
|
|
73
|
-
liberty_files = [
|
|
74
|
-
'NangateOpenCellLibrary_typical.lib',
|
|
75
|
-
'fakeram45_1024x32.lib',
|
|
76
|
-
'fakeram45_64x32.lib'
|
|
77
|
-
]
|
|
78
|
-
liberty_files = list(map(lambda p:path.join(benchmarks, 'liberty', p), liberty_files))
|
|
79
|
-
|
|
80
|
-
netlist.load_liberty(liberty_files)
|
|
81
|
-
top = netlist.load_verilog([path.join(benchmarks, 'verilog', 'tinyrocket.v')])
|
|
82
|
-
|
|
83
|
-
top.dump_verilog('.', 'tinyrocket_naja.v')
|
|
84
|
-
|
|
85
|
-
Load a design with pre-existing libraries
|
|
86
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
87
|
-
In FPGA design environments, Liberty files are often unavailable.
|
|
88
|
-
|
|
89
|
-
To address this, the following example demonstrates how to load primitives
|
|
90
|
-
without relying on Liberty files.
|
|
91
|
-
|
|
92
|
-
Naja EDA comes with pre-configured libraries to simplify this process.
|
|
93
|
-
Currently, it includes support for partial Xilinx primitives, but this can be
|
|
94
|
-
easily extended in the future. Don't hesitate to reach out if you need help.
|
|
95
|
-
|
|
96
|
-
.. code-block:: python
|
|
97
|
-
|
|
98
|
-
netlist.load_primitives('xilinx')
|
|
99
|
-
benchmarks = path.join('..','benchmarks')
|
|
100
|
-
top = netlist.load_verilog([path.join(benchmarks, 'verilog', 'vexriscv.v')])
|
|
101
|
-
|
|
102
|
-
Print all the instances in the netlist
|
|
103
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
104
|
-
Next example shows how to browse all the netlist and print all its content recursively.
|
|
105
|
-
|
|
106
|
-
.. code-block:: python
|
|
107
|
-
|
|
108
|
-
def print_netlist(instance):
|
|
109
|
-
for child_instance in instance.get_child_instances():
|
|
110
|
-
print(f"{child_instance}:{child_instance.get_model_name()}")
|
|
111
|
-
print_netlist(child_instance)
|
|
112
|
-
|
|
113
|
-
Similar to the previous example, but utilizing an instance visitor.
|
|
114
|
-
This approach allows you to perform operations on each instance while
|
|
115
|
-
also defining conditions for stopping or continuing exploration.
|
|
116
|
-
|
|
117
|
-
.. code-block:: python
|
|
118
|
-
|
|
119
|
-
def print_instance(instance):
|
|
120
|
-
print(f"{instance}:{instance.get_model_name()}")
|
|
121
|
-
visitor_config = instance_visitor.VisitorConfig(callback=print_instance)
|
|
122
|
-
instance_visitor.visit(top, visitor_config)
|
|
123
|
-
|
|
124
|
-
Counting the Number of Leaves in a Netlist
|
|
125
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
126
|
-
The instance visitor provides a tool for collecting various types of information
|
|
127
|
-
about a netlist.
|
|
128
|
-
|
|
129
|
-
The following example demonstrates how to use the visitor’s callback
|
|
130
|
-
function to transmit user-defined arguments, allowing for flexible data processing.
|
|
131
|
-
|
|
132
|
-
This specific use case shows how to count the number of leaf instances in a netlist.
|
|
133
|
-
|
|
134
|
-
.. code-block:: python
|
|
135
|
-
|
|
136
|
-
leaves = {"count": 0, "assigns": 0, "constants": 0}
|
|
137
|
-
def count_leaves(instance, leaves):
|
|
138
|
-
if instance.is_leaf():
|
|
139
|
-
if instance.is_assign():
|
|
140
|
-
leaves["assigns"] += 1
|
|
141
|
-
elif instance.is_const():
|
|
142
|
-
leaves["constants"] += 1
|
|
143
|
-
else:
|
|
144
|
-
leaves["count"] += 1
|
|
145
|
-
visitor_config = instance_visitor.VisitorConfig(callback=count_leaves, args=(leaves,))
|
|
146
|
-
instance_visitor.visit(top, visitor_config)
|
|
147
|
-
print(f"{top} leaves count")
|
|
148
|
-
print(f"nb_assigns={leaves['assigns']}")
|
|
149
|
-
print(f"nb constants={leaves['constants']}")
|
|
150
|
-
print(f"nb other leaves={leaves['count']}")
|
|
151
|
-
|
|
152
|
-
DLE (Dead Logic Elimination)
|
|
153
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
154
|
-
This example demonstrates how to perform Dead Logic Elimination (DLE) on a netlist.
|
|
155
|
-
|
|
156
|
-
.. code-block:: python
|
|
157
|
-
|
|
158
|
-
def apply_dle(top):
|
|
159
|
-
# Trace back from design outputs
|
|
160
|
-
visited = set()
|
|
161
|
-
traced_terms = top.get_flat_output_terms()
|
|
162
|
-
for leaf in top.get_leaf_children():
|
|
163
|
-
atrributes = list(leaf.get_attributes())
|
|
164
|
-
for attr in atrributes:
|
|
165
|
-
if attr.get_name() == 'DONT_TOUCH' or attr.get_name() == 'KEEP' or attr.get_name() == 'preserve' or attr.get_name() == 'noprune':
|
|
166
|
-
for term in leaf.get_flat_input_terms():
|
|
167
|
-
traced_terms.append(term)
|
|
168
|
-
for termToTrace in traced_terms:
|
|
169
|
-
queue = deque([termToTrace])
|
|
170
|
-
while queue:
|
|
171
|
-
term = queue.popleft()
|
|
172
|
-
if term in visited:
|
|
173
|
-
continue
|
|
174
|
-
visited.add(term)
|
|
175
|
-
equipotential = term.get_equipotential()
|
|
176
|
-
leaf_drivers = equipotential.get_leaf_drivers()
|
|
177
|
-
for driver in leaf_drivers:
|
|
178
|
-
instance = driver.get_instance()
|
|
179
|
-
instances.add(instance)
|
|
180
|
-
input_terms = instance.get_flat_input_terms()
|
|
181
|
-
queue.extend(input_terms)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
to_delete = [leaf for leaf in top.get_leaf_children() if leaf not in instances]
|
|
185
|
-
for leaf in to_delete:
|
|
186
|
-
leaf.delete()
|
|
187
|
-
return to_delete
|
|
188
|
-
|
|
189
|
-
Documentation
|
|
190
|
-
-------------
|
|
191
|
-
Naja EDA is a work in progress, and the documentation is still under development.
|
|
192
|
-
|
|
193
|
-
Naja documentation is available on the `Naja GitHub repository <https://github.com/najaeda/naja>`_.
|
|
194
|
-
|
|
195
|
-
Support
|
|
196
|
-
-------
|
|
197
|
-
If you encounter any issues or have questions, please report them on the
|
|
198
|
-
`Naja issue tracker <https://github.com/najaeda/naja/issues>`_.
|
|
199
|
-
|
|
200
|
-
License
|
|
201
|
-
-------
|
|
202
|
-
This project is licensed under the Apache License 2.0. \
|
|
203
|
-
See the `LICENSE <https://github.com/najaeda/naja/blob/main/LICENSE>`_ file for details.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|