vpr/src/base/read_route.cpp
/*This function goes through all the blocks in a global net and verify it with the
 * clustered netlist and the placement */
This function goes through all the blocks in a global net and verify it with the
clustered netlist and the placement
This function goes through all the blocks in a global net and verify it with the clustered netlist and the placement
static void process_global_blocks(std::ifstream& fp, ClusterNetId inet, const char* filename, int& lineno) {
    auto& cluster_ctx = g_vpr_ctx.mutable_clustering();
    auto& place_ctx = g_vpr_ctx.placement();
    std::string block, bnum_str;
    int x, y;
    std::vector<std::string> tokens;
    int pin_counter = 0;
    std::streampos oldpos = fp.tellg();
    while (std::getline(fp, block)) {
        ++lineno;
        tokens.clear();
        tokens = vtr::split(block);
        if (tokens.empty()) {
            continue; 
        } else if (tokens[0][0] == '#') {
            continue; 
        } else if (tokens[0] != "Block") {
            fp.seekg(oldpos);
            return;
        } else {
            format_coordinates(x, y, tokens[4], inet, filename, lineno);
            bnum_str = format_name(tokens[2]);
            bnum_str.erase(bnum_str.begin());
            ClusterBlockId bnum(atoi(bnum_str.c_str()));
            if (0 != cluster_ctx.clb_nlist.block_name(bnum).compare(tokens[1])) {
                vpr_throw(VPR_ERROR_ROUTE, filename, lineno,
                          "Block %s for block number %lu specified in the routing file does not match given %s",
                          tokens[1].c_str(), size_t(bnum), cluster_ctx.clb_nlist.block_name(bnum).c_str());
            }
            if (place_ctx.block_locs[bnum].loc.x != x || place_ctx.block_locs[bnum].loc.y != y) {
                vpr_throw(VPR_ERROR_ROUTE, filename, lineno,
                          "The placement coordinates (%d, %d) of %d block does not match given (%d, %d)",
                          x, y, place_ctx.block_locs[bnum].loc.x, place_ctx.block_locs[bnum].loc.y);
            }
            int pin_index = net_pin_to_tile_pin_index(inet, pin_counter);
            if (physical_tile_type(bnum)->pin_class[pin_index] != atoi(tokens[7].c_str())) {
                vpr_throw(VPR_ERROR_ROUTE, filename, lineno,
                          "The pin class %d of %lu net does not match given ",
                          atoi(tokens[7].c_str()), size_t(inet), physical_tile_type(bnum)->pin_class[pin_index]);
            }
            pin_counter++;
        }
        oldpos = fp.tellg();
    }
}
static void process_global_blocks ( std :: ifstream & fp , ClusterNetId inet , const char * filename , int & lineno ) { auto & cluster_ctx = g_vpr_ctx . mutable_clustering ( ) ; auto & place_ctx = g_vpr_ctx . placement ( ) ; std :: string block , bnum_str ; int x , y ; std :: vector < std :: string > tokens ; int pin_counter = 0 ; std :: streampos oldpos = fp . tellg ( ) ; while ( std :: getline ( fp , block ) ) { ++ lineno ; tokens . clear ( ) ; tokens = vtr :: split ( block ) ; if ( tokens . empty ( ) ) { continue ; } else if ( tokens [ 0 ] [ 0 ] == ' ' ) { continue ; } else if ( tokens [ 0 ] != " " ) { fp . seekg ( oldpos ) ; return ; } else { format_coordinates ( x , y , tokens [ 4 ] , inet , filename , lineno ) ; bnum_str = format_name ( tokens [ 2 ] ) ; bnum_str . erase ( bnum_str . begin ( ) ) ; ClusterBlockId bnum ( atoi ( bnum_str . c_str ( ) ) ) ; if ( 0 != cluster_ctx . clb_nlist . block_name ( bnum ) . compare ( tokens [ 1 ] ) ) { vpr_throw ( VPR_ERROR_ROUTE , filename , lineno , " " , tokens [ 1 ] . c_str ( ) , size_t ( bnum ) , cluster_ctx . clb_nlist . block_name ( bnum ) . c_str ( ) ) ; } if ( place_ctx . block_locs [ bnum ] . loc . x != x || place_ctx . block_locs [ bnum ] . loc . y != y ) { vpr_throw ( VPR_ERROR_ROUTE , filename , lineno , " " , x , y , place_ctx . block_locs [ bnum ] . loc . x , place_ctx . block_locs [ bnum ] . loc . y ) ; } int pin_index = net_pin_to_tile_pin_index ( inet , pin_counter ) ; if ( physical_tile_type ( bnum ) -> pin_class [ pin_index ] != atoi ( tokens [ 7 ] . c_str ( ) ) ) { vpr_throw ( VPR_ERROR_ROUTE , filename , lineno , " " , atoi ( tokens [ 7 ] . c_str ( ) ) , size_t ( inet ) , physical_tile_type ( bnum ) -> pin_class [ pin_index ] ) ; } pin_counter ++ ; } oldpos = fp . tellg ( ) ; } }
This function goes through all the blocks in a global net and verify it with the
 clustered netlist and the placement
This function goes through all the blocks in a global net and verify it with the clustered netlist and the placement
/*Walk through every block line*/ /*Skip blank lines*/ /*Skip commented lines*/ /*End of blocks, go back to reading nets*/ /*remove ()*/ /*remove #*/ /*Check for name, coordinate, and pins*/