najaeda 0.1.15__cp313-cp313t-macosx_11_0_arm64.whl → 0.1.21__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/netlist.py CHANGED
@@ -9,9 +9,10 @@ import logging
9
9
  import hashlib
10
10
  import struct
11
11
  import sys
12
+ import os
12
13
  from enum import Enum
13
14
 
14
- from najaeda import snl
15
+ from najaeda import naja
15
16
 
16
17
 
17
18
  def get_none_existent():
@@ -44,8 +45,8 @@ def consistent_hash(obj):
44
45
  return int(hashlib.sha256(obj_bytes).hexdigest(), 16)
45
46
 
46
47
 
47
- def get_snl_instance_from_id_list(id_list: list) -> snl.SNLInstance:
48
- design = snl.SNLUniverse.get().getTopDesign()
48
+ def get_snl_instance_from_id_list(id_list: list) -> naja.SNLInstance:
49
+ design = naja.NLUniverse.get().getTopDesign()
49
50
  # instance = None
50
51
  # for id in id_list:
51
52
  # instance = design.getInstanceByID(id)
@@ -55,14 +56,14 @@ def get_snl_instance_from_id_list(id_list: list) -> snl.SNLInstance:
55
56
  return design.getInstanceByIDList(id_list)
56
57
 
57
58
 
58
- def get_snl_path_from_id_list(id_list: list) -> snl.SNLPath:
59
- top = snl.SNLUniverse.get().getTopDesign()
59
+ def get_snl_path_from_id_list(id_list: list) -> naja.SNLPath:
60
+ top = naja.NLUniverse.get().getTopDesign()
60
61
  design = top
61
- path = snl.SNLPath()
62
+ path = naja.SNLPath()
62
63
  for id in id_list:
63
64
  instance = design.getInstanceByID(id)
64
65
  assert instance is not None
65
- path = snl.SNLPath(path, instance)
66
+ path = naja.SNLPath(path, instance)
66
67
  assert path.getTailInstance() is not None
67
68
  design = instance.getModel()
68
69
  if len(id_list) > 0:
@@ -79,7 +80,7 @@ class Equipotential:
79
80
  path = get_snl_path_from_id_list(term.pathIDs)
80
81
  snl_term = get_snl_term_for_ids_with_path(path, term.termIDs)
81
82
  inst_term = None
82
- if isinstance(snl_term, snl.SNLBusTerm):
83
+ if isinstance(snl_term, naja.SNLBusTerm):
83
84
  raise ValueError("Equipotential cannot be constructed on bus term")
84
85
  if len(term.pathIDs) == 0:
85
86
  net = term.get_lower_net()
@@ -91,14 +92,14 @@ class Equipotential:
91
92
  self.equi = None
92
93
  return
93
94
  else:
94
- path = snl.SNLPath(path, get_snl_instance_from_id_list(inst_term.pathIDs))
95
+ path = naja.SNLPath(path, get_snl_instance_from_id_list(inst_term.pathIDs))
95
96
  snl_term = get_snl_term_for_ids(inst_term.pathIDs, inst_term.termIDs)
96
97
  else:
97
98
  inst_term = term
