najaeda 0.1.22__cp310-cp310-macosx_11_0_arm64.whl → 0.1.24__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/libnaja_bne.dylib CHANGED
Binary file
najaeda/libnaja_nl.dylib CHANGED
Binary file
najaeda/libnaja_opt.dylib CHANGED
Binary file
Binary file
najaeda/naja.so CHANGED
Binary file
najaeda/netlist.py CHANGED
@@ -353,8 +353,20 @@ class Net:
353
353
  yield Term(path, term.getBitTerm())
354
354
  path.pop()
355
355
 
356
- def get_design_terms(self):
356
+ def count_inst_terms(self) -> int:
357
+ """
358
+ Count the instance terminals of this net.
359
+
360
+ :return: the number of instance terminals of this net.
361
+ :rtype: int
357
362
  """
363
+ return sum(1 for _ in self.get_inst_terms())
364
+
365
+ def get_design_terms(self):
366
+ """Return an iterator over the design terminals of the net.
367
+ This includes only the terminals that are part of the current design.
368
+ The iterator will yield Term objects bit per bit.
369
+
358
370
  :return: an iterator over the design terminals of the net.
359
371
  :rtype: Iterator[Term]
360
372
  """
@@ -363,8 +375,18 @@ class Net:
363
375
  for term in self.net.getBitTerms():
364
376
  yield Term(self.pathIDs, term)
365
377
 
366
- def get_terms(self):
378
+ def count_design_terms(self) -> int:
379
+ """Count the design terminals of this net.
380
+
381
+ :return: the number of design terminals of this net.
382
+ :rtype: int
367
383
  """
384
+ return sum(1 for _ in self.get_design_terms())
385
+
386
+ def get_terms(self):
387
+ """Return an iterator over the terminals of the net.
388
+ This includes both design and instance terminals.
389
+
368
390
  :return: an iterator over the terminals of the net.
369
391
  :rtype: Iterator[Term]
370
392
  """
@@ -1470,6 +1492,7 @@ class VerilogConfig:
1470
1492
 
1471
1493
  def load_verilog(files: Union[str, List[str]], config: VerilogConfig = None) -> Instance:
1472
1494
  """Load verilog files into the top design.
1495
+
1473
1496
  :param files: a list of verilog files to load or a single file.
1474
1497
  :param config: the configuration to use when loading the files.
1475
1498
  :return: the top Instance.
@@ -1490,6 +1513,7 @@ def load_verilog(files: Union[str, List[str]], config: VerilogConfig = None) ->
1490
1513
 
1491
1514
  def load_liberty(files: Union[str, List[str]]):
1492
1515
  """Load liberty files.
1516
+
1493
1517
  :param files: a list of liberty files to load or a single file.
1494
1518
  """
1495
1519
  if isinstance(files, str):
@@ -1506,11 +1530,14 @@ def load_primitives(name: str):
1506
1530
  Currently supported libraries are:
1507
1531
 
1508
1532
  - xilinx
1533
+ - yosys
1509
1534
  """
1510
1535
  if name == "xilinx":
1511
1536
  from najaeda.primitives import xilinx
1512
-
1513
1537
  xilinx.load(__get_top_db())
1538
+ elif name == "yosys":
1539
+ from najaeda.primitives import yosys
1540
+ yosys.load(__get_top_db())
1514
1541
  else:
1515
1542
  raise ValueError(f"Unknown primitives library: {name}")
1516
1543
 
