najaeda 0.2.2__cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 0.2.3__cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.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 CHANGED
@@ -0,0 +1,8 @@
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 ._version import version, git_hash
7
+
8
+ __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()
@@ -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.so CHANGED
Binary file
najaeda/libnaja_nl.so CHANGED
Binary file
najaeda/libnaja_python.so 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 hasattr(self, "net"):
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
- return net_str
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.
@@ -577,6 +595,13 @@ class Term:
577
595
  """
578
596
  return get_snl_term_for_ids(self.pathIDs, self.termIDs).getName()
579
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
+
580
605
  def get_direction(self) -> Direction:
581
606
  """
582
607
  :return: the direction of the term.
@@ -753,6 +778,25 @@ class Term:
753
778
  iterm = inst.getInstTerm(bterm)
754
779
  iterm.setNet(bnet)
755
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
+
756
800
 
757
801
  def get_instance_by_path(names: list):
758
802
  assert len(names) > 0
@@ -813,8 +857,7 @@ class Attribute:
813
857
 
814
858
 
815
859
  class Instance:
816
- """Class that represents the instance and wraps some
817
- of the snl occurrence API.
860
+ """Class that represents an instance in the design hierarchy.
818
861
  """
819
862
 
820
863
  def __init__(self, path=naja.SNLPath()):
@@ -1288,12 +1331,28 @@ class Instance:
1288
1331
  :return: the name of the instance or name of the top is this is the top.
1289
1332
  :rtype: str
1290
1333
  """
1291
- path = get_snl_path_from_id_list(self.pathIDs)
1292
1334
  if self.is_top():
1293
1335
  return self.get_model_name()
1294
1336
  else:
1337
+ path = get_snl_path_from_id_list(self.pathIDs)
1295
1338
  return path.getTailInstance().getName()
1296
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
+
1297
1356
  def get_model_name(self) -> str:
