本文整理汇总了Python中group.Group.add_block方法的典型用法代码示例。如果您正苦于以下问题:Python Group.add_block方法的具体用法?Python Group.add_block怎么用?Python Group.add_block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group.Group
的用法示例。
在下文中一共展示了Group.add_block方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_groups
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import add_block [as 别名]
def create_groups(forceOptimizer, debug=False):
'''
DESCRIPTION: Create the groups and add them to the list: groups
STATE: finish
'''
if debug:
print ""
print "============="
print "Create Groups"
print "============="
print ""
#go through all blocks in circuit
for block in forceOptimizer.blocks:
group_id = block.groups # the lowest group get all IDs
if debug:
pins = ""
for p in block.pins.values():
pins += " " + p.net
print "Block: ", block.name, " Group ID", group_id, "Pins:", pins
group = search_group(group_id,forceOptimizer) # check if the group allready exists
if group is None: # create a new group if needed
if debug:
print ("Create a new Group with ID", group_id)
group = Group(group_id)
forceOptimizer.groups.append(group)
if block.name.startswith('i'):
group.block_north.add(block);
group.block_west.add(block)
#add the block to the low level group
group.add_block(block)
#if group has parents create them
if len(group.group_id) > 1:
create_parent(group, forceOptimizer, debug)
#else add group to main group
else:
forceOptimizer.group_main.add_child(group)
group.parent = forceOptimizer.group_main
示例2: create_groups
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import add_block [as 别名]
def create_groups(forceOptimizer, debug=False):
"""
DESCRIPTION: Create the groups and add them to the list: groups
STATE: finish
"""
if debug:
print ""
print "============="
print "Create Groups"
print "============="
print ""
# go through all blocks in circuit
for block in forceOptimizer.blocks:
group_id = block.groups # the lowest group get all IDs
pins = ""
for p in block.pins.values():
pins += " " + p.net
if debug:
print "Block: ", block.name, " Group ID", group_id, "Pins:", pins
group = search_group(group_id, forceOptimizer) # check if the group allready exists
if group is None: # create a new group if needed
if debug:
print ("Create a new Group with ID", group_id)
group = Group(group_id)
forceOptimizer.groups.append(group)
if block.name.startswith("i"):
group.block_north.add(block)
group.block_west.add(block)
# check the connection to important pins
for p in block.pins.values():
for pin in forceOptimizer.pins_south:
if p.net.lower().startswith(pin):
group.connected_gnd += 1
group.block_south.add(block)
for pin in forceOptimizer.pins_north:
if p.net.lower().startswith(pin):
group.connected_vcc += 1
group.block_north.add(block)
for pin in forceOptimizer.pins_east:
if p.net.lower().startswith(pin):
group.connected_out += 1
group.block_east.add(block)
for pin in forceOptimizer.pins_west:
if p.net.lower().startswith(pin):
group.block_west.add(block)
if p.net.lower().startswith("in"):
group.connected_inp
if group.connected_out > 0:
group.connected_parent_east += group.connected_out
if group.connected_gnd > 0:
group.connected_parent_south += group.connected_gnd
if group.connected_vcc > 0:
group.connected_parent_north += group.connected_vcc
# add the block to the low level group
group.add_block(block)
# if group has parents create them
if len(group_id) > 1:
create_parent(group, forceOptimizer, debug)
# else add group to main group
else:
forceOptimizer.group_main.add_child(group)
group.parent = forceOptimizer.group_main