najaeda 0.2.3__cp313-cp313t-macosx_11_0_arm64.whl → 0.2.5__cp313-cp313t-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_dnl.dylib CHANGED
Binary file
Binary file
najaeda/libnaja_nl.dylib CHANGED
Binary file
Binary file
najaeda/naja.so CHANGED
Binary file
najaeda/netlist.py CHANGED
@@ -3,7 +3,6 @@
3
3
  #
4
4
  # SPDX-License-Identifier: Apache-2.0
5
5
 
6
- import itertools
7
6
  import time
8
7
  import logging
9
8
  import hashlib
@@ -11,7 +10,7 @@ import struct
11
10
  import sys
12
11
  import os
13
12
  from enum import Enum
14
- from typing import Union, List
13
+ from typing import Union, List, Iterator
15
14
  from dataclasses import dataclass
16
15
 
17
16
  from najaeda import naja
@@ -133,27 +132,31 @@ class Equipotential:
133
132
  for term in self.equi.getTerms():
134
133
  yield Term([], term)
135
134
 
136
- def get_leaf_readers(self):
135
+ def get_leaf_readers(self, filter=None):
137
136
  if self.equi is not None:
138
137
  for term in self.equi.getInstTermOccurrences():
139
138
  direction = term.getInstTerm().getDirection()
140
- if direction != naja.SNLTerm.Direction.Output:
141
- if term.getInstTerm().getInstance().getModel().isLeaf():
142
- path = term.getPath().getPathIDs()
143
- path.append(term.getInstTerm().getInstance().getID())
144
- yield Term(path,
145
- term.getInstTerm().getBitTerm())
146
-
147
- def get_leaf_drivers(self):
139
+ if (
140
+ direction != naja.SNLTerm.Direction.Output and
141
+ term.getInstTerm().getInstance().getModel().isLeaf() and
142
+ (filter is None or filter(term))
143
+ ):
144
+ path = term.getPath().getPathIDs()
145
+ path.append(term.getInstTerm().getInstance().getID())
146
+ yield Term(path, term.getInstTerm().getBitTerm())
147
+
148
+ def get_leaf_drivers(self, filter=None):
148
149
  if self.equi is not None:
149
150
  for term in self.equi.getInstTermOccurrences():
150
151
  direction = term.getInstTerm().getDirection()
151
- if direction != naja.SNLTerm.Direction.Input:
152
- if term.getInstTerm().getInstance().getModel().isLeaf():
153
- path = term.getPath().getPathIDs()
154
- path.append(term.getInstTerm().getInstance().getID())
155
- yield Term(path,
156
- term.getInstTerm().getBitTerm())
152
+ if (
153
+ direction != naja.SNLTerm.Direction.Input and
154
+ term.getInstTerm().getInstance().getModel().isLeaf() and
155
+ (filter is None or filter(term))
156
+ ):
157
+ path = term.getPath().getPathIDs()
158
+ path.append(term.getInstTerm().getInstance().getID())
159
+ yield Term(path, term.getInstTerm().getBitTerm())
157
160
 
158
161
  def get_top_readers(self):
159
162
  if self.equi is not None:
@@ -241,6 +244,10 @@ class Net:
241
244
  "Use the bus net instead."
242
245
  )
243
246
  else:
247
+ # We need to uniquify until parent instance if parent instance is not top.
248
+ path = get_snl_path_from_id_list(self.pathIDs)
249
+ if path.size():
250
+ naja.SNLUniquifier(path.getHeadPath())
244
251
  self.net.setName(name)
245
252
 
246
253
  def get_msb(self) -> int:
@@ -304,10 +311,7 @@ class Net:
304
311
  if hasattr(self, "net"):
305
312
  return self.net.isConstant()
306
313
  else:
307
- for net in self.net_concat:
308
- if not net.isConstant():
309
- return False
310
- return True
314
+ return all(net.isConstant() for net in self.net_concat)
311
315
 
312
316
  def set_type(self, net_type: Type):
