najaeda 0.2.4__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 0.2.5__cp312-cp312-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/libnaja_dnl.so CHANGED
Binary file
Binary file
najaeda/libnaja_python.so CHANGED
Binary file
najaeda/naja.so CHANGED
Binary file
najaeda/netlist.py CHANGED
@@ -10,7 +10,7 @@ import struct
10
10
  import sys
11
11
  import os
12
12
  from enum import Enum
13
- from typing import Union, List
13
+ from typing import Union, List, Iterator
14
14
  from dataclasses import dataclass
15
15
 
16
16
  from najaeda import naja
@@ -561,7 +561,7 @@ class Term:
561
561
  :return: True if the term is a sequential term.
562
562
  :rtype: bool
563
563
  """
564
- for term in self.get_instance().get_flat_terms():
564
+ for term in self.get_instance().get_bit_terms():
565
565
  clockRelatedInputs = term.get_instance().get_clock_related_inputs(term)
566
566
  if self in clockRelatedInputs:
567
567
  return True
@@ -822,17 +822,7 @@ class Term:
822
822
 
823
823
 
824
824
  def get_instance_by_path(names: list):
825
- assert len(names) > 0
826
- path = naja.SNLPath()
827
- instance = None
828
- top = naja.NLUniverse.get().getTopDesign()
829
- design = top
830
- for name in names:
831
- path = naja.SNLPath(path, design.getInstance(name))
832
- instance = design.getInstance(name)
833
- assert instance is not None
834
- design = instance.getModel()
835
- return Instance(path)
825
+ return get_top().get_child_instance(names)
836
826
 
837
827
 
838
828
  # def refresh_path(path: naja.SNLPath):
@@ -951,14 +941,13 @@ class Instance:
951
941
  :return: True if this is the top design.
952
942
  :rtype: bool
953
943
  """
954
- return len(self.pathIDs) == 0
944
+ return not self.pathIDs
955
945
 
956
946
  def is_assign(self) -> bool:
957
947
  """(assign a=b) will create an instance of assign connecting
958
948
  the wire a to the output of the assign and b to the input.
959
949
 
960
- :return: True if this is an assign. Assigns are represented with
961
- unnamed Assign instances.
950
+ :return: True if this is an assign (represented by an unnamed assign instance).
962
951
  :rtype: bool
963
952
  """
964
953
  return self.__get_snl_model().isAssign()
@@ -1120,10 +1109,10 @@ class Instance:
1120
1109
  """
1121
1110
  return sum(1 for _ in self.get_nets())
1122
1111
 
1123
- def get_flat_nets(self):
1112
+ def get_bit_nets(self):
1124
1113
  """Iterate over all scalar nets and bus net bits.
1125
1114
 
1126
- :return: an iterator over the flat nets of this Instance.
1115
+ :return: an iterator over the nets at bit level of this Instance.
1127
1116
  :rtype: Iterator[Net]
1128
1117
  """
1129
1118
  for net in self.__get_snl_model().getNets():
@@ -1133,13 +1122,13 @@ class Instance:
1133
1122
  else:
1134
1123
  yield Net(self.pathIDs, net)
1135
1124
 
1136
- def count_flat_nets(self) -> int:
1125
+ def count_bit_nets(self) -> int:
1137
1126
  """Count the number of scalar nets and bus net bits of this Instance.
1138
1127
 
1139
- :return: the number of flat nets of this Instance.
1128
+ :return: the number of bit nets of this Instance.
1140
1129
  :rtype: int
1141
1130
  """
1142
- return sum(1 for _ in self.get_flat_nets())
1131
+ return sum(1 for _ in self.get_bit_nets())
1143
1132
 
1144
1133
  def get_net(self, name: str) -> Net:
1145
1134
  """
@@ -1183,22 +1172,22 @@ class Instance:
1183
1172
  """
1184
1173
  return sum(1 for _ in self.get_terms())
1185
1174
 
1186
- def get_flat_terms(self):
1175
+ def get_bit_terms(self):
1187
1176
  """Iterate over all scalar terms and bus term bits.
1188
1177
 
1189
- :return: the flat terms of this Instance.
1178
+ :return: the bit terms of this Instance.
1190
1179
  :rtype: Iterator[Term]
1191
1180
  """
1192
1181
  for term in self.__get_snl_model().getBitTerms():
1193
1182
  yield Term(self.pathIDs, term)
1194
1183
 
1195
- def count_flat_terms(self) -> int:
1184
+ def count_bit_terms(self) -> int:
1196
1185
  """Count the number of scalar terms and bus term bits of this Instance.
1197
1186
 
1198
- :return: the number of flat terms of this Instance.
1187
+ :return: the number of bit terms of this Instance.
1199
1188
  :rtype: int
