najaeda 0.2.1__cp310-cp310-macosx_11_0_arm64.whl → 0.2.3__cp310-cp310-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/__init__.py +8 -0
- najaeda/_version.py +16 -0
- najaeda/docs/source/instance.rst +15 -0
- najaeda/libnaja_dnl.dylib +0 -0
- najaeda/libnaja_nl.dylib +0 -0
- najaeda/libnaja_python.dylib +0 -0
- najaeda/naja.so +0 -0
- najaeda/netlist.py +86 -9
- {najaeda-0.2.1.dist-info → najaeda-0.2.3.dist-info}/METADATA +2 -2
- {najaeda-0.2.1.dist-info → najaeda-0.2.3.dist-info}/RECORD +13 -12
- {najaeda-0.2.1.dist-info → najaeda-0.2.3.dist-info}/WHEEL +0 -0
- {najaeda-0.2.1.dist-info → najaeda-0.2.3.dist-info}/licenses/AUTHORS +0 -0
- {najaeda-0.2.1.dist-info → najaeda-0.2.3.dist-info}/licenses/LICENSE +0 -0
najaeda/__init__.py
CHANGED
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()
|
najaeda/docs/source/instance.rst
CHANGED
|
@@ -10,6 +10,21 @@ of an instance in its hierarchical context.
|
|
|
10
10
|
When an **Instance** is modified through editing methods,
|
|
11
11
|
**najaeda** will automatically manage the necessary uniquification.
|
|
12
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**,
|
|
27
|
+
|
|
13
28
|
Instance Attributes
|
|
14
29
|
-------------------
|
|
15
30
|
|
najaeda/libnaja_dnl.dylib
CHANGED
|
Binary file
|
najaeda/libnaja_nl.dylib
CHANGED
|
Binary file
|
najaeda/libnaja_python.dylib
CHANGED
|
Binary file
|
najaeda/naja.so
CHANGED
|
Binary file
|
najaeda/netlist.py
CHANGED
|
@@ -207,14 +207,15 @@ class Net:
|
|
|
207
207
|
return not eq_result
|
|
208
208
|
|
|
209
209
|
def __str__(self):
|
|
210
|
-
if
|
|
211
|
-
net_str = str(self.net)
|
|
212
|
-
elif hasattr(self, "net_concat"):
|
|
210
|
+
if self.is_concat():
|
|
213
211
|
net_str = "{" + ",".join(map(str, self.net_concat)) + "}"
|
|
212
|
+
return net_str
|
|
213
|
+
net_str = str(self.net)
|
|
214
214
|
path = get_snl_path_from_id_list(self.pathIDs)
|
|
215
215
|
if path.size() > 0:
|
|
216
216
|
return f"{path}/{net_str}"
|
|
217
|
-
|
|
217
|
+
else:
|
|
218
|
+
return net_str
|
|
218
219
|
|
|
219
220
|
def get_name(self) -> str:
|
|
220
221
|
"""
|
|
@@ -225,6 +226,23 @@ class Net:
|
|
|
225
226
|
return self.net.getName()
|
|
226
227
|
return "{" + ",".join(map(str, self.net_concat)) + "}"
|
|
227
228
|
|
|
229
|
+
def set_name(self, name: str):
|
|
230
|
+
"""
|
|
231
|
+
:param str name: the name to set for this Net.
|
|
232
|
+
"""
|
|
233
|
+
if self.is_concat():
|
|
234
|
+
raise ValueError(
|
|
235
|
+
f"set_name of {self}: cannot set name for a concatenated net. "
|
|
236
|
+
"Use the individual nets instead."
|
|
237
|
+
)
|
|
238
|
+
elif self.is_bus_bit():
|
|
239
|
+
raise ValueError(
|
|
240
|
+
f"set_name of {self}: cannot set name for a bus bit. "
|
|
241
|
+
"Use the bus net instead."
|
|
242
|
+
)
|
|
243
|
+
else:
|
|
244
|
+
self.net.setName(name)
|
|
245
|
+
|
|
228
246
|
def get_msb(self) -> int:
|
|
229
247
|
"""
|
|
230
248
|
:return: the most significant bit of the net if it is a bus.
|
|
@@ -485,8 +503,9 @@ class Term:
|
|
|
485
503
|
term_str = f"{path}/{snl_term_str}"
|
|
486
504
|
if self.is_bus():
|
|
487
505
|
term_str += f"[{self.get_msb()}:{self.get_lsb()}]"
|
|
488
|
-
|
|
489
|
-
|
|
506
|
+
bit = self.get_bit_number()
|
|
507
|
+
if bit is not None:
|
|
508
|
+
term_str += f"[{bit}]"
|
|
490
509
|
return term_str
|
|
491
510
|
|
|
492
511
|
def __repr__(self) -> str:
|
|
@@ -576,6 +595,13 @@ class Term:
|
|
|
576
595
|
"""
|
|
577
596
|
return get_snl_term_for_ids(self.pathIDs, self.termIDs).getName()
|
|
578
597
|
|
|
598
|
+
def is_unnamed(self) -> bool:
|
|
599
|
+
"""
|
|
600
|
+
:return: True if the term is unnamed.
|
|
601
|
+
:rtype: bool
|
|
602
|
+
"""
|
|
603
|
+
return get_snl_term_for_ids(self.pathIDs, self.termIDs).isUnnamed()
|
|
604
|
+
|
|
579
605
|
def get_direction(self) -> Direction:
|
|
580
606
|
"""
|
|
581
607
|
:return: the direction of the term.
|
|
@@ -671,6 +697,10 @@ class Term:
|
|
|
671
697
|
return self.get_equipotential().get_leaf_readers()
|
|
672
698
|
|
|
673
699
|
def get_equipotential(self) -> Equipotential:
|
|
700
|
+
"""
|
|
701
|
+
:return: the Equipotential of this Term.
|
|
702
|
+
:rtype: Equipotential
|
|
703
|
+
"""
|
|
674
704
|
return Equipotential(self)
|
|
675
705
|
|
|
676
706
|
def is_input(self) -> bool:
|
|
@@ -748,6 +778,25 @@ class Term:
|
|
|
748
778
|
iterm = inst.getInstTerm(bterm)
|
|
749
779
|
iterm.setNet(bnet)
|
|
750
780
|
|
|
781
|
+
def get_truth_table(self):
|
|
782
|
+
# check the index of the output
|
|
783
|
+
if not self.is_output():
|
|
784
|
+
raise ValueError("Truth table can only be computed for output terms")
|
|
785
|
+
# get the instance
|
|
786
|
+
if self.is_bus():
|
|
787
|
+
raise ValueError("Truth table cannot be computed for bus terms")
|
|
788
|
+
inst = self.get_instance()
|
|
789
|
+
# get the model
|
|
790
|
+
model = inst._Instance__get_snl_model()
|
|
791
|
+
for term in model.getTerms():
|
|
792
|
+
if term.getDirection() == naja.SNLTerm.Direction.Output:
|
|
793
|
+
if term.getName() == self.get_name():
|
|
794
|
+
# get the truth table
|
|
795
|
+
tt = model.getTruthTableByOutputID(term.getID())
|
|
796
|
+
if tt is not None:
|
|
797
|
+
return model.getTruthTableByOutputID(term.getID())
|
|
798
|
+
return None
|
|
799
|
+
|
|
751
800
|
|
|
752
801
|
def get_instance_by_path(names: list):
|
|
753
802
|
assert len(names) > 0
|
|
@@ -808,8 +857,7 @@ class Attribute:
|
|
|
808
857
|
|
|
809
858
|
|
|
810
859
|
class Instance:
|
|
811
|
-
"""Class that represents
|
|
812
|
-
of the snl occurrence API.
|
|
860
|
+
"""Class that represents an instance in the design hierarchy.
|
|
813
861
|
"""
|
|
814
862
|
|
|
815
863
|
def __init__(self, path=naja.SNLPath()):
|
|
@@ -1283,12 +1331,28 @@ class Instance:
|
|
|
1283
1331
|
:return: the name of the instance or name of the top is this is the top.
|
|
1284
1332
|
:rtype: str
|
|
1285
1333
|
"""
|
|
1286
|
-
path = get_snl_path_from_id_list(self.pathIDs)
|
|
1287
1334
|
if self.is_top():
|
|
1288
1335
|
return self.get_model_name()
|
|
1289
1336
|
else:
|
|
1337
|
+
path = get_snl_path_from_id_list(self.pathIDs)
|
|
1290
1338
|
return path.getTailInstance().getName()
|
|
1291
1339
|
|
|
1340
|
+
def set_name(self, name: str):
|
|
1341
|
+
"""Set the name of this instance.
|
|
1342
|
+
|
|
1343
|
+
:param str name: the new name of the instance.
|
|
1344
|
+
"""
|
|
1345
|
+
if self.is_top():
|
|
1346
|
+
topSNLDesign = naja.NLUniverse.get().getTopDesign()
|
|
1347
|
+
topSNLDesign.setName(name)
|
|
1348
|
+
else:
|
|
1349
|
+
path = get_snl_path_from_id_list(self.pathIDs)
|
|
1350
|
+
if path.size() > 0:
|
|
1351
|
+
naja.SNLUniquifier(path)
|
|
1352
|
+
path = get_snl_path_from_id_list(self.pathIDs)
|
|
1353
|
+
inst = path.getTailInstance()
|
|
1354
|
+
inst.setName(name)
|
|
1355
|
+
|
|
1292
1356
|
def get_model_name(self) -> str:
|
|
1293
1357
|
"""
|
|
1294
1358
|
:return: the name of the model of the instance
|
|
@@ -1607,6 +1671,19 @@ def load_primitives_from_file(file: str):
|
|
|
1607
1671
|
module.load(db)
|
|
1608
1672
|
|
|
1609
1673
|
|
|
1674
|
+
def load_naja_if(path: str):
|
|
1675
|
+
"""Load the Naja IF from the given path."""
|
|
1676
|
+
if not os.path.isdir(path):
|
|
1677
|
+
raise FileNotFoundError(f"Cannot load Naja IF from non existing directory: {path}")
|
|
1678
|
+
logging.info(f"Loading Naja IF from {path}")
|
|
1679
|
+
naja.NLDB.loadNajaIF(path)
|
|
1680
|
+
|
|
1681
|
+
|
|
1682
|
+
def dump_naja_if(path: str):
|
|
1683
|
+
"""Dump the Naja IF to the given path."""
|
|
1684
|
+
__get_top_db().dumpNajaIF(path)
|
|
1685
|
+
|
|
1686
|
+
|
|
1610
1687
|
def get_primitives_library() -> naja.NLLibrary:
|
|
1611
1688
|
lib = __get_top_db().getLibrary("PRIMS")
|
|
1612
1689
|
if lib is None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: najaeda
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Naja EDA Python package
|
|
5
5
|
Author-Email: Naja Authors <contact@keplertech.io>
|
|
6
6
|
License: Apache License 2.0
|
|
@@ -56,7 +56,7 @@ processes with minimal overhead.
|
|
|
56
56
|
|
|
57
57
|
najaeda is the Python counterpart of the `Naja C++ project <https://github.com/najaeda/naja>`_.
|
|
58
58
|
|
|
59
|
-
If you find this project useful, please consider
|
|
59
|
+
If you find this project useful, please consider `starring it on GitHub <https://github.com/najaeda/naja>`_ to show your support.
|
|
60
60
|
|
|
61
61
|
Feel free to reach out to us anytime at `contact@keplertech.io <mailto:contact@keplertech.io>`_.
|
|
62
62
|
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
najaeda
|
|
2
|
-
najaeda/
|
|
1
|
+
najaeda-0.2.3.dist-info/RECORD,,
|
|
2
|
+
najaeda-0.2.3.dist-info/WHEEL,sha256=nFSIsNnUJn_8RF-FUhBaXtCep1yHZRCxSkBom4ebATM,114
|
|
3
|
+
najaeda-0.2.3.dist-info/METADATA,sha256=Jx4ae_OoGfbOlrSqer4UwGLTOz5-CYwWQMeeKz3_mhM,3435
|
|
4
|
+
najaeda-0.2.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
+
najaeda-0.2.3.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
|
|
6
|
+
najaeda/netlist.py,sha256=B2NwDDriuqf3Jy-J0w4bDJ4dwXIovSzwrWOEHLXjw6s,58509
|
|
7
|
+
najaeda/libnaja_nl.dylib,sha256=X7Dfc_l443uGo5-5Rje2XV_axrx_kxuiHWdAr0Hlx4s,757376
|
|
3
8
|
najaeda/pandas_stats.py,sha256=yOb4ka965U7rN4D6AwvSGmRyeT_O7Ed-5cmT8BFbfeo,1070
|
|
4
|
-
najaeda/
|
|
5
|
-
najaeda/
|
|
9
|
+
najaeda/_version.py,sha256=c-4hT20dyE-3BcdzOqR0vd92E7ydR5u2c-VmCc6oU8A,332
|
|
10
|
+
najaeda/__init__.py,sha256=6QrOzlqTfd558FH9Zm6ve54IzkHaDJ8ZO8hTCaEwsL8,218
|
|
11
|
+
najaeda/naja.so,sha256=E_DYv2PlULYrlFIC5Q_glJgMTmjdC6l5Vn--AAYFbnM,99440
|
|
6
12
|
najaeda/net_visitor.py,sha256=P_esjibYb-wBDuF-AyF7es9sJYw1Ha8RhTPu-qKe7G4,1940
|
|
7
13
|
najaeda/libnaja_opt.dylib,sha256=wIG2H5rnxbqGrwLSgklJjZ5wjOkx2Shhu2RsnYQwmuE,212720
|
|
8
|
-
najaeda/libnaja_python.dylib,sha256=
|
|
14
|
+
najaeda/libnaja_python.dylib,sha256=U5IOxjcxZ0jrZQopUE4ArtnnTaN3TaZkd-VdWrrd80I,944720
|
|
9
15
|
najaeda/stats.py,sha256=SJ9rca0Z6ldNAFOjU7DPO2hfx1zq-9Bec0Rx_oLasJo,16217
|
|
10
16
|
najaeda/instance_visitor.py,sha256=JMsPSQaWNiDjxS05rxg83a0PIsrOIuTi9G35hkwdibs,1530
|
|
11
17
|
najaeda/libnaja_bne.dylib,sha256=pLbGUnDr5PSGXbA8wKD-pqEyQIWHbiCb1icPpxRYrWE,136416
|
|
12
|
-
najaeda/libnaja_dnl.dylib,sha256=
|
|
18
|
+
najaeda/libnaja_dnl.dylib,sha256=qroDUAnl-eBJcdz-1YGC08Ngz4NEUctMiZ4W-gpT5mU,147088
|
|
13
19
|
najaeda/native/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
20
|
najaeda/native/stats.py,sha256=t50hhE9pEFNtlssjES0A-K9TsO_2ZSUAb-e9L3Rt6yc,13063
|
|
15
21
|
najaeda/docs/requirements.txt,sha256=1XIBGTIplm2arC9HhDCfLuAjozGdVSXkqmOj8ybuT6U,121
|
|
16
22
|
najaeda/docs/.readthedocs.yaml,sha256=nN_Psro-YdfPcIiueZkJcZepts68g23rqVThhKnmVRw,790
|
|
17
23
|
najaeda/docs/source/index.rst,sha256=80VMfeEGHObnOUXRBxIzISQsG_HNkgT-pUpsDZsCfOY,387
|
|
18
|
-
najaeda/docs/source/instance.rst,sha256=
|
|
24
|
+
najaeda/docs/source/instance.rst,sha256=4JDl4_YaTbYxJrgSCe-3vV-EkKGGKOIejXMLfbJR1jk,957
|
|
19
25
|
najaeda/docs/source/conf.py,sha256=XqCFo29gZCbaoPe1xEan9ZonYyQW5NZnWHGEWrB7p8Q,2021
|
|
20
26
|
najaeda/docs/source/preprocessor.py,sha256=TK4LsTdNbv2dxkKQaJ7cEyo9PU5v_56vlrFCJYIPKf8,2625
|
|
21
27
|
najaeda/docs/source/term.rst,sha256=QKWT6u1xjEjusvcZYknKQ-M83ibohO5y1EYTQnnXqak,690
|
|
@@ -34,8 +40,3 @@ najaeda/.dylibs/libkj-1.1.0.dylib,sha256=pB7dMks8b8ybJ6xKWqFR_hHjKsmpf7wzbcunZaS
|
|
|
34
40
|
najaeda/primitives/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
41
|
najaeda/primitives/yosys.py,sha256=g1L70AUJoPCkd9B-b9aW4Pzc1AeR9KyIHoXvneW_UEU,8584
|
|
36
42
|
najaeda/primitives/xilinx.py,sha256=Ka-jlu-OxixEZ_yR_niXLHtaUL8HxT1Bg9H9Kpnr4ns,26551
|
|
37
|
-
najaeda-0.2.1.dist-info/RECORD,,
|
|
38
|
-
najaeda-0.2.1.dist-info/WHEEL,sha256=nFSIsNnUJn_8RF-FUhBaXtCep1yHZRCxSkBom4ebATM,114
|
|
39
|
-
najaeda-0.2.1.dist-info/METADATA,sha256=-B4Xx2ur4gYMP8u14YKgiloVBdLr-9362F6wiYNFW0g,3433
|
|
40
|
-
najaeda-0.2.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
41
|
-
najaeda-0.2.1.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
|
|
File without changes
|
|
File without changes
|
|
File without changes
|