313
317
  """
@@ -342,7 +346,7 @@ class Net:
342
346
  yield self
343
347
  else:
344
348
  for net in self.net_concat:
345
- yield Net(net)
349
+ yield Net(self.pathIDs, net)
346
350
 
347
351
  def get_bit(self, index: int):
348
352
  """
@@ -409,8 +413,8 @@ class Net:
409
413
  :return: an iterator over the terminals of the net.
410
414
  :rtype: Iterator[Term]
411
415
  """
412
- for term in itertools.chain(self.get_design_terms(), self.get_inst_terms()):
413
- yield term
416
+ yield from self.get_design_terms()
417
+ yield from self.get_inst_terms()
414
418
 
415
419
 
416
420
  def get_snl_term_for_ids(pathIDs, termIDs):
@@ -552,6 +556,22 @@ class Term:
552
556
  """
553
557
  return self.is_scalar() or self.is_bus_bit()
554
558
 
559
+ def is_sequential(self) -> bool:
560
+ """
561
+ :return: True if the term is a sequential term.
562
+ :rtype: bool
563
+ """
564
+ for term in self.get_instance().get_bit_terms():
565
+ clockRelatedInputs = term.get_instance().get_clock_related_inputs(term)
566
+ if self in clockRelatedInputs:
567
+ return True
568
+ clockRelatedOutputs = term.get_instance().get_clock_related_outputs(term)
569
+ if self in clockRelatedOutputs:
570
+ return True
571
+ if (len(clockRelatedInputs) > 0 or len(clockRelatedOutputs) > 0) and (term == self):
572
+ return True
573
+ return False
574
+
555
575
  def get_bit_number(self):
556
576
  """
557
577
  :return: the bit index of the term if it is a bit.
@@ -618,7 +638,7 @@ class Term:
618
638
  def __get_snl_bitnet(self, bit) -> Net:
619
639
  # single bit
620
640
  path = get_snl_path_from_id_list(self.pathIDs)
621
- if path.size() > 0:
641
+ if path.size():
622
642
  instTerm = path.getTailInstance().getInstTerm(bit)
623
643
  return instTerm.getNet()
624
644
  else:
@@ -693,8 +713,11 @@ class Term:
693
713
  """
694
714
  return Instance(self.pathIDs)
695
715
 
696
- def get_flat_fanout(self):
697
- return self.get_equipotential().get_leaf_readers()
716
+ def get_flat_fanout(self, filter=None):
717
+ return self.get_equipotential().get_leaf_readers(filter=filter)
718
+
719
+ def count_flat_fanout(self, filter=None):
720
+ return sum(1 for _ in self.get_flat_fanout(filter=filter))
698
721
 
699
722
  def get_equipotential(self) -> Equipotential:
700
723
  """
@@ -799,17 +822,7 @@ class Term:
799
822
 
800
823
 
801
824
  def get_instance_by_path(names: list):
802
- assert len(names) > 0
803
- path = naja.SNLPath()
804
- instance = None
805
- top = naja.NLUniverse.get().getTopDesign()
806
- design = top
807
- for name in names:
808
- path = naja.SNLPath(path, design.getInstance(name))
809
- instance = design.getInstance(name)
810
- assert instance is not None
811
- design = instance.getModel()
812
- return Instance(path)
825
+ return get_top().get_child_instance(names)
813
826
 
814
827
 
815
828
  # def refresh_path(path: naja.SNLPath):
@@ -863,9 +876,9 @@ class Instance:
863
876
  def __init__(self, path=naja.SNLPath()):
864
877
  self.inst = None
865
878
  self.revisionCount = 0
866
- self.SNLID = [0, 0, 0, 0, 0, 0]
879
+ self.SNLID = [0] * 6
867
880
  if isinstance(path, naja.SNLPath):
868
- if path.size() > 0:
881
+ if path.size():
869
882
  self.pathIDs = path.getPathIDs()
870
883
  self.revisionCount = path.getTailInstance().getModel().getRevisionCount()
871
884
  self.inst = path.getTailInstance()
@@ -873,10 +886,10 @@ class Instance:
873
886
  self.pathIDs = []
874
887
  elif isinstance(path, list):
875
888
  self.pathIDs = path.copy()
876
- if len(path) > 0:
889
+ if path:
877
890
  self.inst = get_snl_instance_from_id_list(path)
878
891
  self.revisionCount = self.inst.getModel().getRevisionCount()
879
- if self.inst is not None:
892
+ if self.inst:
880
893
  self.SNLID = self.inst.getModel().getNLID()
881
894
 
882
895
  def __eq__(self, other) -> bool:
@@ -928,14 +941,13 @@ class Instance:
928
941
  :return: True if this is the top design.
929
942
  :rtype: bool
930
943
  """
