Exemple #1
0
def update_distribution(circuit: Circuit, data: Data):
    """
    update the distribution for each net
    """
    for net in circuit.nets:
        data.reset_net_distribution(net)
        for cell in net.cells:
            block_id = data.get_node_block_id(cell)
            data.inc_net_distribution(net, block_id)
Exemple #2
0
def move_node_another_block(cell: Cell, data: Data):
    """
    move the max gain node to another block
    """
    F = data.get_node_block_id(cell)  # from block id
    T = (F + 1) % 2  # to block id

    # lock the node
    data.lock_node(cell, T)

    for net in cell.nets:
        # check critical nets before the move
        if data.get_net_distribution(net, T) == 0:
            for nei in net.cells:
                if data.is_node_unlocked(nei):
                    data.update_node_gain(nei, 1)
        elif data.get_net_distribution(net, T) == 1:
            for nei in net.cells:
                if data.is_node_unlocked(nei) and data.get_node_block_id(
                        nei) == T:
                    data.update_node_gain(nei, -1)

        # change the net distribution to reflect the move
        data.dec_net_distribution(net, F)
        data.inc_net_distribution(net, T)

        # check the critical nets after the move
        if data.get_net_distribution(net, F) == 0:
            for nei in net.cells:
                if data.is_node_unlocked(nei):
                    data.update_node_gain(nei, -1)
        elif data.get_net_distribution(net, F) == 1:
            for nei in net.cells:
                if data.is_node_unlocked(nei) and data.get_node_block_id(
                        nei) == F:
                    data.update_node_gain(nei, 1)

    data.update_cutsize_by_gain(cell)