1200
1189
  """
1201
- return sum(1 for _ in self.get_flat_terms())
1190
+ return sum(1 for _ in self.get_bit_terms())
1202
1191
 
1203
1192
  def get_term(self, name: str) -> Term:
1204
1193
  """
@@ -1231,11 +1220,11 @@ class Instance:
1231
1220
  """
1232
1221
  return sum(1 for _ in self.get_input_terms())
1233
1222
 
1234
- def get_flat_input_terms(self):
1223
+ def get_input_bit_terms(self):
1235
1224
  """Iterate over all scalar input terms and bus input term bits
1236
1225
  of this Instance.
1237
1226
 
1238
- :return: the flat input terms of this Instance.
1227
+ :return: the bit input terms of this Instance.
1239
1228
  :rtype: Iterator[Term]
1240
1229
  """
1241
1230
  for term in self.__get_snl_model().getTerms():
@@ -1246,14 +1235,14 @@ class Instance:
1246
1235
  else:
1247
1236
  yield Term(self.pathIDs, term)
1248
1237
 
1249
- def count_flat_input_terms(self) -> int:
1238
+ def count_input_bit_terms(self) -> int:
1250
1239
  """Count the number of scalar input terms and bus input term bits
1251
1240
  of this Instance.
1252
1241
 
1253
- :return: the number of flat input terms of this Instance.
1242
+ :return: the number of bit input terms of this Instance.
1254
1243
  :rtype: int
1255
1244
  """
1256
- return sum(1 for _ in self.get_flat_input_terms())
1245
+ return sum(1 for _ in self.get_input_bit_terms())
1257
1246
 
1258
1247
  def get_output_terms(self):
1259
1248
  """Iterate over all scalar output terms and bus output terms
@@ -1275,11 +1264,11 @@ class Instance:
1275
1264
  """
1276
1265
  return sum(1 for _ in self.get_output_terms())
1277
1266
 
1278
- def get_flat_output_terms(self):
1267
+ def get_output_bit_terms(self):
1279
1268
  """Iterate over all scalar output terms and bus output term bits
1280
1269
  of this Instance.
1281
1270
 
1282
- :return: the flat output terms of this Instance.
1271
+ :return: the bit output terms of this Instance.
1283
1272
  :rtype: Iterator[Term]
1284
1273
  """
1285
1274
  for term in self.__get_snl_model().getTerms():
@@ -1290,16 +1279,16 @@ class Instance:
1290
1279
  else:
1291
1280
  yield Term(self.pathIDs, term)
1292
1281
 
1293
- def count_flat_output_terms(self) -> int:
1282
+ def count_output_bit_terms(self) -> int:
1294
1283
  """Count the number of scalar output terms and bus output term bits
1295
1284
  of this Instance.
1296
1285
 
1297
- :return: the number of flat output terms of this Instance.
1286
+ :return: the number of bit output terms of this Instance.
1298
1287
  :rtype: int
1299
1288
  """
1300
- return sum(1 for _ in self.get_flat_output_terms())
1289
+ return sum(1 for _ in self.get_output_bit_terms())
1301
1290
 
1302
- def get_attributes(self):
1291
+ def get_attributes(self) -> Iterator[Attribute]:
1303
1292
  """Iterate over the attributes of this Instance.
1304
1293
 
1305
1294
  :return: the attributes of this Instance.
@@ -1341,7 +1330,7 @@ class Instance:
1341
1330
  # Delete the last instance in uniq_path
1342
1331
  self.__get_snl_model().getInstanceByID(id).destroy()
1343
1332
 
1344
- def get_design(self):
1333
+ def get_design(self) -> "Instance":
1345
1334
  """
1346
1335
  :return: the Instance containing this instance.
1347
1336
  :rtype: Instance
@@ -1403,7 +1392,7 @@ class Instance:
1403
1392
  model = self.__get_snl_model()
1404
1393
  return model.getDB().getID(), model.getLibrary().getID(), model.getID()
1405
1394
 
1406
- def create_child_instance(self, model: str, name: str):
1395
+ def create_child_instance(self, model: str, name: str) -> "Instance":
1407
1396
  """Create a child instance with the given model and name.
1408
1397
 
1409
1398
  :param str model: the name of the model of the instance to create.
@@ -1524,7 +1513,7 @@ class Instance:
1524
1513
  :rtype: Net
1525
1514
  """
1526
1515
  path = get_snl_path_from_id_list(self.pathIDs)
1527
- if path.size() > 0:
1516
+ if path.size():
1528
1517
  naja.SNLUniquifier(path)
1529
1518
  path = get_snl_path_from_id_list(self.pathIDs)
1530
1519
  model = self.__get_snl_model()
@@ -1541,7 +1530,7 @@ class Instance:
1541
1530
  :rtype: Net
1542
1531
  """