931
- return len(self.pathIDs) == 0
944
+ return not self.pathIDs
932
945
 
933
946
  def is_assign(self) -> bool:
934
947
  """(assign a=b) will create an instance of assign connecting
935
948
  the wire a to the output of the assign and b to the input.
936
949
 
937
- :return: True if this is an assign. Assigns are represented with
938
- unnamed Assign instances.
950
+ :return: True if this is an assign (represented by an unnamed assign instance).
939
951
  :rtype: bool
940
952
  """
941
953
  return self.__get_snl_model().isAssign()
@@ -989,12 +1001,6 @@ class Instance:
989
1001
  """
990
1002
  return self.__get_snl_model().isInv()
991
1003
 
992
- def is_basic_primitive(instance):
993
- design = instance.__get_snl_model()
994
- return (
995
- design.isConst0() or design.isConst1() or design.isBuf() or design.isInv()
996
- )
997
-
998
1004
  def __get_snl_model(self):
999
1005
  if self.is_top():
1000
1006
  return naja.NLUniverse.get().getTopDesign()
@@ -1103,10 +1109,10 @@ class Instance:
1103
1109
  """
1104
1110
  return sum(1 for _ in self.get_nets())
1105
1111
 
1106
- def get_flat_nets(self):
1112
+ def get_bit_nets(self):
1107
1113
  """Iterate over all scalar nets and bus net bits.
1108
1114
 
1109
- :return: an iterator over the flat nets of this Instance.
1115
+ :return: an iterator over the nets at bit level of this Instance.
1110
1116
  :rtype: Iterator[Net]
1111
1117
  """
1112
1118
  for net in self.__get_snl_model().getNets():
@@ -1116,13 +1122,13 @@ class Instance:
1116
1122
  else:
1117
1123
  yield Net(self.pathIDs, net)
1118
1124
 
1119
- def count_flat_nets(self) -> int:
1125
+ def count_bit_nets(self) -> int:
1120
1126
  """Count the number of scalar nets and bus net bits of this Instance.
1121
1127
 
1122
- :return: the number of flat nets of this Instance.
1128
+ :return: the number of bit nets of this Instance.
1123
1129
  :rtype: int
1124
1130
  """
1125
- return sum(1 for _ in self.get_flat_nets())
1131
+ return sum(1 for _ in self.get_bit_nets())
1126
1132
 
1127
1133
  def get_net(self, name: str) -> Net:
1128
1134
  """
@@ -1142,6 +1148,13 @@ class Instance:
1142
1148
  """
1143
1149
  return self.__get_snl_model().isPrimitive()
1144
1150
 
1151
+ def is_sequential(self) -> bool:
1152
+ """
1153
+ :return: True if this is a sequential element.
1154
+ :rtype: bool
1155
+ """
1156
+ return self.__get_snl_model().isSequential()
1157
+
1145
1158
  def get_terms(self):
1146
1159
  """Iterate over all scalar terms and bus terms of this Instance.
1147
1160
 
@@ -1159,22 +1172,22 @@ class Instance:
1159
1172
  """
1160
1173
  return sum(1 for _ in self.get_terms())
1161
1174
 
1162
- def get_flat_terms(self):
1175
+ def get_bit_terms(self):
1163
1176
  """Iterate over all scalar terms and bus term bits.
1164
1177
 
1165
- :return: the flat terms of this Instance.
1178
+ :return: the bit terms of this Instance.
1166
1179
  :rtype: Iterator[Term]
1167
1180
  """
1168
1181
  for term in self.__get_snl_model().getBitTerms():
