当前位置: 首页>>代码示例>>Python>>正文


Python Group.add_block方法代码示例

本文整理汇总了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
开发者ID:daringer,项目名称:schemmaker,代码行数:51,代码来源:build_step.py

示例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
开发者ID:ChristianOAuth,项目名称:schemmaker,代码行数:78,代码来源:build_step.py


注:本文中的group.Group.add_block方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。