Skip to content

Commit

Permalink
Merge pull request #146 from nanocoh/main
Browse files Browse the repository at this point in the history
update py netlist api
  • Loading branch information
nanocoh authored Nov 15, 2024
2 parents a56d53f + eccb67a commit 4d19ca1
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/snl/python/netlist/netlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ def getTopTerms(self):
for term in self.equi.getBitTermOccurrences():
topTerms.append(TopTerm(term.getPath(), term.getBitTerm()))
return topTerms

def getAllLeafReaders(self):
readers = []
for term in self.equi.getInstTermOccurrences():
if term.getInstTerm().getDirection() == snl.SNLTerm.Direction.Output:
readers.append(InstTerm(term.getPath(), term.getInstTerm()))
return readers

class Net:
def __init__(self, path, net):
Expand Down Expand Up @@ -85,7 +92,7 @@ def getInstance(self):
return Instance(path, inst)

def getFlatFanout(self):
return self.inst.getInstTerms().getFlatFanout()
return self.getEuiqpotential().getAllLeafReaders()

def getEuiqpotential(self):
return Equipotential(self)
Expand Down Expand Up @@ -164,6 +171,13 @@ def getTopTerms(self):
def isPrimitive(self):
return self.inst.getModel().isPrimitive()

def getOutputInstTerms(self):
terms = []
for term in self.inst.getInstTerms():
if term.getDirection() == snl.SNLTerm.Direction.Output:
terms.append(InstTerm(self.path.getHeadPath(), term))
return terms

class Loader:

def __init__(self):
Expand Down Expand Up @@ -197,7 +211,7 @@ def verify(self):
else:
logging.info('Found top design ' + str(top))

def getAllPrimitivesInstances():
def getAllPrimitiveInstances():
top = snl.SNLUniverse.get().getTopDesign()
primitives = []

Expand All @@ -213,7 +227,4 @@ def getAllPrimitivesInstances():
if instChild.getModel().isPrimitive():
primitives.append(Instance(pathChild, instChild))
stack.append([instChild, pathChild])
return primitives



return primitives

0 comments on commit 4d19ca1

Please sign in to comment.