1169
1182
  yield Term(self.pathIDs, term)
1170
1183
 
1171
- def count_flat_terms(self) -> int:
1184
+ def count_bit_terms(self) -> int:
1172
1185
  """Count the number of scalar terms and bus term bits of this Instance.
1173
1186
 
1174
- :return: the number of flat terms of this Instance.
1187
+ :return: the number of bit terms of this Instance.
1175
1188
  :rtype: int
1176
1189
  """
1177
- return sum(1 for _ in self.get_flat_terms())
1190
+ return sum(1 for _ in self.get_bit_terms())
1178
1191
 
1179
1192
  def get_term(self, name: str) -> Term:
1180
1193
  """
@@ -1207,11 +1220,11 @@ class Instance:
1207
1220
  """
1208
1221
  return sum(1 for _ in self.get_input_terms())
1209
1222
 
1210
- def get_flat_input_terms(self):
1223
+ def get_input_bit_terms(self):
1211
1224
  """Iterate over all scalar input terms and bus input term bits
1212
1225
  of this Instance.
1213
1226
 
1214
- :return: the flat input terms of this Instance.
1227
+ :return: the bit input terms of this Instance.
1215
1228
  :rtype: Iterator[Term]
1216
1229
  """
1217
1230
  for term in self.__get_snl_model().getTerms():
@@ -1222,14 +1235,14 @@ class Instance:
1222
1235
  else:
1223
1236
  yield Term(self.pathIDs, term)
1224
1237
 
1225
- def count_flat_input_terms(self) -> int:
1238
+ def count_input_bit_terms(self) -> int:
1226
1239
  """Count the number of scalar input terms and bus input term bits
1227
1240
  of this Instance.
1228
1241
 
1229
- :return: the number of flat input terms of this Instance.
1242
+ :return: the number of bit input terms of this Instance.
1230
1243
  :rtype: int
1231
1244
  """
1232
- return sum(1 for _ in self.get_flat_input_terms())
1245
+ return sum(1 for _ in self.get_input_bit_terms())
1233
1246
 
1234
1247
  def get_output_terms(self):
1235
1248
  """Iterate over all scalar output terms and bus output terms
@@ -1251,11 +1264,11 @@ class Instance:
1251
1264
  """
1252
1265
  return sum(1 for _ in self.get_output_terms())
1253
1266
 
1254
- def get_flat_output_terms(self):
1267
+ def get_output_bit_terms(self):
1255
1268
  """Iterate over all scalar output terms and bus output term bits
1256
1269
  of this Instance.
1257
1270
 
1258
- :return: the flat output terms of this Instance.
1271
+ :return: the bit output terms of this Instance.
1259
1272
  :rtype: Iterator[Term]
1260
1273
  """
1261
1274
  for term in self.__get_snl_model().getTerms():
@@ -1266,16 +1279,16 @@ class Instance:
1266
1279
  else:
1267
1280
  yield Term(self.pathIDs, term)
1268
1281
 
1269
- def count_flat_output_terms(self) -> int:
1282
+ def count_output_bit_terms(self) -> int:
1270
1283
  """Count the number of scalar output terms and bus output term bits
1271
1284
  of this Instance.
1272
1285
 
1273
- :return: the number of flat output terms of this Instance.
1286
+ :return: the number of bit output terms of this Instance.
1274
1287
  :rtype: int
1275
1288
  """
1276
- return sum(1 for _ in self.get_flat_output_terms())
1289
+ return sum(1 for _ in self.get_output_bit_terms())
1277
1290
 