1543
1532
  path = get_snl_path_from_id_list(self.pathIDs)
1544
- if path.size() > 0:
1533
+ if path.size():
1545
1534
  naja.SNLUniquifier(path)
1546
1535
  path = get_snl_path_from_id_list(self.pathIDs)
1547
1536
  model = self.__get_snl_model()
@@ -1840,3 +1829,31 @@ def apply_constant_propagation():
1840
1829
  top = naja.NLUniverse.get().getTopDesign()
1841
1830
  if top is not None:
1842
1831
  naja.NLUniverse.get().applyConstantPropagation()
1832
+
1833
+
1834
+ def get_max_fanout() -> int:
1835
+ """Get the maximum fanout of the top design.
1836
+
1837
+ :return: the maximum fanout of the top design.
1838
+ :rtype: int
1839
+ """
1840
+ u = naja.NLUniverse.get()
1841
+ if u is not None:
1842
+ top = naja.NLUniverse.get().getTopDesign()
1843
+ if top is not None:
1844
+ return naja.NLUniverse.get().getMaxFanout()
1845
+ return 0
1846
+
1847
+
1848
+ def get_max_logic_level() -> int:
1849
+ """Get the maximum logic level of the top design.
1850
+
1851
+ :return: the maximum logic level of the top design.
1852
+ :rtype: int
1853
+ """
1854
+ u = naja.NLUniverse.get()
1855
+ if u is not None:
1856
+ top = naja.NLUniverse.get().getTopDesign()
1857
+ if top is not None:
1858
+ return naja.NLUniverse.get().getMaxLogicLevel()
1859
+ return 0
najaeda/stats.py CHANGED
@@ -236,7 +236,7 @@ def compute_instance_terms(instance, instance_stats):
236
236
 
237
237
 
238
238
  def compute_instance_net_stats(instance, instance_stats):
239
- for net in instance.get_flat_nets():
239
+ for net in instance.get_bit_nets():
240
240
  if net.is_const():
241
241
  pass
242
242
  nb_components = sum(1 for c in net.get_terms())
@@ -372,21 +372,18 @@ def convert_instance_stats_to_json(instance_stats):
372
372
  return json_top
373
373
 
374
374
 
375
- def dump_instance_stats_json(instance, stats_file):
376
- # stats_files = [(InstanceStats.ReportType.JSON, stats_file)]
377
- # stats_file.write("[\n")
378
- # dump_instance_stats(design, stats_files)
379
- # stats_file.write("]")
375
+ def dump_instance_stats_json(instance, path: str):
380
376
  instances_stats = InstancesStats()
381
377
  compute_instance_stats(instance, instances_stats)
382
378
  json_dict = convert_instance_stats_to_json(instances_stats)
383
- json.dump(json_dict, stats_file, indent=4)
379
+ with open(path, "w") as f:
380
+ json.dump(json_dict, f, indent=4)
384
381
 
385
382
 
386
- def dump_instance_stats_text(instance, file):
383
+ def dump_instance_stats_text(instance, path: str):
387
384
  instances_stats = InstancesStats()
388
385
  compute_instance_stats(instance, instances_stats)
389
- instances_stats.dump_instance_stats_text(instance, file)
386
+ instances_stats.dump_instance_stats_text(instance, path)
390
387
 
391
388
 
392
389
  def dump_constants(design, analyzed_models):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: najaeda
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Naja EDA Python package
5
5
  Author-Email: Naja Authors <contact@keplertech.io>
6
6
  License: Apache License 2.0
@@ -1,15 +1,16 @@
1
- najaeda/libnaja_python.so,sha256=Cwza4QkeZDZhrA17FQH4_TElUBU57Ph0w-SZb66iuJ0,1953777
1
+ najaeda/libnaja_python.so,sha256=cEOtyQaxkIfm8W-jUvlHobrX2ecKw_vjgACbYvibcQg,1953969
2
2
  najaeda/_version.py,sha256=c-4hT20dyE-3BcdzOqR0vd92E7ydR5u2c-VmCc6oU8A,332
3
3
  najaeda/libnaja_nl.so,sha256=YETeQWTGyXAJc_wfixap2mrHiySUzBkEvYL_GNA5sFQ,1646896
4
- najaeda/naja.so,sha256=RC9W74jMhQ12xUkTw12PqqiNOAP0w1KPtBHJrXNY5I8,206521
4
+ najaeda/naja.so,sha256=RhX7SE0sVWGlvgWUqPxlsFSuOdqFVQp10toxjNKEHOA,206561
5
5
  najaeda/pandas_stats.py,sha256=yOb4ka965U7rN4D6AwvSGmRyeT_O7Ed-5cmT8BFbfeo,1070