1298
1357
  """
1299
1358
  :return: the name of the model of the instance
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: najaeda
3
- Version: 0.2.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
@@ -1,19 +1,15 @@
1
- najaeda-0.2.2.dist-info/WHEEL,sha256=A3mvWTV2IcEc7qLoVrqpNTZ0QD1zGDiFoYw9zZpB5kA,158
2
- najaeda-0.2.2.dist-info/METADATA,sha256=sDeDlCC-dBef_IHUdq2tfSqbCwhYqwdLu97HLgozptY,3435
3
- najaeda-0.2.2.dist-info/RECORD,,
4
- najaeda-0.2.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
- najaeda-0.2.2.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
6
- najaeda/libnaja_python.so,sha256=6fZQ57bagrHJYuKQp-sMfjDsS0D4rMR9v0ZqUEUWLLc,1886217
7
- najaeda/libnaja_nl.so,sha256=DSyBNyIPDt8oz9kRO0EqiPYTNvNSiVe8AaZd3LoCUqs,1646864
8
- najaeda/naja.so,sha256=7-hTBy--fQaDhgPwOWId81GBT7Tj2yXJcFQf96f9rRI,206521
1
+ najaeda/libnaja_python.so,sha256=odk8f7en90Hi1Rkt7UMMxhyNrmDMS6scRKOyfaSCJY0,1953737
2
+ najaeda/_version.py,sha256=c-4hT20dyE-3BcdzOqR0vd92E7ydR5u2c-VmCc6oU8A,332
3
+ najaeda/libnaja_nl.so,sha256=2N9413-s5cYoPR3W_AgBIbavOb9ES7dFQcDJYCYoc1s,1646872
4
+ najaeda/naja.so,sha256=P7KKwXQthrjqbNmrV217w1lZDqGqe8s8qiP2Ru06fKc,206521
9
5
  najaeda/pandas_stats.py,sha256=yOb4ka965U7rN4D6AwvSGmRyeT_O7Ed-5cmT8BFbfeo,1070
10
6
  najaeda/stats.py,sha256=SJ9rca0Z6ldNAFOjU7DPO2hfx1zq-9Bec0Rx_oLasJo,16217
11
7
  najaeda/libnaja_bne.so,sha256=ejZf2Zl2AXQagN41HIj8x-3oeoyEffcPTPR0YeY40ng,272577
12
- najaeda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ najaeda/__init__.py,sha256=6QrOzlqTfd558FH9Zm6ve54IzkHaDJ8ZO8hTCaEwsL8,218
13
9
  najaeda/libnaja_opt.so,sha256=t71JSk0NSGXY48FRSOL-j_O98iwLF1s-ppe8z8h2lZg,348713
14
- najaeda/netlist.py,sha256=hU9g4tO40GGhS5b9uEfAqn7m6dXgcl9-yEBIKT1dmuU,56385
10
+ najaeda/netlist.py,sha256=B2NwDDriuqf3Jy-J0w4bDJ4dwXIovSzwrWOEHLXjw6s,58509
15
11
  najaeda/net_visitor.py,sha256=P_esjibYb-wBDuF-AyF7es9sJYw1Ha8RhTPu-qKe7G4,1940
16
- najaeda/libnaja_dnl.so,sha256=mltTODKF01Hmf9aG5SdJCjkNggNuwNZuuMvcz3BVars,276041
12
+ najaeda/libnaja_dnl.so,sha256=QxHFSN33IIipFUl-Nx0qyG1XPynYOq4GbF7YbwGkbBM,276545
17
13
  najaeda/instance_visitor.py,sha256=JMsPSQaWNiDjxS05rxg83a0PIsrOIuTi9G35hkwdibs,1530
18
14
  najaeda/native/stats.py,sha256=t50hhE9pEFNtlssjES0A-K9TsO_2ZSUAb-e9L3Rt6yc,13063
19
15
  najaeda/native/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -33,8 +29,13 @@ najaeda/docs/source/index.rst,sha256=80VMfeEGHObnOUXRBxIzISQsG_HNkgT-pUpsDZsCfOY
33
29
  najaeda/docs/source/visitors.rst,sha256=KScCr7BytrhFxWfZPyYWIrr3CEJuk5Tx-LjEuDnnBaA,227
34
30
  najaeda/docs/source/api.rst,sha256=47VCPyF4Py_1cklZ3q9fmOMhqqI17rxwU_VUJETfCwY,151
35
31
  najaeda/docs/source/term.rst,sha256=QKWT6u1xjEjusvcZYknKQ-M83ibohO5y1EYTQnnXqak,690
36
- najaeda/docs/source/instance.rst,sha256=7B2IBB0p32Tb4qvOCE77OlrQaYpFADvmTlq1q8eyVqw,458
32
+ najaeda/docs/source/instance.rst,sha256=4JDl4_YaTbYxJrgSCe-3vV-EkKGGKOIejXMLfbJR1jk,957
37
33
  najaeda/docs/source/conf.py,sha256=XqCFo29gZCbaoPe1xEan9ZonYyQW5NZnWHGEWrB7p8Q,2021
34
+ najaeda-0.2.3.dist-info/WHEEL,sha256=A3mvWTV2IcEc7qLoVrqpNTZ0QD1zGDiFoYw9zZpB5kA,158
35
+ najaeda-0.2.3.dist-info/METADATA,sha256=Jx4ae_OoGfbOlrSqer4UwGLTOz5-CYwWQMeeKz3_mhM,3435
36
+ najaeda-0.2.3.dist-info/RECORD,,
37
+ najaeda-0.2.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
38
+ najaeda-0.2.3.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
38
39
  najaeda.libs/libtbbmalloc-8bd2c113.so.2.15,sha256=t7EmHeYI7vtRrpUMImjQuzDv3a1gs8-lcUxotcVs3mA,198281
39
40
  najaeda.libs/libcapnp-1-d562dcbf.1.0.so,sha256=oATbFuRyIBdV6dWAaarYlY3DDt3Wvyp1nC5FvgRIyzw,1152985
40
41
  najaeda.libs/libtbb-58378cc2.so.12.15,sha256=yxzhDOGKoZHEHYUULdSu-uH9-Hr1Wh8JygBizKBxc_U,404105