1278
- def get_attributes(self):
1291
+ def get_attributes(self) -> Iterator[Attribute]:
1279
1292
  """Iterate over the attributes of this Instance.
1280
1293
 
1281
1294
  :return: the attributes of this Instance.
@@ -1285,6 +1298,14 @@ class Instance:
1285
1298
  for attribute in leaf_object.getAttributes():
1286
1299
  yield Attribute(attribute)
1287
1300
 
1301
+ def count_attributes(self) -> int:
1302
+ """Count the attributes of this Instance.
1303
+
1304
+ :return: the number of attributes of this Instance.
1305
+ :rtype: int
1306
+ """
1307
+ return sum(1 for _ in self.get_attributes())
1308
+
1288
1309
  def delete_instance(self, name: str):
1289
1310
  """Delete the child instance with the given name."""
1290
1311
  if name == "":
@@ -1309,7 +1330,7 @@ class Instance:
1309
1330
  # Delete the last instance in uniq_path
1310
1331
  self.__get_snl_model().getInstanceByID(id).destroy()
1311
1332
 
1312
- def get_design(self):
1333
+ def get_design(self) -> "Instance":
1313
1334
  """
1314
1335
  :return: the Instance containing this instance.
1315
1336
  :rtype: Instance
@@ -1347,8 +1368,10 @@ class Instance:
1347
1368
  topSNLDesign.setName(name)
1348
1369
  else:
1349
1370
  path = get_snl_path_from_id_list(self.pathIDs)
1350
- if path.size() > 0:
1351
- naja.SNLUniquifier(path)
1371
+ # We need to uniquify until parent instance if parent instance
1372
+ # is not top. path.size == 1 for instance under top
1373
+ if path.size() > 1:
1374
+ naja.SNLUniquifier(path.getHeadPath())
1352
1375
  path = get_snl_path_from_id_list(self.pathIDs)
1353
1376
  inst = path.getTailInstance()
1354
1377
  inst.setName(name)
@@ -1369,7 +1392,7 @@ class Instance:
1369
1392
  model = self.__get_snl_model()
1370
1393
  return model.getDB().getID(), model.getLibrary().getID(), model.getID()
1371
1394
 
1372
- def create_child_instance(self, model: str, name: str):
1395
+ def create_child_instance(self, model: str, name: str) -> "Instance":
1373
1396
  """Create a child instance with the given model and name.
1374
1397
 
1375
1398
  :param str model: the name of the model of the instance to create.
@@ -1490,7 +1513,7 @@ class Instance:
1490
1513
  :rtype: Net
1491
1514
  """
1492
1515
  path = get_snl_path_from_id_list(self.pathIDs)
1493
- if path.size() > 0:
1516
+ if path.size():
1494
1517
  naja.SNLUniquifier(path)
1495
1518
  path = get_snl_path_from_id_list(self.pathIDs)
1496
1519
  model = self.__get_snl_model()
@@ -1507,7 +1530,7 @@ class Instance:
1507
1530
  :rtype: Net
1508
1531
  """
1509
1532
  path = get_snl_path_from_id_list(self.pathIDs)
1510
- if path.size() > 0:
1533
+ if path.size():
1511
1534
  naja.SNLUniquifier(path)
1512
1535
  path = get_snl_path_from_id_list(self.pathIDs)
1513
1536
  model = self.__get_snl_model()
@@ -1537,6 +1560,87 @@ class Instance:
1537
1560
  """
1538
1561
  return self.__get_snl_model().getTruthTable()
1539
1562
 
