Example #1
0
def bddToBlif(rootNode):
	stringOutput = ''
	arrayOnSetAll = flatten_tuple(getAllOnPaths(getHeight(rootNode), rootNode, ''))
	arrayOnSetAll = filter (lambda x: x!=None, arrayOnSetAll)			# remove all None entries	

	# converting array to blif string format
	for minterm in arrayOnSetAll[:-1]:
		stringOutput += minterm + " 1" + '\n'
	stringOutput += arrayOnSetAll[-1] + " 1"					# last line without newline at the end
	return stringOutput 
Example #2
0
def getOnPathsPartialTree(rootNode, selectionBit, partialTreeHeight):
	# returns an array of all ways for the rootNode which met a One-Node at selectionBit. e.g. ['111','010'] or [], if treeHeight=0 or no on-path is available
	arrayOnSetAll = getAllOnPathsPartialTree(selectionBit, partialTreeHeight, rootNode)

	# catch some exceptions here
	if (arrayOnSetAll == '' or arrayOnSetAll == None):
		return []
	elif (type(arrayOnSetAll) == str):
		arrayOnSetAll = [arrayOnSetAll]
	else:
		arrayOnSetAll = bas.flatten_tuple(arrayOnSetAll)			# flatten the tuple structure
	arrayOnSetAll = filter (lambda x: x!=None, arrayOnSetAll)			# remove all None entries	

	return arrayOnSetAll