98
- ito = snl.SNLNetComponentOccurrence(
99
+ ito = naja.SNLNetComponentOccurrence(
99
100
  path.getHeadPath(), path.getTailInstance().getInstTerm(snl_term)
100
101
  )
101
- self.equi = snl.SNLEquipotential(ito)
102
+ self.equi = naja.SNLEquipotential(ito)
102
103
 
103
104
  def __eq__(self, value):
104
105
  return self.equi == value.equi
@@ -134,7 +135,7 @@ class Equipotential:
134
135
  if self.equi is not None:
135
136
  for term in self.equi.getInstTermOccurrences():
136
137
  direction = term.getInstTerm().getDirection()
137
- if direction != snl.SNLTerm.Direction.Output:
138
+ if direction != naja.SNLTerm.Direction.Output:
138
139
  if term.getInstTerm().getInstance().getModel().isLeaf():
139
140
  path = term.getPath().getPathIDs()
140
141
  path.append(term.getInstTerm().getInstance().getID())
@@ -145,7 +146,7 @@ class Equipotential:
145
146
  if self.equi is not None:
146
147
  for term in self.equi.getInstTermOccurrences():
147
148
  direction = term.getInstTerm().getDirection()
148
- if direction != snl.SNLTerm.Direction.Input:
149
+ if direction != naja.SNLTerm.Direction.Input:
149
150
  if term.getInstTerm().getInstance().getModel().isLeaf():
150
151
  path = term.getPath().getPathIDs()
151
152
  path.append(term.getInstTerm().getInstance().getID())
@@ -156,31 +157,31 @@ class Equipotential:
156
157
  if self.equi is not None:
157
158
  for term in self.equi.getTerms():
158
159
  direction = term.getDirection()
159
- if direction != snl.SNLTerm.Direction.Input:
160
+ if direction != naja.SNLTerm.Direction.Input:
160
161
  yield Term([], term)
161
162
 
162
163
  def get_top_drivers(self):
163
164
  if self.equi is not None:
164
165
  for term in self.equi.getTerms():
165
166
  direction = term.getDirection()
166
- if direction != snl.SNLTerm.Direction.Output:
167
+ if direction != naja.SNLTerm.Direction.Output:
167
168
  yield Term([], term)
168
169
 
169
170
 
170
171
  class Net:
171
172
  class Type(Enum):
172
- STANDARD = snl.SNLNet.Type.Standard
173
- ASSIGN0 = snl.SNLNet.Type.Assign0
174
- ASSIGN1 = snl.SNLNet.Type.Assign1
175
- SUPPLY0 = snl.SNLNet.Type.Supply0
176
- SUPPLY1 = snl.SNLNet.Type.Supply1
173
+ STANDARD = naja.SNLNet.Type.Standard
174
+ ASSIGN0 = naja.SNLNet.Type.Assign0
175
+ ASSIGN1 = naja.SNLNet.Type.Assign1
176
+ SUPPLY0 = naja.SNLNet.Type.Supply0
177
+ SUPPLY1 = naja.SNLNet.Type.Supply1
177
178
 
178
179
  def __init__(self, path, net=None, net_concat=None):
179
180
  if net is not None and net_concat is not None:
180
181
  raise ValueError(
181
182
  "Only one of `net` or `net_concat` should be provided, not both."
182
183
  )
183
- if isinstance(path, snl.SNLPath):
184
+ if isinstance(path, naja.SNLPath):
184
185
  if path.size() > 0:
185
186
  self.pathIDs = path.getPathIDs()
186
187
  else:
@@ -227,7 +228,7 @@ class Net:
227
228
  :return: the most significant bit of the net if it is a bus.
228
229
  :rtype: int
229
230
  """
230
- if hasattr(self, "net") and isinstance(self.net, snl.SNLBusNet):
231
+ if hasattr(self, "net") and isinstance(self.net, naja.SNLBusNet):
231
232
  return self.net.getMSB()
232
233
  return None
233
234
 
@@ -236,7 +237,7 @@ class Net:
236
237
  :return: the least significant bit of the net if it is a bus.
237
238
  :rtype: int
238
239
  """
239
- if hasattr(self, "net") and isinstance(self.net, snl.SNLBusNet):
240
+ if hasattr(self, "net") and isinstance(self.net, naja.SNLBusNet):
240
241
  return self.net.getLSB()
241
242
  return None
242
243
 
@@ -245,21 +246,21 @@ class Net:
245
246
  :return: True if the net is a bus.
246
247
  :rtype: bool
247
248
  """
248
- return hasattr(self, "net") and isinstance(self.net, snl.SNLBusNet)
249
+ return hasattr(self, "net") and isinstance(self.net, naja.SNLBusNet)
249
250
 
250
251
  def is_bus_bit(self) -> bool:
251
252
  """
252
253
  :return: True if the net is a bit of a bus.
253
254
  :rtype: bool
254
255
  """
255
- return hasattr(self, "net") and isinstance(self.net, snl.SNLBusNetBit)
256
+ return hasattr(self, "net") and isinstance(self.net, naja.SNLBusNetBit)
256
257
 
257
258
  def is_scalar(self) -> bool:
258
259
  """
259
260
  :return: True if the net is a scalar.
260
261
  :rtype: bool
261
262
  """
262
- return hasattr(self, "net") and isinstance(self.net, snl.SNLScalarNet)
263
+ return hasattr(self, "net") and isinstance(self.net, naja.SNLScalarNet)
263
264
 
264
265
  def is_bit(self) -> bool:
265
266
  """
@@ -314,7 +315,7 @@ class Net:
314
315
  :rtype: Iterator[Net]
315
316
  """
316
317
  if hasattr(self, "net"):
317
- if isinstance(self.net, snl.SNLBusNet):
318
+ if isinstance(self.net, naja.SNLBusNet):
318
319
  for bit in self.net.getBits():
319
320
  yield Net(self.pathIDs, bit)
320
321
  else:
@@ -330,7 +331,7 @@ class Net:
330
331
  :rtype: Net
331
332
  """
332
333
  if hasattr(self, "net"):
333
- if isinstance(self.net, snl.SNLBusNet):
334
+ if isinstance(self.net, naja.SNLBusNet):
334
335
  return Net(self.pathIDs, self.net.getBit(index))
335
336
  else:
336
337
  return None
@@ -374,14 +375,14 @@ def get_snl_term_for_ids(pathIDs, termIDs):
374
375
  path = get_snl_path_from_id_list(pathIDs)
375
376
  model = None
376
377
  if len(pathIDs) == 0:
377
- model = snl.SNLUniverse.get().getTopDesign()
378
+ model = naja.NLUniverse.get().getTopDesign()
378
379
  else:
379
380
  model = path.getTailInstance().getModel()
380
381
  if termIDs[1] == get_none_existent():
381
382
  return model.getTermByID(termIDs[0])
382
383
  else:
383
384
  snlterm = model.getTermByID(termIDs[0])
384
- if isinstance(snlterm, snl.SNLBusTerm):
385
+ if isinstance(snlterm, naja.SNLBusTerm):
385
386
  return snlterm.getBusTermBit(termIDs[1])
386
387
  else:
387
388
  return snlterm
@@ -390,27 +391,27 @@ def get_snl_term_for_ids(pathIDs, termIDs):
390
391
  def get_snl_term_for_ids_with_path(path, termIDs):
391
392
  model = None
392
393
  if path.size() == 0:
393
- model = snl.SNLUniverse.get().getTopDesign()
394
+ model = naja.NLUniverse.get().getTopDesign()
394
395
  else:
395
396
  model = path.getTailInstance().getModel()
396
397
  if termIDs[1] == get_none_existent():
397
398
  return model.getTermByID(termIDs[0])
398
399
  else:
399
400
  snlterm = model.getTermByID(termIDs[0])
400
- if isinstance(snlterm, snl.SNLBusTerm):
401
+ if isinstance(snlterm, naja.SNLBusTerm):
401
402
  return snlterm.getBusTermBit(termIDs[1])
402
403
  else:
403
404
  return snlterm
404
405
 
405
406
 
406
407
  class Term:
407
- INPUT = snl.SNLTerm.Direction.Input
408
- OUTPUT = snl.SNLTerm.Direction.Output
409
- INOUT = snl.SNLTerm.Direction.InOut
408
+ INPUT = naja.SNLTerm.Direction.Input
409
+ OUTPUT = naja.SNLTerm.Direction.Output
410
+ INOUT = naja.SNLTerm.Direction.InOut
410
411
 
411
412
  def __init__(self, path, term):
412
413
  # self.termIDs = []
413
- # if isinstance(term, snl.SNLBusTerm):
414
+ # if isinstance(term, naja.SNLBusTerm):
414
415
  # self.termIDs = [term.getID(), -1]
415
416
  # else:
416
417
  self.termIDs = [term.getID(), term.getBit()]
@@ -439,7 +440,7 @@ class Term:
439
440
  def __hash__(self):
440
441
  termIDs = []
441
442
  snlterm = get_snl_term_for_ids(self.pathIDs, self.termIDs)
442
- if isinstance(snlterm, snl.SNLBusTerm):
443
+ if isinstance(snlterm, naja.SNLBusTerm):
443
444
  termIDs = [snlterm.getID(), -1]
444
445
  else:
445
446
  termIDs = [snlterm.getID(), snlterm.getBit()]
@@ -468,7 +469,7 @@ class Term:
468
469
  path = get_snl_path_from_id_list(self.pathIDs)
469
470
  if path.size() > 1:
470
471
  path = path.getHeadPath()
471
- snl.SNLUniquifier(path)
472
+ naja.SNLUniquifier(path)
472
473
 
473
474
  def is_bus(self) -> bool:
474
475
  """
@@ -476,7 +477,7 @@ class Term:
476
477
  :rtype: bool
477
478
  """
478
479
  return isinstance(
479
- get_snl_term_for_ids(self.pathIDs, self.termIDs), snl.SNLBusTerm
480
+ get_snl_term_for_ids(self.pathIDs, self.termIDs), naja.SNLBusTerm
480
481
  )
481
482
 
482
483
  def is_bus_bit(self) -> bool:
@@ -485,7 +486,7 @@ class Term:
485
486
  :rtype: bool
486
487
  """
487
488
  return isinstance(
488
- get_snl_term_for_ids(self.pathIDs, self.termIDs), snl.SNLBusTermBit
489
+ get_snl_term_for_ids(self.pathIDs, self.termIDs), naja.SNLBusTermBit
489
490
  )
490
491
 
491
492
  def is_scalar(self) -> bool:
@@ -494,7 +495,7 @@ class Term:
494
495
  :rtype: bool
495
496
  """
496
497
  return isinstance(
497
- get_snl_term_for_ids(self.pathIDs, self.termIDs), snl.SNLScalarTerm
498
+ get_snl_term_for_ids(self.pathIDs, self.termIDs), naja.SNLScalarTerm
498
499
  )
499
500
 
500
501
  def is_bit(self) -> bool:
@@ -510,7 +511,7 @@ class Term:
510
511
  :rtype: int or None
511
512
  """
512
513
  if isinstance(
513
- get_snl_term_for_ids(self.pathIDs, self.termIDs), snl.SNLBusTermBit
514
+ get_snl_term_for_ids(self.pathIDs, self.termIDs), naja.SNLBusTermBit
514
515
  ):
515
516
  return get_snl_term_for_ids(self.pathIDs, self.termIDs).getBit()
516
517
  return None
@@ -520,7 +521,7 @@ class Term:
520
521
  :return: the most significant bit of the term if it is a bus.
521
522
  :rtype: int or None
522
523
  """
523
- if isinstance(get_snl_term_for_ids(self.pathIDs, self.termIDs), snl.SNLBusTerm):
524
+ if isinstance(get_snl_term_for_ids(self.pathIDs, self.termIDs), naja.SNLBusTerm):
524
525
  return get_snl_term_for_ids(self.pathIDs, self.termIDs).getMSB()
525
526
  return None
526
527
 
@@ -529,7 +530,7 @@ class Term:
529
530
  :return: the least significant bit of the term if it is a bus.
530
531
  :rtype: int or None
531
532
  """
532
- if isinstance(get_snl_term_for_ids(self.pathIDs, self.termIDs), snl.SNLBusTerm):
533
+ if isinstance(get_snl_term_for_ids(self.pathIDs, self.termIDs), naja.SNLBusTerm):
533
534
  return get_snl_term_for_ids(self.pathIDs, self.termIDs).getLSB()
534
535
  return None
535
536
 
@@ -547,17 +548,17 @@ class Term:
547
548
  """
548
549
  return get_snl_term_for_ids(self.pathIDs, self.termIDs).getName()
549
550
 
550
- def get_direction(self) -> snl.SNLTerm.Direction:
551
+ def get_direction(self) -> naja.SNLTerm.Direction:
551
552
  """
552
553
  :return: the direction of the term.
553
- :rtype: snl.SNLTerm.Direction
554
+ :rtype: naja.SNLTerm.Direction
554
555
  """
555
556
  snlterm = get_snl_term_for_ids(self.pathIDs, self.termIDs)
556
- if snlterm.getDirection() == snl.SNLTerm.Direction.Input:
557
+ if snlterm.getDirection() == naja.SNLTerm.Direction.Input:
557
558
  return Term.INPUT
558
- elif snlterm.getDirection() == snl.SNLTerm.Direction.Output:
559
+ elif snlterm.getDirection() == naja.SNLTerm.Direction.Output:
559
560
  return Term.OUTPUT
560
- elif snlterm.getDirection() == snl.SNLTerm.Direction.InOut:
561
+ elif snlterm.getDirection() == naja.SNLTerm.Direction.InOut:
561
562
  return Term.INOUT
562
563
 
563
564
  def __get_snl_bitnet(self, bit) -> Net:
@@ -572,13 +573,13 @@ class Term:
572
573
  def __get_snl_lower_bitnet(self, bit) -> Net:
573
574
  return bit.getNet()
574
575
 
575
- def __get_snl_busnet(self, snl_nets) -> snl.SNLBusNet:
576
+ def __get_snl_busnet(self, snl_nets) -> naja.SNLBusNet:
576
577
  # iterate on all elements of the list and check if
577
578
  # a full SNLBusNet can be reconstructed
578
579
  snl_bus_net = None
579
580
  for i in range(len(snl_nets)):
580
581
  snl_net = snl_nets[i]
581
- if not isinstance(snl_net, snl.SNLBusNetBit):
582
+ if not isinstance(snl_net, naja.SNLBusNetBit):
582
583
  return None
583
584
  bit_bus = snl_net.getBus()
584
585
  if bit_bus.getWidth() != len(snl_nets):
@@ -592,7 +593,7 @@ class Term:
592
593
  return snl_bus_net
593
594
 
594
595
  def __get_net(self, path, snl_term_net_accessor) -> Net:
595
- if isinstance(get_snl_term_for_ids(self.pathIDs, self.termIDs), snl.SNLBusTerm):
596
+ if isinstance(get_snl_term_for_ids(self.pathIDs, self.termIDs), naja.SNLBusTerm):
596
597
  snl_nets = []
597
598
  for bit in get_snl_term_for_ids(self.pathIDs, self.termIDs).getBits():
598
599
  snl_net = snl_term_net_accessor(bit)
@@ -649,7 +650,7 @@ class Term:
649
650
  :rtype: bool
650
651
  """
651
652
  snlterm = get_snl_term_for_ids(self.pathIDs, self.termIDs)
652
- return snlterm.getDirection() == snl.SNLTerm.Direction.Input
653
+ return snlterm.getDirection() == naja.SNLTerm.Direction.Input
653
654
 
654
655
  def is_output(self) -> bool:
655
656
  """
@@ -657,7 +658,7 @@ class Term:
657
658
  :rtype: bool
658
659
  """
659
660
  snlterm = get_snl_term_for_ids(self.pathIDs, self.termIDs)
660
- return snlterm.getDirection() == snl.SNLTerm.Direction.Output
661
+ return snlterm.getDirection() == naja.SNLTerm.Direction.Output
661
662
 
662
663
  def get_bits(self):
663
664
  """
@@ -665,7 +666,7 @@ class Term:
665
666
  If the term is scalar, it will return an iterator over itself.
666
667
  :rtype: Iterator[Term]
667
668
  """
668
- if isinstance(get_snl_term_for_ids(self.pathIDs, self.termIDs), snl.SNLBusTerm):
669
+ if isinstance(get_snl_term_for_ids(self.pathIDs, self.termIDs), naja.SNLBusTerm):
669
670
  for bit in get_snl_term_for_ids(self.pathIDs, self.termIDs).getBits():
670
671
  yield Term(self.pathIDs, bit)
671
672
  else:
@@ -677,7 +678,7 @@ class Term:
677
678
  :return: the Term bit at the given index or None if it does not exist.
678
679
  :rtype: Term or None
679
680
  """
680
- if isinstance(get_snl_term_for_ids(self.pathIDs, self.termIDs), snl.SNLBusTerm):
681
+ if isinstance(get_snl_term_for_ids(self.pathIDs, self.termIDs), naja.SNLBusTerm):
681
682
  return Term(
682
683
  self.pathIDs,
683
684
  get_snl_term_for_ids(self.pathIDs, self.termIDs).getBusTermBit(index),
@@ -721,27 +722,27 @@ class Term:
721
722
 
722
723
  def get_instance_by_path(names: list):
723
724
  assert len(names) > 0
724
- path = snl.SNLPath()
725
+ path = naja.SNLPath()
725
726
  instance = None
726
- top = snl.SNLUniverse.get().getTopDesign()
727
+ top = naja.NLUniverse.get().getTopDesign()
727
728
  design = top
728
729
  for name in names:
729
- path = snl.SNLPath(path, design.getInstance(name))
730
+ path = naja.SNLPath(path, design.getInstance(name))
730
731
  instance = design.getInstance(name)
731
732
  assert instance is not None
732
733
  design = instance.getModel()
733
734
  return Instance(path)
734
735
 
735
736
 
736
- # def refresh_path(path: snl.SNLPath):
737
+ # def refresh_path(path: naja.SNLPath):
737
738
  # pathlist = path.getPathIDs()
738
739
  # assert len(pathlist) > 0
739
- # path = snl.SNLPath()
740
+ # path = naja.SNLPath()
740
741
  # instance = None
741
- # top = snl.SNLUniverse.get().getTopDesign()
742
+ # top = naja.NLUniverse.get().getTopDesign()
742
743
  # design = top
743
744
  # for id in pathlist:
744
- # path = snl.SNLPath(path, design.getInstanceByID(id))
745
+ # path = naja.SNLPath(path, design.getInstanceByID(id))
745
746
  # instance = design.getInstanceByID(id)
746
747
  # assert instance is not None
747
748
  # design = instance.getModel()
@@ -782,11 +783,11 @@ class Instance:
782
783
  of the snl occurrence API.
783
784
  """
784
785
 
785
- def __init__(self, path=snl.SNLPath()):
786
+ def __init__(self, path=naja.SNLPath()):
786
787
  self.inst = None
787
788
  self.revisionCount = 0
788
789
  self.SNLID = [0, 0, 0, 0, 0, 0]
789
- if isinstance(path, snl.SNLPath):
790
+ if isinstance(path, naja.SNLPath):
790
791
  if path.size() > 0:
791
792
  self.pathIDs = path.getPathIDs()
792
793
  self.revisionCount = path.getTailInstance().getModel().getRevisionCount()
@@ -799,7 +800,7 @@ class Instance:
799
800
  self.inst = get_snl_instance_from_id_list(path)
800
801
  self.revisionCount = self.inst.getModel().getRevisionCount()
801
802
  if self.inst is not None:
802
- self.SNLID = self.inst.getModel().getSNLID()
803
+ self.SNLID = self.inst.getModel().getNLID()
803
804
 
804
805
  def __eq__(self, other) -> bool:
805
806
  return self.pathIDs == other.pathIDs
@@ -832,15 +833,15 @@ class Instance:
832
833
  initial_path = get_snl_path_from_id_list(self.pathIDs)
833
834
  for inst in self.__get_snl_model().getInstances():
834
835
  if inst.getModel().isLeaf():
835
- yield Instance(snl.SNLPath(initial_path, inst))
836
- path = snl.SNLPath(initial_path, inst)
836
+ yield Instance(naja.SNLPath(initial_path, inst))
837
+ path = naja.SNLPath(initial_path, inst)
837
838
  stack = [[inst, path]]
838
839
  while stack:
839
840
  current = stack.pop()
840
841
  current_inst = current[0]
841
842
  current_path = current[1]
842
843
  for inst_child in current_inst.getModel().getInstances():
843
- path_child = snl.SNLPath(current_path, inst_child)
844
+ path_child = naja.SNLPath(current_path, inst_child)
844
845
  if inst_child.getModel().isLeaf():
845
846
  yield Instance(path_child)
846
847
  stack.append([inst_child, path_child])
@@ -919,27 +920,27 @@ class Instance:
919
920
 
920
921
  def __get_snl_model(self):
921
922
  if self.is_top():
922
- return snl.SNLUniverse.get().getTopDesign()
923
+ return naja.NLUniverse.get().getTopDesign()
923
924
  if (
924
925
  self.inst.getModel().getRevisionCount() != self.revisionCount or
925
- self.inst.getModel().getSNLID() != self.SNLID
926
+ self.inst.getModel().getNLID() != self.SNLID
926
927
  ):
927
928
  self.inst = get_snl_instance_from_id_list(self.pathIDs)
928
929
  self.revisionCount = self.inst.getModel().getRevisionCount()
929
- self.SNLID = self.inst.getModel().getSNLID()
930
+ self.SNLID = self.inst.getModel().getNLID()
930
931
 
931
932
  return self.inst.getModel()
932
933
 
933
934
  def __get_leaf_snl_object(self):
934
935
  if self.is_top():
935
- return snl.SNLUniverse.get().getTopDesign()
936
+ return naja.NLUniverse.get().getTopDesign()
936
937
  return get_snl_instance_from_id_list(self.pathIDs)
937
938
 
938
- def __find_snl_model(self, name: str) -> snl.SNLDesign:
939
- u = snl.SNLUniverse.get()
939
+ def __find_snl_model(self, name: str) -> naja.SNLDesign:
940
+ u = naja.NLUniverse.get()
940
941
  for db in u.getUserDBs():
941
942
  for lib in db.getLibraries():
942
- found_model = lib.getDesign(name)
943
+ found_model = lib.getSNLDesign(name)
943
944
  if found_model is not None:
944
945
  return found_model
945
946
  return None
@@ -973,7 +974,7 @@ class Instance:
973
974
  """
974
975
  path = get_snl_path_from_id_list(self.pathIDs)
975
976
  for inst in self.__get_snl_model().getInstances():
976
- path_child = snl.SNLPath(path, inst)
977
+ path_child = naja.SNLPath(path, inst)
977
978
  yield Instance(path_child)
978
979
  # path.pop()
979
980
 
@@ -988,14 +989,14 @@ class Instance:
988
989
  # FIXME: concat first local path with the path of the instance
989
990
  # model = self.__get_snl_model()
990
991
  # for inst in model.getInstances():
991
- # path = snl.SNLPath(inst)
992
+ # path = naja.SNLPath(inst)
992
993
  # stack = [[inst, path]]
993
994
  # while stack:
994
995
  # current = stack.pop()
995
996
  # current_inst = current[0]
996
997
  # current_path = current[1]
997
998
  # for inst_child in current_inst.getModel().getInstances():
998
- # path_child = snl.SNLPath(current_path, inst_child)
999
+ # path_child = naja.SNLPath(current_path, inst_child)
999
1000
  # if inst_child.getModel().isPrimitive():
1000
1001
  # yield Instance(path_child)
1001
1002
  # stack.append([inst_child, path_child])
@@ -1009,6 +1010,14 @@ class Instance:
1009
1010
  for net in self.__get_snl_model().getNets():
1010
1011
  yield Net(self.pathIDs, net)
1011
1012
 
1013
+ def count_nets(self) -> int:
1014
+ """Count the number of scalar nets and bus nets of this Instance.
1015
+
1016
+ :return: the number of nets of this Instance.
1017
+ :rtype: int
1018
+ """
1019
+ return sum(1 for _ in self.get_nets())
1020
+
1012
1021
  def get_flat_nets(self):
1013
1022
  """Iterate over all scalar nets and bus net bits.
1014
1023
 
@@ -1016,12 +1025,20 @@ class Instance:
1016
1025
  :rtype: Iterator[Net]
1017
1026
  """
1018
1027
  for net in self.__get_snl_model().getNets():
1019
- if isinstance(net, snl.SNLBusNet):
1028
+ if isinstance(net, naja.SNLBusNet):
1020
1029
  for bit in net.getBits():
1021
1030
  yield Net(self.pathIDs, bit)
1022
1031
  else:
1023
1032
  yield Net(self.pathIDs, net)
1024
1033
 
1034
+ def count_flat_nets(self) -> int:
1035
+ """Count the number of scalar nets and bus net bits of this Instance.
1036
+
1037
+ :return: the number of flat nets of this Instance.
1038
+ :rtype: int
1039
+ """
1040
+ return sum(1 for _ in self.get_flat_nets())
1041
+
1025
1042
  def get_net(self, name: str) -> Net:
1026
1043
  """
1027
1044
  :param str name: the name of the Net to get.
@@ -1049,6 +1066,14 @@ class Instance:
1049
1066
  for term in self.__get_snl_model().getTerms():
1050
1067
  yield Term(self.pathIDs, term)
1051
1068
 
1069
+ def count_terms(self) -> int:
1070
+ """Count the number of scalar terms and bus terms of this Instance.
1071
+
1072
+ :return: the number of terms of this Instance.
1073
+ :rtype: int
1074
+ """
1075
+ return sum(1 for _ in self.get_terms())
1076
+
1052
1077
  def get_flat_terms(self):
1053
1078
  """Iterate over all scalar terms and bus term bits.
1054
1079
 
@@ -1058,6 +1083,14 @@ class Instance:
1058
1083
  for term in self.__get_snl_model().getBitTerms():
1059
1084
  yield Term(self.pathIDs, term)
1060
1085
 
1086
+ def count_flat_terms(self) -> int:
1087
+ """Count the number of scalar terms and bus term bits of this Instance.
1088
+
1089
+ :return: the number of flat terms of this Instance.
1090
+ :rtype: int
1091
+ """
1092
+ return sum(1 for _ in self.get_flat_terms())
1093
+
1061
1094
  def get_term(self, name: str) -> Term:
1062
1095
  """
1063
1096
  :param str name: the name of the Term to get.
@@ -1077,9 +1110,18 @@ class Instance:
1077
1110
  :rtype: Iterator[Term]
1078
1111
  """
1079
1112
  for term in self.__get_snl_model().getTerms():
1080
- if term.getDirection() != snl.SNLTerm.Direction.Output:
1113
+ if term.getDirection() != naja.SNLTerm.Direction.Output:
1081
1114
  yield Term(self.pathIDs, term)
1082
1115
 
1116
+ def count_input_terms(self) -> int:
1117
+ """Count the number of scalar input terms and bus input terms
1118
+ of this Instance.
1119
+
1120
+ :return: the number of input terms of this Instance.
1121
+ :rtype: int
1122
+ """
1123
+ return sum(1 for _ in self.get_input_terms())
1124
+
1083
1125
  def get_flat_input_terms(self):
1084
1126
  """Iterate over all scalar input terms and bus input term bits
1085
1127
  of this Instance.
@@ -1088,13 +1130,22 @@ class Instance:
1088
1130
  :rtype: Iterator[Term]
1089
1131
  """
1090
1132
  for term in self.__get_snl_model().getTerms():
1091
- if term.getDirection() != snl.SNLTerm.Direction.Output:
1092
- if isinstance(term, snl.SNLBusTerm):
1133
+ if term.getDirection() != naja.SNLTerm.Direction.Output:
1134
+ if isinstance(term, naja.SNLBusTerm):
1093
1135
  for bit in term.getBits():
1094
1136
  yield Term(self.pathIDs, bit)
1095
1137
  else:
1096
1138
  yield Term(self.pathIDs, term)
1097
1139
 
1140
+ def count_flat_input_terms(self) -> int:
1141
+ """Count the number of scalar input terms and bus input term bits
1142
+ of this Instance.
1143
+
1144
+ :return: the number of flat input terms of this Instance.
1145
+ :rtype: int
1146
+ """
1147
+ return sum(1 for _ in self.get_flat_input_terms())
1148
+
1098
1149
  def get_output_terms(self):
1099
1150
  """Iterate over all scalar output terms and bus output terms
1100
1151
  of this Instance.
@@ -1103,9 +1154,18 @@ class Instance:
1103
1154
  :rtype: Iterator[Term]
1104
1155
  """
1105
1156
  for term in self.__get_snl_model().getTerms():
1106
- if term.getDirection() != snl.SNLTerm.Direction.Input:
1157
+ if term.getDirection() != naja.SNLTerm.Direction.Input:
1107
1158
  yield Term(self.pathIDs, term)
1108
1159
 
1160
+ def count_output_terms(self) -> int:
1161
+ """Count the number of scalar output terms and bus output terms
1162
+ of this Instance.
1163
+
1164
+ :return: the number of output terms of this Instance.
1165
+ :rtype: int
1166
+ """
1167
+ return sum(1 for _ in self.get_output_terms())
1168
+
1109
1169
  def get_flat_output_terms(self):
1110
1170
  """Iterate over all scalar output terms and bus output term bits
1111
1171
  of this Instance.
@@ -1114,13 +1174,22 @@ class Instance:
1114
1174
  :rtype: Iterator[Term]
1115
1175
  """
1116
1176
  for term in self.__get_snl_model().getTerms():
1117
- if term.getDirection() != snl.SNLTerm.Direction.Input:
1118
- if isinstance(term, snl.SNLBusTerm):
1177
+ if term.getDirection() != naja.SNLTerm.Direction.Input:
1178
+ if isinstance(term, naja.SNLBusTerm):
1119
1179
  for bit in term.getBits():
1120
1180
  yield Term(self.pathIDs, bit)
1121
1181
  else:
1122
1182
  yield Term(self.pathIDs, term)
1123
1183
 
1184
+ def count_flat_output_terms(self) -> int:
1185
+ """Count the number of scalar output terms and bus output term bits
1186
+ of this Instance.
1187
+
1188
+ :return: the number of flat output terms of this Instance.
1189
+ :rtype: int
1190
+ """
1191
+ return sum(1 for _ in self.get_flat_output_terms())
1192
+
1124
1193
  def get_attributes(self):
1125
1194
  """Iterate over the attributes of this Instance.
1126
1195
 
@@ -1138,8 +1207,8 @@ class Instance:
1138
1207
  "Cannot delete instance with empty name. Try delete_instance_by_id instead."
1139
1208
  )
1140
1209
  init_path = get_snl_path_from_id_list(self.pathIDs)
1141
- path = snl.SNLPath(init_path, self.__get_snl_model().getInstance(name))
1142
- snl.SNLUniquifier(path)
1210
+ path = naja.SNLPath(init_path, self.__get_snl_model().getInstance(name))
1211
+ naja.SNLUniquifier(path)
1143
1212
  if init_path.size() > 0:
1144
1213
  # Delete the last instance in uniq_path
1145
1214
  self.__get_snl_model().getInstance(name).destroy()
@@ -1150,8 +1219,8 @@ class Instance:
1150
1219
  :param str id: the ID of the Instance to delete.
1151
1220
  """
1152
1221
  init_path = get_snl_path_from_id_list(self.pathIDs)
1153
- path = snl.SNLPath(init_path, self.__get_snl_model().getInstanceByID(id))
1154
- snl.SNLUniquifier(path)
1222
+ path = naja.SNLPath(init_path, self.__get_snl_model().getInstanceByID(id))
1223
+ naja.SNLUniquifier(path)
1155
1224
  # Delete the last instance in uniq_path
1156
1225
  self.__get_snl_model().getInstanceByID(id).destroy()
1157
1226
 
@@ -1169,7 +1238,7 @@ class Instance:
1169
1238
  def delete(self):
1170
1239
  """Delete this instance."""
1171
1240
  path = get_snl_path_from_id_list(self.pathIDs)
1172
- snl.SNLUniquifier(path)
1241
+ naja.SNLUniquifier(path)
1173
1242
  self.get_design().delete_instance_by_id(path.getTailInstance().getID())
1174
1243
 
1175
1244
  def get_name(self) -> str:
@@ -1209,7 +1278,7 @@ class Instance:
1209
1278
  """
1210
1279
  path = get_snl_path_from_id_list(self.pathIDs)
1211
1280
  if path.size() > 0:
1212
- snl.SNLUniquifier(path)
1281
+ naja.SNLUniquifier(path)
1213
1282
  path = get_snl_path_from_id_list(self.pathIDs)
1214
1283
  design = self.__get_snl_model()
1215
1284
  new_instance_model = self.__find_snl_model(model)
@@ -1217,23 +1286,23 @@ class Instance:
1217
1286
  raise ValueError(
1218
1287
  f"Cannot create instance {name} in {self}: model {model} cannot be found"
1219
1288
  )
1220
- newSNLInstance = snl.SNLInstance.create(design, new_instance_model, name)
1221
- path = snl.SNLPath(path, newSNLInstance)
1289
+ newSNLInstance = naja.SNLInstance.create(design, new_instance_model, name)
1290
+ path = naja.SNLPath(path, newSNLInstance)
1222
1291
  return Instance(path)
1223
1292
 
1224
- def create_term(self, name: str, direction: snl.SNLTerm.Direction) -> Term:
1293
+ def create_term(self, name: str, direction: naja.SNLTerm.Direction) -> Term:
1225
1294
  """Create a Term in this Instance with the given name and direction.
1226
1295
 
1227
1296
  :param str name: the name of the Term to create.
1228
- :param snl.SNLTerm.Direction direction: the direction of the Term to create.
1297
+ :param naja.SNLTerm.Direction direction: the direction of the Term to create.
1229
1298
  :return: the created Term.
1230
1299
  """
1231
1300
  path = get_snl_path_from_id_list(self.pathIDs)
1232
1301
  if path.size() > 0:
1233
- snl.SNLUniquifier(path)
1302
+ naja.SNLUniquifier(path)
1234
1303
  path = get_snl_path_from_id_list(self.pathIDs)
1235
1304
  design = self.__get_snl_model()
1236
- newSNLTerm = snl.SNLScalarTerm.create(design, direction, name)
1305
+ newSNLTerm = naja.SNLScalarTerm.create(design, direction, name)
1237
1306
  return Term(path.getPathIDs(), newSNLTerm)
1238
1307
 
1239
1308
  def create_output_term(self, name: str) -> Term:
@@ -1243,7 +1312,7 @@ class Instance:
1243
1312
  :return: the created Term.
1244
1313
  :rtype: Term
1245
1314
  """
1246
- return self.create_term(name, snl.SNLTerm.Direction.Output)
1315
+ return self.create_term(name, naja.SNLTerm.Direction.Output)
1247
1316
 
1248
1317
  def create_input_term(self, name: str) -> Term:
1249
1318
  """Create an input Term in this Instance with the given name.
@@ -1252,7 +1321,7 @@ class Instance:
1252
1321
  :return: the created Term.
1253
1322
  :rtype: Term
1254
1323
  """
1255
- return self.create_term(name, snl.SNLTerm.Direction.Input)
1324
+ return self.create_term(name, naja.SNLTerm.Direction.Input)
1256
1325
 
1257
1326
  def create_inout_term(self, name: str) -> Term:
1258
1327
  """Create an inout Term in this Instance with the given name.
@@ -1261,7 +1330,7 @@ class Instance:
1261
1330
  :return: the created Term.
1262
1331
  :rtype: Term
1263
1332
  """
1264
- return self.create_term(name, snl.SNLTerm.Direction.InOut)
1333
+ return self.create_term(name, naja.SNLTerm.Direction.InOut)
1265
1334
 
1266
1335
  def create_bus_term(self, name: str, msb: int, lsb: int, direction) -> Term:
1267
1336
  """Create a bus Term in this Instance with the given name, msb, lsb and direction.
@@ -1269,14 +1338,14 @@ class Instance:
1269
1338
  :param str name: the name of the Term to create.
1270
1339
  :param int msb: the most significant bit of the Term to create.
1271
1340
  :param int lsb: the least significant bit of the Term to create.
1272
- :param snl.SNLTerm.Direction direction: the direction of the Term to create.
1341
+ :param naja.SNLTerm.Direction direction: the direction of the Term to create.
1273
1342
  :return: the created Term.
1274
1343
  """
1275
1344
  path = get_snl_path_from_id_list(self.pathIDs)
1276
1345
  if path.size() > 0:
1277
- snl.SNLUniquifier(path)
1346
+ naja.SNLUniquifier(path)
1278
1347
  design = self.__get_snl_model()
1279
- newSNLTerm = snl.SNLBusTerm.create(design, direction, msb, lsb, name)
1348
+ newSNLTerm = naja.SNLBusTerm.create(design, direction, msb, lsb, name)
1280
1349
  return Term(self.pathIDs, newSNLTerm)
1281
1350
 
1282
1351
  def create_inout_bus_term(self, name: str, msb: int, lsb: int) -> Term:
@@ -1288,7 +1357,7 @@ class Instance:
1288
1357
  :return: the created Term.
1289
1358
  :rtype: Term
1290
1359
  """
1291
- return self.create_bus_term(name, msb, lsb, snl.SNLTerm.Direction.InOut)
1360
+ return self.create_bus_term(name, msb, lsb, naja.SNLTerm.Direction.InOut)
1292
1361
 
1293
1362
  def create_output_bus_term(self, name: str, msb: int, lsb: int) -> Term:
1294
1363
  """Create an output bus Term in this Instance with the given name, msb and lsb.
@@ -1299,7 +1368,7 @@ class Instance:
1299
1368
  :return: the created Term.
1300
1369
  :rtype: Term
1301
1370
  """
1302
- return self.create_bus_term(name, msb, lsb, snl.SNLTerm.Direction.Output)
1371
+ return self.create_bus_term(name, msb, lsb, naja.SNLTerm.Direction.Output)
1303
1372
 
1304
1373
  def create_input_bus_term(self, name: str, msb: int, lsb: int) -> Term:
1305
1374
  """Create an input bus Term in this Instance with the given name, msb and lsb.
@@ -1310,7 +1379,7 @@ class Instance:
1310
1379
  :return: the created Term.
1311
1380
  :rtype: Term
1312
1381
  """
1313
- return self.create_bus_term(name, msb, lsb, snl.SNLTerm.Direction.Input)
1382
+ return self.create_bus_term(name, msb, lsb, naja.SNLTerm.Direction.Input)
1314
1383
 
1315
1384
  def create_net(self, name: str) -> Net:
1316
1385
  """Create a scalar Net in this Instance with the given name.
@@ -1321,10 +1390,10 @@ class Instance:
1321
1390
  """
1322
1391
  path = get_snl_path_from_id_list(self.pathIDs)
1323
1392
  if path.size() > 0:
1324
- snl.SNLUniquifier(path)
1393
+ naja.SNLUniquifier(path)
1325
1394
  path = get_snl_path_from_id_list(self.pathIDs)
1326
1395
  model = self.__get_snl_model()
1327
- newSNLNet = snl.SNLScalarNet.create(model, name)
1396
+ newSNLNet = naja.SNLScalarNet.create(model, name)
1328
1397
  return Net(path, newSNLNet)
1329
1398
 
1330
1399
  def create_bus_net(self, name: str, msb: int, lsb: int) -> Net:
@@ -1338,10 +1407,10 @@ class Instance:
1338
1407
  """
1339
1408
  path = get_snl_path_from_id_list(self.pathIDs)
1340
1409
  if path.size() > 0:
1341
- snl.SNLUniquifier(path)
1410
+ naja.SNLUniquifier(path)
1342
1411
  path = get_snl_path_from_id_list(self.pathIDs)
1343
1412
  model = self.__get_snl_model()
1344
- newSNLNet = snl.SNLBusNet.create(model, msb, lsb, name)
1413
+ newSNLNet = naja.SNLBusNet.create(model, msb, lsb, name)
1345
1414
  return Net(path, newSNLNet)
1346
1415
 
1347
1416
  def dump_verilog(self, path: str, name: str):
@@ -1360,13 +1429,13 @@ class Instance:
1360
1429
  return self.__get_snl_model().getTruthTable()
1361
1430
 
1362
1431
 
1363
- def get_top_db() -> snl.SNLDB:
1364
- if snl.SNLUniverse.get() is None:
1365
- snl.SNLUniverse.create()
1366
- if snl.SNLUniverse.get().getTopDB() is None:
1367
- db = snl.SNLDB.create(snl.SNLUniverse.get())
1368
- snl.SNLUniverse.get().setTopDB(db)
1369
- return snl.SNLUniverse.get().getTopDB()
1432
+ def __get_top_db() -> naja.NLDB:
1433
+ if naja.NLUniverse.get() is None:
1434
+ naja.NLUniverse.create()
1435
+ if naja.NLUniverse.get().getTopDB() is None:
1436
+ db = naja.NLDB.create(naja.NLUniverse.get())
1437
+ naja.NLUniverse.get().setTopDB(db)
1438
+ return naja.NLUniverse.get().getTopDB()
1370
1439
 
1371
1440
 
1372
1441
  def get_top():
@@ -1374,7 +1443,7 @@ def get_top():
1374
1443
  :return: the top Instance.
1375
1444
  :rtype: Instance
1376
1445
  """
1377
- return Instance(snl.SNLPath())
1446
+ return Instance(naja.SNLPath())
1378
1447
 
1379
1448
 
1380
1449
  def create_top(name: str) -> Instance:
@@ -1385,11 +1454,11 @@ def create_top(name: str) -> Instance:
1385
1454
  :rtype: Instance
1386
1455
  """
1387
1456
  # init
1388
- db = get_top_db()
1457
+ db = __get_top_db()
1389
1458
  # create top design
1390
- lib = snl.SNLLibrary.create(db)
1391
- top = snl.SNLDesign.create(lib, name)
1392
- snl.SNLUniverse.get().setTopDesign(top)
1459
+ lib = naja.NLLibrary.create(db)
1460
+ top = naja.SNLDesign.create(lib, name)
1461
+ naja.NLUniverse.get().setTopDesign(top)
1393
1462
  return Instance()
1394
1463
 
1395
1464
 
@@ -1399,11 +1468,13 @@ class VerilogConfig:
1399
1468
 
1400
1469
 
1401
1470
  def load_verilog(files: list, config: VerilogConfig = None) -> Instance:
1471
+ if not files or len(files) == 0:
1472
+ raise Exception("No verilog files provided")
1402
1473
  if config is None:
1403
1474
  config = VerilogConfig() # Use default settings
1404
1475
  start_time = time.time()
1405
1476
  logging.info(f"Loading verilog: {', '.join(files)}")
1406
- get_top_db().loadVerilog(files, keep_assigns=config.keep_assigns)
1477
+ __get_top_db().loadVerilog(files, keep_assigns=config.keep_assigns)
1407
1478
  execution_time = time.time() - start_time
1408
1479
  logging.info(f"Loading done in {execution_time:.2f} seconds")
1409
1480
  return get_top()
@@ -1411,7 +1482,7 @@ def load_verilog(files: list, config: VerilogConfig = None) -> Instance:
1411
1482
 
1412
1483
  def load_liberty(files: list):
1413
1484
  logging.info(f"Loading liberty files: {', '.join(files)}")
1414
- get_top_db().loadLibertyPrimitives(files)
1485
+ __get_top_db().loadLibertyPrimitives(files)
1415
1486
 
1416
1487
 
1417
1488
  def load_primitives(name: str):
@@ -1422,18 +1493,39 @@ def load_primitives(name: str):
1422
1493
  - xilinx
1423
1494
  """
1424
1495
  if name == "xilinx":
1425
- logging.info("Loading xilinx primitives")
1426
1496
  from najaeda.primitives import xilinx
1427
1497
 
1428
- xilinx.load(get_top_db())
1498
+ xilinx.load(__get_top_db())
1429
1499
  else:
1430
1500
  raise ValueError(f"Unknown primitives library: {name}")
1431
1501
 
1432
1502
 
1433
- def get_primitives_library() -> snl.SNLLibrary:
1434
- lib = get_top_db().getLibrary("PRIMS")
1503
+ def load_primitives_from_file(file: str):
1504
+ """Loads a primitives library from a file.
1505
+
1506
+ :param str file: the path to the primitives library file.
1507
+ The file must define a function `load(db)`.
1508
+ """
1509
+ logging.info(f"Loading primitives from file: {file}")
1510
+ if not os.path.isfile(file):
1511
+ raise FileNotFoundError(f"Cannot load primitives from non existing file: {file}")
1512
+ import importlib.util
1513
+ spec = importlib.util.spec_from_file_location("user_module", file)
1514
+ module = importlib.util.module_from_spec(spec)
1515
+ sys.modules["user_module"] = module
1516
+ spec.loader.exec_module(module)
1517
+
1518
+ if not hasattr(module, "load"):
1519
+ raise RuntimeError(f"The file {file} must define a function named `load(db)`")
1520
+
1521
+ db = __get_top_db()
1522
+ module.load(db)
1523
+
1524
+
1525
+ def get_primitives_library() -> naja.NLLibrary:
1526
+ lib = __get_top_db().getLibrary("PRIMS")
1435
1527
  if lib is None:
1436
- lib = snl.SNLLibrary.createPrimitives(get_top_db(), "PRIMS")
1528
+ lib = naja.NLLibrary.createPrimitives(__get_top_db(), "PRIMS")
1437
1529
  return lib
1438
1530
 
1439
1531
 
@@ -1443,13 +1535,27 @@ def get_model_name(id: tuple[int, int, int]) -> str:
1443
1535
  :return: the name of the model given its id or None if it does not exist.
1444
1536
  :rtype: str or None
1445
1537
  """
1446
- u = snl.SNLUniverse.get()
1538
+ u = naja.NLUniverse.get()
1447
1539
  if u:
1448
1540
  db = u.getDB(id[0])
1449
1541
  if db:
1450
1542
  lib = db.getLibrary(id[1])
1451
1543
  if lib:
1452
- model = lib.getDesign(id[2])
1544
+ model = lib.getSNLDesign(id[2])
1453
1545
  if model:
1454
1546
  return model.getName()
1455
1547
  return None
1548
+
1549
+
1550
+ def apply_dle():
1551
+ """Apply the DLE (Dead Logic Elimination) to the top design."""
1552
+ top = naja.NLUniverse.get().getTopDesign()
1553
+ if top is not None:
1554
+ naja.NLUniverse.get().applyDLE()
1555
+
1556
+
1557
+ def apply_constant_propagation():
1558
+ """Apply constant propagation to the top design."""
1559
+ top = naja.NLUniverse.get().getTopDesign()
1560
+ if top is not None:
1561
+ naja.NLUniverse.get().applyConstantPropagation()