@@ -0,0 +1,189 @@
1
+ # SPDX-FileCopyrightText: 2024 The Naja authors <https://github.com/najaeda/naja/blob/main/AUTHORS>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ import logging
6
+ from najaeda import naja
7
+
8
+
9
+ def constructAND(lib):
10
+ and2 = naja.SNLDesign.createPrimitive(lib, "$_AND_")
11
+ naja.SNLScalarTerm.create(and2, naja.SNLTerm.Direction.Input, "A")
12
+ naja.SNLScalarTerm.create(and2, naja.SNLTerm.Direction.Input, "B")
13
+ naja.SNLScalarTerm.create(and2, naja.SNLTerm.Direction.Output, "Y")
14
+ and2.setTruthTable(0x8)
15
+
16
+
17
+ def constructOR(lib):
18
+ or2 = naja.SNLDesign.createPrimitive(lib, "$_OR_")
19
+ naja.SNLScalarTerm.create(or2, naja.SNLTerm.Direction.Input, "A")
20
+ naja.SNLScalarTerm.create(or2, naja.SNLTerm.Direction.Input, "B")
21
+ naja.SNLScalarTerm.create(or2, naja.SNLTerm.Direction.Output, "Y")
22
+ or2.setTruthTable(0xE)
23
+
24
+
25
+ def constructXOR(lib):
26
+ xor2 = naja.SNLDesign.createPrimitive(lib, "$_XOR_")
27
+ naja.SNLScalarTerm.create(xor2, naja.SNLTerm.Direction.Input, "A")
28
+ naja.SNLScalarTerm.create(xor2, naja.SNLTerm.Direction.Input, "B")
29
+ naja.SNLScalarTerm.create(xor2, naja.SNLTerm.Direction.Output, "Y")
30
+ xor2.setTruthTable(0x6)
31
+
32
+
33
+ def constructMUX(lib):
34
+ mux2 = naja.SNLDesign.createPrimitive(lib, "$_MUX_")
35
+ naja.SNLScalarTerm.create(mux2, naja.SNLTerm.Direction.Input, "A")
36
+ naja.SNLScalarTerm.create(mux2, naja.SNLTerm.Direction.Input, "B")
37
+ naja.SNLScalarTerm.create(mux2, naja.SNLTerm.Direction.Input, "S")
38
+ naja.SNLScalarTerm.create(mux2, naja.SNLTerm.Direction.Output, "Y")
39
+ mux2.setTruthTable(0xCA)
40
+
41
+
42
+ def constructNOT(lib):
43
+ not_gate = naja.SNLDesign.createPrimitive(lib, "$_NOT_")
44
+ naja.SNLScalarTerm.create(not_gate, naja.SNLTerm.Direction.Input, "A")
45
+ naja.SNLScalarTerm.create(not_gate, naja.SNLTerm.Direction.Output, "Y")
46
+ not_gate.setTruthTable(0b01)
47
+
48
+
49
+ def constructDFFP(lib):
50
+ dffp = naja.SNLDesign.createPrimitive(lib, "$_DFF_P_")
51
+ naja.SNLScalarTerm.create(dffp, naja.SNLTerm.Direction.Input, "C")
52
+ naja.SNLScalarTerm.create(dffp, naja.SNLTerm.Direction.Input, "D")
53
+ naja.SNLScalarTerm.create(dffp, naja.SNLTerm.Direction.Output, "Q")
54
+
55
+
56
+ def constructDFFE_PP(lib):
57
+ dffe_pp = naja.SNLDesign.createPrimitive(lib, "$_DFFE_PP_")
58
+ naja.SNLScalarTerm.create(dffe_pp, naja.SNLTerm.Direction.Input, "C")
59
+ naja.SNLScalarTerm.create(dffe_pp, naja.SNLTerm.Direction.Input, "D")
60
+ naja.SNLScalarTerm.create(dffe_pp, naja.SNLTerm.Direction.Input, "E")
61
+ naja.SNLScalarTerm.create(dffe_pp, naja.SNLTerm.Direction.Output, "Q")
62
+
63
+
64
+ def constructDFFE_PN(lib):
65
+ dffe_pn = naja.SNLDesign.createPrimitive(lib, "$_DFFE_PN_")
66
+ naja.SNLScalarTerm.create(dffe_pn, naja.SNLTerm.Direction.Input, "C")
67
+ naja.SNLScalarTerm.create(dffe_pn, naja.SNLTerm.Direction.Input, "D")
68
+ naja.SNLScalarTerm.create(dffe_pn, naja.SNLTerm.Direction.Input, "E")
69
+ naja.SNLScalarTerm.create(dffe_pn, naja.SNLTerm.Direction.Output, "Q")
70
+
71
+
72
+ def constructDFF_PP0(lib):
73
+ dffe_pp0 = naja.SNLDesign.createPrimitive(lib, "$_DFF_PP0_")
74
+ naja.SNLScalarTerm.create(dffe_pp0, naja.SNLTerm.Direction.Input, "C")
75
+ naja.SNLScalarTerm.create(dffe_pp0, naja.SNLTerm.Direction.Input, "D")
76
+ naja.SNLScalarTerm.create(dffe_pp0, naja.SNLTerm.Direction.Output, "Q")
77
+ naja.SNLScalarTerm.create(dffe_pp0, naja.SNLTerm.Direction.Input, "R")
78
+
79
+
80
+ def constructDFF_PP1(lib):
81
+ dffe_pp1 = naja.SNLDesign.createPrimitive(lib, "$_DFF_PP1_")
82
+ naja.SNLScalarTerm.create(dffe_pp1, naja.SNLTerm.Direction.Input, "C")
83
+ naja.SNLScalarTerm.create(dffe_pp1, naja.SNLTerm.Direction.Input, "D")
84
+ naja.SNLScalarTerm.create(dffe_pp1, naja.SNLTerm.Direction.Output, "Q")
85
+ naja.SNLScalarTerm.create(dffe_pp1, naja.SNLTerm.Direction.Input, "R")
86
+
87
+
88
+ def constructDFFE_PP0P(lib):
89
+ dffe_pp0p = naja.SNLDesign.createPrimitive(lib, "$_DFFE_PP0P_")
90
+ naja.SNLScalarTerm.create(dffe_pp0p, naja.SNLTerm.Direction.Input, "C")
91
+ naja.SNLScalarTerm.create(dffe_pp0p, naja.SNLTerm.Direction.Input, "D")
92
+ naja.SNLScalarTerm.create(dffe_pp0p, naja.SNLTerm.Direction.Input, "E")
93
+ naja.SNLScalarTerm.create(dffe_pp0p, naja.SNLTerm.Direction.Output, "Q")
94
+ naja.SNLScalarTerm.create(dffe_pp0p, naja.SNLTerm.Direction.Input, "R")
95
+
96
+
97
+ def constructDFFE_PP1P(lib):
98
+ dffe_pp1p = naja.SNLDesign.createPrimitive(lib, "$_DFFE_PP1P_")
99
+ naja.SNLScalarTerm.create(dffe_pp1p, naja.SNLTerm.Direction.Input, "C")
100
+ naja.SNLScalarTerm.create(dffe_pp1p, naja.SNLTerm.Direction.Input, "D")
101
+ naja.SNLScalarTerm.create(dffe_pp1p, naja.SNLTerm.Direction.Input, "E")
102
+ naja.SNLScalarTerm.create(dffe_pp1p, naja.SNLTerm.Direction.Output, "Q")
103
+ naja.SNLScalarTerm.create(dffe_pp1p, naja.SNLTerm.Direction.Input, "R")
104
+
105
+
106
+ def constructDFFE_PP0N(lib):
107
+ dffe_pp0n = naja.SNLDesign.createPrimitive(lib, "$_DFFE_PP0N_")
108
+ naja.SNLScalarTerm.create(dffe_pp0n, naja.SNLTerm.Direction.Input, "C")
109
+ naja.SNLScalarTerm.create(dffe_pp0n, naja.SNLTerm.Direction.Input, "D")
110
+ naja.SNLScalarTerm.create(dffe_pp0n, naja.SNLTerm.Direction.Input, "E")
111
+ naja.SNLScalarTerm.create(dffe_pp0n, naja.SNLTerm.Direction.Output, "Q")
112
+ naja.SNLScalarTerm.create(dffe_pp0n, naja.SNLTerm.Direction.Input, "R")
113
+
114
+
115
+ def constructSDFF_PP0(lib):
116
+ sdff_pp0 = naja.SNLDesign.createPrimitive(lib, "$_SDFF_PP0_")
117
+ naja.SNLScalarTerm.create(sdff_pp0, naja.SNLTerm.Direction.Input, "C")
118
+ naja.SNLScalarTerm.create(sdff_pp0, naja.SNLTerm.Direction.Input, "D")
119
+ naja.SNLScalarTerm.create(sdff_pp0, naja.SNLTerm.Direction.Output, "Q")
120
+ naja.SNLScalarTerm.create(sdff_pp0, naja.SNLTerm.Direction.Input, "R")
121
+
122
+
123
+ def constructSDFFE_PP0N(lib):
124
+ sdffe_pp0n = naja.SNLDesign.createPrimitive(lib, "$_SDFFE_PP0N_")
125
+ naja.SNLScalarTerm.create(sdffe_pp0n, naja.SNLTerm.Direction.Input, "C")
126
+ naja.SNLScalarTerm.create(sdffe_pp0n, naja.SNLTerm.Direction.Input, "D")
127
+ naja.SNLScalarTerm.create(sdffe_pp0n, naja.SNLTerm.Direction.Input, "E")
128
+ naja.SNLScalarTerm.create(sdffe_pp0n, naja.SNLTerm.Direction.Output, "Q")
129
+ naja.SNLScalarTerm.create(sdffe_pp0n, naja.SNLTerm.Direction.Input, "R")
130
+
131
+
132
+ def constructSDFFE_PN0P(lib):
133
+ sdffe_pn0p = naja.SNLDesign.createPrimitive(lib, "$_SDFFE_PN0P_")
134
+ naja.SNLScalarTerm.create(sdffe_pn0p, naja.SNLTerm.Direction.Input, "C")
135
+ naja.SNLScalarTerm.create(sdffe_pn0p, naja.SNLTerm.Direction.Input, "D")
136
+ naja.SNLScalarTerm.create(sdffe_pn0p, naja.SNLTerm.Direction.Input, "E")
137
+ naja.SNLScalarTerm.create(sdffe_pn0p, naja.SNLTerm.Direction.Output, "Q")
138
+ naja.SNLScalarTerm.create(sdffe_pn0p, naja.SNLTerm.Direction.Input, "R")
139
+
140
+
141
+ def constructSDFFE_PN0N(lib):
142
+ sdffe_pn0n = naja.SNLDesign.createPrimitive(lib, "$_SDFFE_PN0N_")
143
+ naja.SNLScalarTerm.create(sdffe_pn0n, naja.SNLTerm.Direction.Input, "C")
144
+ naja.SNLScalarTerm.create(sdffe_pn0n, naja.SNLTerm.Direction.Input, "D")
145
+ naja.SNLScalarTerm.create(sdffe_pn0n, naja.SNLTerm.Direction.Input, "E")
146
+ naja.SNLScalarTerm.create(sdffe_pn0n, naja.SNLTerm.Direction.Output, "Q")
147
+ naja.SNLScalarTerm.create(sdffe_pn0n, naja.SNLTerm.Direction.Input, "R")
148
+
149
+
150
+ def constructSDFFCE_PP0P(lib):
151
+ sdffce_pp0p = naja.SNLDesign.createPrimitive(lib, "$_SDFFCE_PP0P_")
152
+ naja.SNLScalarTerm.create(sdffce_pp0p, naja.SNLTerm.Direction.Input, "C")
153
+ naja.SNLScalarTerm.create(sdffce_pp0p, naja.SNLTerm.Direction.Input, "D")
154
+ naja.SNLScalarTerm.create(sdffce_pp0p, naja.SNLTerm.Direction.Input, "E")
155
+ naja.SNLScalarTerm.create(sdffce_pp0p, naja.SNLTerm.Direction.Output, "Q")
156
+ naja.SNLScalarTerm.create(sdffce_pp0p, naja.SNLTerm.Direction.Input, "R")
157
+
158
+
159
+ def constructSDFFCE_PN0N(lib):
160
+ sdffce_pn0n = naja.SNLDesign.createPrimitive(lib, "$_SDFFCE_PN0N_")
161
+ naja.SNLScalarTerm.create(sdffce_pn0n, naja.SNLTerm.Direction.Input, "C")
162
+ naja.SNLScalarTerm.create(sdffce_pn0n, naja.SNLTerm.Direction.Input, "D")
163
+ naja.SNLScalarTerm.create(sdffce_pn0n, naja.SNLTerm.Direction.Input, "E")
164
+ naja.SNLScalarTerm.create(sdffce_pn0n, naja.SNLTerm.Direction.Output, "Q")
165
+ naja.SNLScalarTerm.create(sdffce_pn0n, naja.SNLTerm.Direction.Input, "R")
166
+
167
+
168
+ def load(db):
169
+ logging.info("Loading Yosys primitives")
170
+ lib = naja.NLLibrary.createPrimitives(db, "yosys")
171
+ constructAND(lib)
172
+ constructOR(lib)
173
+ constructXOR(lib)
174
+ constructMUX(lib)
175
+ constructNOT(lib)
176
+ constructDFFP(lib)
177
+ constructDFFE_PP(lib)
178
+ constructDFFE_PN(lib)
179
+ constructDFF_PP0(lib)
180
+ constructDFF_PP1(lib)
181
+ constructDFFE_PP0P(lib)
182
+ constructDFFE_PP1P(lib)
183
+ constructDFFE_PP0N(lib)
184
+ constructSDFF_PP0(lib)
185
+ constructSDFFE_PP0N(lib)
186
+ constructSDFFE_PN0P(lib)
187
+ constructSDFFE_PN0N(lib)
188
+ constructSDFFCE_PP0P(lib)
189
+ constructSDFFCE_PN0N(lib)
@@ -1,9 +1,20 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: najaeda
3
- Version: 0.1.22
3
+ Version: 0.1.24
4
4
  Summary: Naja EDA Python package