1563
+ def add_clock_related_inputs(self, clock_term: Term, input_terms: List[Term]):
1564
+ """Add input terms that are related to the given clock term.
1565
+
1566
+ :param clock_term: the clock term to check for related inputs.
1567
+ :param input_terms: a list of input terms to add.
1568
+ :return: None
1569
+ """
1570
+ snlterms = [get_snl_term_for_ids(term.pathIDs, term.termIDs) for term in input_terms]
1571
+ self.__get_snl_model().addInputsToClockArcs(snlterms,
1572
+ get_snl_term_for_ids(clock_term.pathIDs,
1573
+ clock_term.termIDs))
1574
+
1575
+ def get_clock_related_inputs(self, clock_term: Term) -> List[Term]:
1576
+ """Get all input terms that are related to the given clock term.
1577
+
1578
+ :param clock_term: the clock term to check for related inputs.
1579
+ :return: a list of input terms that are related to the clock term.
1580
+ :rtype: List[Term]
1581
+ """
1582
+ terms = self.__get_snl_model().getClockRelatedInputs(
1583
+ get_snl_term_for_ids(clock_term.pathIDs, clock_term.termIDs))
1584
+ # Convert SNL terms to Term objects
1585
+ return [Term(clock_term.pathIDs, term) for term in terms]
1586
+
1587
+ def add_clock_related_outputs(self, clock_term: Term, output_terms: List[Term]):
1588
+ """Add output terms that are related to the given clock term.
1589
+
1590
+ :param clock_term: the clock term to check for related outputs.
1591
+ :param output_terms: a list of output terms to add.
1592
+ :return: None
1593
+ """
1594
+ # convert Term objects to SNL terms
1595
+ snlterms = [get_snl_term_for_ids(term.pathIDs, term.termIDs) for term in output_terms]
1596
+ self.__get_snl_model().addClockToOutputsArcs(
1597
+ get_snl_term_for_ids(clock_term.pathIDs, clock_term.termIDs), snlterms)
1598
+
1599
+ def get_clock_related_outputs(self, clock_term: Term) -> List[Term]:
1600
+ """Get all output terms that are related to the given clock term.
1601
+
1602
+ :param clock_term: the clock term to check for related outputs.
1603
+ :return: a list of output terms that are related to the clock term.
1604
+ :rtype: List[Term]
1605
+ """
1606
+ terms = self.__get_snl_model().getClockRelatedOutputs(
1607
+ get_snl_term_for_ids(clock_term.pathIDs, clock_term.termIDs))
1608
+ # Convert SNL terms to Term objects
1609
+ return [Term(clock_term.pathIDs, term) for term in terms]
1610
+
1611
+ def add_combinatorial_arcs(self, input_terms: List[Term], output_terms: List[Term]):
1612
+ """Add input terms that are combinatorial inputs for the given output term.
1613
+
1614
+ :param output_term: the output term to check for combinatorial inputs.
1615
+ :param input_terms: a list of input terms to add.
1616
+ :return: None
1617
+ """
1618
+ self.__get_snl_model().addCombinatorialArcs(
1619
+ [get_snl_term_for_ids(term.pathIDs, term.termIDs) for term in input_terms],
1620
+ [get_snl_term_for_ids(term.pathIDs, term.termIDs) for term in output_terms])
1621
+
1622
+ def get_combinatorial_inputs(self, output_term: Term) -> List[Term]:
1623
+ """Get all combinatorial input terms of this instance.
1624
+
1625
+ :return: a list of combinatorial input terms.
1626
+ :rtype: List[Term]
1627
+ """
1628
+ terms = self.__get_snl_model().getCombinatorialInputs(
1629
+ get_snl_term_for_ids(output_term.pathIDs, output_term.termIDs))
1630
+ # Convert SNL terms to Term objects
1631
+ return [Term(self.pathIDs, term) for term in terms]
1632
+
1633
+ def get_combinatorial_outputs(self, input_term: Term) -> List[Term]:
1634
+ """Get all combinatorial output terms of this instance.
1635
+
1636
+ :return: a list of combinatorial output terms.
1637
+ :rtype: List[Term]
1638
+ """
1639
+ terms = self.__get_snl_model().getCombinatorialOutputs(
1640
+ get_snl_term_for_ids(input_term.pathIDs, input_term.termIDs))
1641
+ # Convert SNL terms to Term objects
1642
+ return [Term(self.pathIDs, term) for term in terms]
1643
+
1540
1644
 
1541
1645
  def __get_top_db() -> naja.NLDB:
1542
1646
  if naja.NLUniverse.get() is None:
@@ -1725,3 +1829,31 @@ def apply_constant_propagation():
1725
1829
  top = naja.NLUniverse.get().getTopDesign()
1726
1830
  if top is not None:
1727
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
@@ -151,7 +151,7 @@ class InstanceStats:
151
151
 
152
152
 
153
153
  def is_basic_primitive(instance):
154
- return instance.is_basic_primitive()
154
+ return instance.is_const() or instance.is_buf() or instance.is_inv()
155
155
 
156
156
 
157
157
  def compute_instance_stats(instance, instances_stats):