6
- najaeda/stats.py,sha256=W41fqyMiAN9o9ajXy1t-CGoxDaSmY0TyTT5epc6yz-I,16249
6
+ najaeda/stats.py,sha256=g1F1CEBNVvGgzINOI7sK83123cCbclLDmyUjuep3-EU,16107
7
+ najaeda/libnaja_metrics.so,sha256=weTjkcgBVv_aY8Mdr2zPSJv2NtQoMgQYXJKAYrgEsRA,206361
7
8
  najaeda/libnaja_bne.so,sha256=ejZf2Zl2AXQagN41HIj8x-3oeoyEffcPTPR0YeY40ng,272577
8
9
  najaeda/__init__.py,sha256=6QrOzlqTfd558FH9Zm6ve54IzkHaDJ8ZO8hTCaEwsL8,218
9
10
  najaeda/libnaja_opt.so,sha256=t71JSk0NSGXY48FRSOL-j_O98iwLF1s-ppe8z8h2lZg,348713
10
- najaeda/netlist.py,sha256=KdBQ77bMqYiUU_ecbDrR43L98FXk05_ahvj-8um-G5k,63866
11
+ najaeda/netlist.py,sha256=ZCFc5z7auEGAn2YURizMHnK0Twljug6vefuBCdxGopw,64298
11
12
  najaeda/net_visitor.py,sha256=P_esjibYb-wBDuF-AyF7es9sJYw1Ha8RhTPu-qKe7G4,1940
12
- najaeda/libnaja_dnl.so,sha256=QxHFSN33IIipFUl-Nx0qyG1XPynYOq4GbF7YbwGkbBM,276545
13
+ najaeda/libnaja_dnl.so,sha256=xr8Wn-ADZdJ8Hpe_T7lVKIPTBg7hEXvuDgD_7o8yjdA,276937
13
14
  najaeda/instance_visitor.py,sha256=JMsPSQaWNiDjxS05rxg83a0PIsrOIuTi9G35hkwdibs,1530
14
15
  najaeda/native/stats.py,sha256=t50hhE9pEFNtlssjES0A-K9TsO_2ZSUAb-e9L3Rt6yc,13063
15
16
  najaeda/native/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -31,11 +32,11 @@ najaeda/docs/source/api.rst,sha256=47VCPyF4Py_1cklZ3q9fmOMhqqI17rxwU_VUJETfCwY,1
31
32
  najaeda/docs/source/term.rst,sha256=QKWT6u1xjEjusvcZYknKQ-M83ibohO5y1EYTQnnXqak,690
32
33
  najaeda/docs/source/instance.rst,sha256=4JDl4_YaTbYxJrgSCe-3vV-EkKGGKOIejXMLfbJR1jk,957
33
34
  najaeda/docs/source/conf.py,sha256=XqCFo29gZCbaoPe1xEan9ZonYyQW5NZnWHGEWrB7p8Q,2021
34
- najaeda-0.2.4.dist-info/WHEEL,sha256=qWe43I_ziyqlu2SouxbZAN4VQzvapKrxWUcRsva4KM8,158
35
- najaeda-0.2.4.dist-info/METADATA,sha256=aGamxUDd_TKlccUOBxm-ooAbA3Ef-FwSlgP3lPTW09U,3435
36
- najaeda-0.2.4.dist-info/RECORD,,
37
- najaeda-0.2.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
38
- najaeda-0.2.4.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
35
+ najaeda-0.2.5.dist-info/WHEEL,sha256=qWe43I_ziyqlu2SouxbZAN4VQzvapKrxWUcRsva4KM8,158
36
+ najaeda-0.2.5.dist-info/METADATA,sha256=eiDQdwCVkgO-2dtr2b5a_8g5upb0uPXfpUICWWL4Apc,3435
37
+ najaeda-0.2.5.dist-info/RECORD,,
38
+ najaeda-0.2.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
39
+ najaeda-0.2.5.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
39
40
  najaeda.libs/libtbbmalloc-8bd2c113.so.2.15,sha256=t7EmHeYI7vtRrpUMImjQuzDv3a1gs8-lcUxotcVs3mA,198281
40
41
  najaeda.libs/libcapnp-1-d562dcbf.1.0.so,sha256=oATbFuRyIBdV6dWAaarYlY3DDt3Wvyp1nC5FvgRIyzw,1152985
41
42
  najaeda.libs/libtbb-58378cc2.so.12.15,sha256=yxzhDOGKoZHEHYUULdSu-uH9-Hr1Wh8JygBizKBxc_U,404105