5
5
  Author-Email: Naja Authors <contact@keplertech.io>
6
6
  License: Apache License 2.0
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Operating System :: MacOS
11
+ Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
7
18
  Project-URL: Homepage, https://github.com/najaeda/naja
8
19
  Requires-Python: >=3.8
9
20
  Description-Content-Type: text/x-rst
@@ -1,19 +1,19 @@
1
- najaeda-0.1.22.dist-info/RECORD,,
2
- najaeda-0.1.22.dist-info/WHEEL,sha256=nFSIsNnUJn_8RF-FUhBaXtCep1yHZRCxSkBom4ebATM,114
3
- najaeda-0.1.22.dist-info/METADATA,sha256=yODu-S8hBOfAa8gE_obfi9DKrlaWUMBz89ZZb9fk10A,2475
4
- najaeda-0.1.22.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
- najaeda-0.1.22.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
6
- najaeda/netlist.py,sha256=donwdHm7eKBQNTkjdTTt9lAqKxSbSSYF3CTmN1UafkY,53396
7
- najaeda/libnaja_nl.dylib,sha256=O1pfUil1jLkWu89X3JGpKyTwuVqmpsnwZDOESYqjqeU,713152
1
+ najaeda-0.1.24.dist-info/RECORD,,
2
+ najaeda-0.1.24.dist-info/WHEEL,sha256=nFSIsNnUJn_8RF-FUhBaXtCep1yHZRCxSkBom4ebATM,114
3
+ najaeda-0.1.24.dist-info/METADATA,sha256=lDGwE7Obzgqwy7l70oK7xEsyYsisAYE1pQJwvbcUV_A,3046
4
+ najaeda-0.1.24.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
+ najaeda-0.1.24.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
6
+ najaeda/netlist.py,sha256=ZFL00PMhc2pl_uu9_c3_lj65gSjD93zYvfbEFBLZhjg,54309
7
+ najaeda/libnaja_nl.dylib,sha256=jORWEYW9nyFqhPabqspY2MnHdXNEPabSDQa4P9TYhpk,739824
8
8
  najaeda/pandas_stats.py,sha256=yOb4ka965U7rN4D6AwvSGmRyeT_O7Ed-5cmT8BFbfeo,1070