@@ -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.3
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,21 +1,22 @@
1
- najaeda-0.2.3.dist-info/RECORD,,
2
- najaeda-0.2.3.dist-info/WHEEL,sha256=K65AJzICMUVN6ED5A5fm1lV1nZZqwk4MGF2oXTxJaVw,115
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
1
+ najaeda-0.2.5.dist-info/RECORD,,
2
+ najaeda-0.2.5.dist-info/WHEEL,sha256=K65AJzICMUVN6ED5A5fm1lV1nZZqwk4MGF2oXTxJaVw,115
3
+ najaeda-0.2.5.dist-info/METADATA,sha256=eiDQdwCVkgO-2dtr2b5a_8g5upb0uPXfpUICWWL4Apc,3435
4
+ najaeda-0.2.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
+ najaeda-0.2.5.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
6
+ najaeda/netlist.py,sha256=ZCFc5z7auEGAn2YURizMHnK0Twljug6vefuBCdxGopw,64298
7
+ najaeda/libnaja_nl.dylib,sha256=v773WRb6Pl9gpAtRNB8Z6YO0L0L1N121JPXRm9CjucI,757456
8
8
  najaeda/pandas_stats.py,sha256=yOb4ka965U7rN4D6AwvSGmRyeT_O7Ed-5cmT8BFbfeo,1070
9
9
  najaeda/_version.py,sha256=c-4hT20dyE-3BcdzOqR0vd92E7ydR5u2c-VmCc6oU8A,332
10
10
  najaeda/__init__.py,sha256=6QrOzlqTfd558FH9Zm6ve54IzkHaDJ8ZO8hTCaEwsL8,218
11
- najaeda/naja.so,sha256=XHNZM_gOceq5RZNnpQPQzlwxDTL77QsurBxmbTyoacY,99440
11
+ najaeda/naja.so,sha256=uozldyphs1xe3la3lzWo2MwONzFS0oja_RQQ1iFGleo,99440
12
12
  najaeda/net_visitor.py,sha256=P_esjibYb-wBDuF-AyF7es9sJYw1Ha8RhTPu-qKe7G4,1940
13
13
  najaeda/libnaja_opt.dylib,sha256=wIG2H5rnxbqGrwLSgklJjZ5wjOkx2Shhu2RsnYQwmuE,212720
14
- najaeda/libnaja_python.dylib,sha256=q2macJL3HslU6O6w8pgx2bffe05qdmuQKf5KG2piT2A,961344
15
- najaeda/stats.py,sha256=SJ9rca0Z6ldNAFOjU7DPO2hfx1zq-9Bec0Rx_oLasJo,16217
14
+ najaeda/libnaja_python.dylib,sha256=hLME_4Apxgieg0T_7COVn13YH8VoFV3wMJnHqFtpi-U,961952
15
+ najaeda/stats.py,sha256=g1F1CEBNVvGgzINOI7sK83123cCbclLDmyUjuep3-EU,16107
16
16
  najaeda/instance_visitor.py,sha256=JMsPSQaWNiDjxS05rxg83a0PIsrOIuTi9G35hkwdibs,1530
17
17
  najaeda/libnaja_bne.dylib,sha256=pLbGUnDr5PSGXbA8wKD-pqEyQIWHbiCb1icPpxRYrWE,136416
18
- najaeda/libnaja_dnl.dylib,sha256=qroDUAnl-eBJcdz-1YGC08Ngz4NEUctMiZ4W-gpT5mU,147088
18
+ najaeda/libnaja_metrics.dylib,sha256=Nj1HCvjZR1q4PiWnwKiRHIJ0XFdhsX8XwSLNxXGrl0A,106864
19
+ najaeda/libnaja_dnl.dylib,sha256=tZdFzYkdrk3-MDGPPJoxwLmNjBH2_UhTCEOzueR43hE,148000
19
20
  najaeda/native/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
21
  najaeda/native/stats.py,sha256=t50hhE9pEFNtlssjES0A-K9TsO_2ZSUAb-e9L3Rt6yc,13063
21
22
  najaeda/docs/requirements.txt,sha256=1XIBGTIplm2arC9HhDCfLuAjozGdVSXkqmOj8ybuT6U,121