vpr/src/pack/cluster.cpp
/* Revert trial atom block iblock and free up memory space accordingly
 */
Revert trial atom block iblock and free up memory space accordingly
Revert trial atom block iblock and free up memory space accordingly
static void revert_place_atom_block(const AtomBlockId blk_id, t_lb_router_data* router_data, const std::multimap<AtomBlockId, t_pack_molecule*>& atom_molecules) {
    auto& atom_ctx = g_vpr_ctx.mutable_atom();
    In general most code works fine accessing cosnt t_pb*,
    which is why we store them as such in atom_ctx.lookup
    t_pb* pb = const_cast<t_pb*>(atom_ctx.lookup.atom_pb(blk_id));
    Update the atom netlist mapping
    atom_ctx.lookup.set_atom_clb(blk_id, ClusterBlockId::INVALID());
    atom_ctx.lookup.set_atom_pb(blk_id, nullptr);
    if (pb != nullptr) {
        t_pb* next = pb->parent_pb;
        revalid_molecules(pb, atom_molecules);
        free_pb(pb);
        pb = next;
        while (pb != nullptr) {
            next = pb->parent_pb;
            if (pb->child_pbs != nullptr && pb->pb_stats != nullptr
                && pb->pb_stats->num_child_blocks_in_pb == 0) {
                set_reset_pb_modes(router_data, pb, false);
                if (next != nullptr) {
                    revalid_molecules(pb, atom_molecules);
                    free_pb(pb);
                }
            }
            pb = next;
        }
    }
}
static void revert_place_atom_block ( const AtomBlockId blk_id , t_lb_router_data * router_data , const std :: multimap < AtomBlockId , t_pack_molecule * > & atom_molecules ) { auto & atom_ctx = g_vpr_ctx . mutable_atom ( ) ; t_pb * pb = const_cast < t_pb * > ( atom_ctx . lookup . atom_pb ( blk_id ) ) ; atom_ctx . lookup . set_atom_clb ( blk_id , ClusterBlockId :: INVALID ( ) ) ; atom_ctx . lookup . set_atom_pb ( blk_id , nullptr ) ; if ( pb != nullptr ) { t_pb * next = pb -> parent_pb ; revalid_molecules ( pb , atom_molecules ) ; free_pb ( pb ) ; pb = next ; while ( pb != nullptr ) { next = pb -> parent_pb ; if ( pb -> child_pbs != nullptr && pb -> pb_stats != nullptr && pb -> pb_stats -> num_child_blocks_in_pb == 0 ) { set_reset_pb_modes ( router_data , pb , false ) ; if ( next != nullptr ) { revalid_molecules ( pb , atom_molecules ) ; free_pb ( pb ) ; } } pb = next ; } } }
Revert trial atom block iblock and free up memory space accordingly
Revert trial atom block iblock and free up memory space accordingly
//We cast away const here since we may free the pb, and it is //being removed from the active mapping. // //In general most code works fine accessing cosnt t_pb*, //which is why we store them as such in atom_ctx.lookup //Update the atom netlist mapping /* When freeing molecules, the current block might already have been freed by a prior revert
         * When this happens, no need to do anything beyond basic book keeping at the atom block
         */ /* If this is pb is created only for the purposes of holding new molecule, remove it
             * Must check if cluster is already freed (which can be the case)
             */ /* If the code gets here, then that means that placing the initial seed molecule
                     * failed, don't free the actual complex block itself as the seed needs to find
                     * another placement */