9
9
  najaeda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- najaeda/naja.so,sha256=MR_bQ_U1LJRg_rHuKma1ReUGEUewKzUZTbVI5B6FQUE,99440
10
+ najaeda/naja.so,sha256=Zq_U-K5-CLmKVlAy03UV4sS5vCjHUL8mQ4nZnBMzVjQ,99440
11
11
  najaeda/net_visitor.py,sha256=P_esjibYb-wBDuF-AyF7es9sJYw1Ha8RhTPu-qKe7G4,1940
12
- najaeda/libnaja_opt.dylib,sha256=91kz37-SLpztC7x1F_VYZlddwzCBoNVaD6NqL7OL2GQ,190816
13
- najaeda/libnaja_python.dylib,sha256=l_0oqWr7QEUDCHKI8l2twNrdBEwneIIvXG4yk_Xt4Jc,904240
12
+ najaeda/libnaja_opt.dylib,sha256=5SAY5qqe7QALr2iZP8u8g3KN8Dn4qej9SrcL1hpE6iw,196416
13
+ najaeda/libnaja_python.dylib,sha256=RSDmBKwPGLlD7LECPwljdCRKSWfLaOqvzpetmfT3psI,925632
14
14
  najaeda/stats.py,sha256=wackXsf0x24ic9v-UifECHj4t5yveUWssMDZp2B057A,16187
