vpr/src/pack/cluster.cpp
/* TODO: May want to check that all atom blocks are actually reached */
May want to check that all atom blocks are actually reached
May want to check that all atom blocks are actually reached
static void check_cluster_atom_blocks(t_pb* pb, std::unordered_set<AtomBlockId>& blocks_checked) {
    int i, j;
    const t_pb_type* pb_type;
    bool has_child = false;
    auto& atom_ctx = g_vpr_ctx.atom();
    pb_type = pb->pb_graph_node->pb_type;
    if (pb_type->num_modes == 0) {
        auto blk_id = atom_ctx.lookup.pb_atom(pb);
        if (blk_id) {
            if (blocks_checked.count(blk_id)) {
                VPR_FATAL_ERROR(VPR_ERROR_PACK,
                                "pb %s contains atom block %s but atom block is already contained in another pb.\n",
                                pb->name, atom_ctx.nlist.block_name(blk_id).c_str());
            }
            blocks_checked.insert(blk_id);
            if (pb != atom_ctx.lookup.atom_pb(blk_id)) {
                VPR_FATAL_ERROR(VPR_ERROR_PACK,
                                "pb %s contains atom block %s but atom block does not link to pb.\n",
                                pb->name, atom_ctx.nlist.block_name(blk_id).c_str());
            }
        }
    } else {
        for (i = 0; i < pb_type->modes[pb->mode].num_pb_type_children; i++) {
            for (j = 0; j < pb_type->modes[pb->mode].pb_type_children[i].num_pb; j++) {
                if (pb->child_pbs[i] != nullptr) {
                    if (pb->child_pbs[i][j].name != nullptr) {
                        has_child = true;
                        check_cluster_atom_blocks(&pb->child_pbs[i][j], blocks_checked);
                    }
                }
            }
        }
        VTR_ASSERT(has_child);
    }
}
static void check_cluster_atom_blocks ( t_pb * pb , std :: unordered_set < AtomBlockId > & blocks_checked ) { int i , j ; const t_pb_type * pb_type ; bool has_child = false ; auto & atom_ctx = g_vpr_ctx . atom ( ) ; pb_type = pb -> pb_graph_node -> pb_type ; if ( pb_type -> num_modes == 0 ) { auto blk_id = atom_ctx . lookup . pb_atom ( pb ) ; if ( blk_id ) { if ( blocks_checked . count ( blk_id ) ) { VPR_FATAL_ERROR ( VPR_ERROR_PACK , " \n " , pb -> name , atom_ctx . nlist . block_name ( blk_id ) . c_str ( ) ) ; } blocks_checked . insert ( blk_id ) ; if ( pb != atom_ctx . lookup . atom_pb ( blk_id ) ) { VPR_FATAL_ERROR ( VPR_ERROR_PACK , " \n " , pb -> name , atom_ctx . nlist . block_name ( blk_id ) . c_str ( ) ) ; } } } else { for ( i = 0 ; i < pb_type -> modes [ pb -> mode ] . num_pb_type_children ; i ++ ) { for ( j = 0 ; j < pb_type -> modes [ pb -> mode ] . pb_type_children [ i ] . num_pb ; j ++ ) { if ( pb -> child_pbs [ i ] != nullptr ) { if ( pb -> child_pbs [ i ] [ j ] . name != nullptr ) { has_child = true ; check_cluster_atom_blocks ( & pb -> child_pbs [ i ] [ j ] , blocks_checked ) ; } } } } VTR_ASSERT ( has_child ) ; } }
TODO: May want to check that all atom blocks are actually reached
TODO : May want to check that all atom blocks are actually reached
/* primitive */ /* this is a container pb, all container pbs must contain children */