vpr/src/route/rr_graph_reader.cpp
/* Blocks were initialized from the architecture file. This function checks
 * if it corresponds to the RR graph. Errors out if it doesn't correspond*/
Blocks were initialized from the architecture file. This function checks
if it corresponds to the RR graph. Errors out if it doesn't correspond
Blocks were initialized from the architecture file . This function checks if it corresponds to the RR graph . Errors out if it doesn ' t correspond
void verify_blocks(pugi::xml_node parent, const pugiutil::loc_data& loc_data) {
    pugi::xml_node Block;
    pugi::xml_node pin_class;
    pugi::xml_node pin;
    Block = get_first_child(parent, "block_type", loc_data);
    auto& device_ctx = g_vpr_ctx.mutable_device();
    while (Block) {
        auto block_info = device_ctx.physical_tile_types[get_attribute(Block, "id", loc_data).as_int(0)];
        const char* name = get_attribute(Block, "name", loc_data).as_string(nullptr);
        if (strcmp(block_info.name, name) != 0) {
            VPR_FATAL_ERROR(VPR_ERROR_OTHER,
                            "Architecture file does not match RR graph's block name: arch uses name %s, RR graph uses name %s", block_info.name, name);
        }
        if (block_info.width != get_attribute(Block, "width", loc_data).as_float(0)) {
            VPR_FATAL_ERROR(VPR_ERROR_OTHER,
                            "Architecture file does not match RR graph's block width");
        }
        if (block_info.height != get_attribute(Block, "height", loc_data).as_float(0)) {
            VPR_FATAL_ERROR(VPR_ERROR_OTHER,
                            "Architecture file does not match RR graph's block height");
        }
        pin_class = get_first_child(Block, "pin_class", loc_data, pugiutil::OPTIONAL);
        block_info.num_class = count_children(Block, "pin_class", loc_data, pugiutil::OPTIONAL);
        for (int classNum = 0; classNum < block_info.num_class; classNum++) {
            auto& class_inf = block_info.class_inf[classNum];
            e_pin_type type;
            const char* typeInfo = get_attribute(pin_class, "type", loc_data).value();
            if (strcmp(typeInfo, "OPEN") == 0) {
                type = OPEN;
            } else if (strcmp(typeInfo, "OUTPUT") == 0) {
                type = DRIVER;
            } else if (strcmp(typeInfo, "INPUT") == 0) {
                type = RECEIVER;
            } else {
                VPR_FATAL_ERROR(VPR_ERROR_OTHER,
                                "Valid inputs for class types are \"OPEN\", \"OUTPUT\", and \"INPUT\".");
                type = OPEN;
            }
            if (class_inf.type != type) {
                VPR_FATAL_ERROR(VPR_ERROR_OTHER,
                                "Architecture file does not match RR graph's block type");
            }
            if (class_inf.num_pins != (int)count_children(pin_class, "pin", loc_data)) {
                VPR_FATAL_ERROR(VPR_ERROR_OTHER,
                                "Incorrect number of pins in %d pin_class in block %s", classNum, block_info.name);
            }
            pin = get_first_child(pin_class, "pin", loc_data, pugiutil::OPTIONAL);
            while (pin) {
                auto num = get_attribute(pin, "ptc", loc_data).as_uint();
                auto index = pin_index_by_num(class_inf, num);
                if (index < 0) {
                    VPR_FATAL_ERROR(VPR_ERROR_OTHER,
                                    "Architecture file does not match RR graph's block pin list: invalid ptc for pin class");
                }
                if (pin.child_value() != block_type_pin_index_to_name(&block_info, class_inf.pinlist[index])) {
                    VPR_FATAL_ERROR(VPR_ERROR_OTHER,
                                    "Architecture file does not match RR graph's block pin list");
                }
                pin = pin.next_sibling("pin");
            }
            pin_class = pin_class.next_sibling(pin_class.name());
        }
        Block = Block.next_sibling(Block.name());
    }
}
void verify_blocks ( pugi :: xml_node parent , const pugiutil :: loc_data & loc_data ) { pugi :: xml_node Block ; pugi :: xml_node pin_class ; pugi :: xml_node pin ; Block = get_first_child ( parent , " " , loc_data ) ; auto & device_ctx = g_vpr_ctx . mutable_device ( ) ; while ( Block ) { auto block_info = device_ctx . physical_tile_types [ get_attribute ( Block , " " , loc_data ) . as_int ( 0 ) ] ; const char * name = get_attribute ( Block , " " , loc_data ) . as_string ( nullptr ) ; if ( strcmp ( block_info . name , name ) != 0 ) { VPR_FATAL_ERROR ( VPR_ERROR_OTHER , " " , block_info . name , name ) ; } if ( block_info . width != get_attribute ( Block , " " , loc_data ) . as_float ( 0 ) ) { VPR_FATAL_ERROR ( VPR_ERROR_OTHER , " " ) ; } if ( block_info . height != get_attribute ( Block , " " , loc_data ) . as_float ( 0 ) ) { VPR_FATAL_ERROR ( VPR_ERROR_OTHER , " " ) ; } pin_class = get_first_child ( Block , " " , loc_data , pugiutil :: OPTIONAL ) ; block_info . num_class = count_children ( Block , " " , loc_data , pugiutil :: OPTIONAL ) ; for ( int classNum = 0 ; classNum < block_info . num_class ; classNum ++ ) { auto & class_inf = block_info . class_inf [ classNum ] ; e_pin_type type ; const char * typeInfo = get_attribute ( pin_class , " " , loc_data ) . value ( ) ; if ( strcmp ( typeInfo , " " ) == 0 ) { type = OPEN ; } else if ( strcmp ( typeInfo , " " ) == 0 ) { type = DRIVER ; } else if ( strcmp ( typeInfo , " " ) == 0 ) { type = RECEIVER ; } else { VPR_FATAL_ERROR ( VPR_ERROR_OTHER , " \" \" \" \" \" \" " ) ; type = OPEN ; } if ( class_inf . type != type ) { VPR_FATAL_ERROR ( VPR_ERROR_OTHER , " " ) ; } if ( class_inf . num_pins != ( int ) count_children ( pin_class , " " , loc_data ) ) { VPR_FATAL_ERROR ( VPR_ERROR_OTHER , " " , classNum , block_info . name ) ; } pin = get_first_child ( pin_class , " " , loc_data , pugiutil :: OPTIONAL ) ; while ( pin ) { auto num = get_attribute ( pin , " " , loc_data ) . as_uint ( ) ; auto index = pin_index_by_num ( class_inf , num ) ; if ( index < 0 ) { VPR_FATAL_ERROR ( VPR_ERROR_OTHER , " " ) ; } if ( pin . child_value ( ) != block_type_pin_index_to_name ( & block_info , class_inf . pinlist [ index ] ) ) { VPR_FATAL_ERROR ( VPR_ERROR_OTHER , " " ) ; } pin = pin . next_sibling ( " " ) ; } pin_class = pin_class . next_sibling ( pin_class . name ( ) ) ; } Block = Block . next_sibling ( Block . name ( ) ) ; } }
Blocks were initialized from the architecture file.
Blocks were initialized from the architecture file .
/*Verify types and pins*/