15
15
  najaeda/instance_visitor.py,sha256=JMsPSQaWNiDjxS05rxg83a0PIsrOIuTi9G35hkwdibs,1530
16
- najaeda/libnaja_bne.dylib,sha256=r9-g0qCILL6w_BgXYg62karCWloSPSpdNGEeS2Ey0Jk,134064
16
+ najaeda/libnaja_bne.dylib,sha256=4lVFVXUHKBvqhK5bRnk4HEPvPqnrfH3q0mTtoB2FccY,136624
17
17
  najaeda/libnaja_dnl.dylib,sha256=zWsiT-RPDJz9koiDDUHqGNFzSFz7x2SmlIo5PTLkTUs,145936
18
18
  najaeda/native/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  najaeda/native/stats.py,sha256=t50hhE9pEFNtlssjES0A-K9TsO_2ZSUAb-e9L3Rt6yc,13063
@@ -37,4 +37,5 @@ najaeda/.dylibs/libtbbmalloc.2.15.dylib,sha256=ORLa9YDlOcMwtcYPZoVnNTTbBpL4lHwYc
37
37
  najaeda/.dylibs/libtbb.12.15.dylib,sha256=MGGmYnvwo6PQYq7aVv_m2gKHBbOkAdwjPLJtYZvtG7w,366192
38
38
  najaeda/.dylibs/libkj-1.1.0.dylib,sha256=pB7dMks8b8ybJ6xKWqFR_hHjKsmpf7wzbcunZaS7gO4,578320
39
39
  najaeda/primitives/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
+ najaeda/primitives/yosys.py,sha256=g1L70AUJoPCkd9B-b9aW4Pzc1AeR9KyIHoXvneW_UEU,8584
40
41
  najaeda/primitives/xilinx.py,sha256=Ka-jlu-OxixEZ_yR_niXLHtaUL8HxT1Bg9H9Kpnr4ns,26551