vpr/src/pack/cluster.cpp
/**
 * This function updates the le_count data structure from the given packed cluster
 */
This function updates the le_count data structure from the given packed cluster
This function updates the le_count data structure from the given packed cluster
static void update_le_count(const t_pb* pb, const t_logical_block_type_ptr logic_block_type, const t_pb_type* le_pb_type, std::vector<int>& le_count) {
    if (!logic_block_type || pb->pb_graph_node != logic_block_type->pb_graph_head || !le_pb_type)
        return;
    const std::string lut(".names");
    const std::string ff(".latch");
    const std::string adder("adder");
    auto parent_pb = pb;
    while (parent_pb->child_pbs[0][0].pb_graph_node->pb_type != le_pb_type) {
        parent_pb = &parent_pb->child_pbs[0][0];
    }
    for (int ile = 0; ile < parent_pb->get_num_children_of_type(0); ile++) {
        if (!parent_pb->child_pbs[0][ile].name)
            continue;
        auto has_used_lut = pb_used_for_blif_model(&parent_pb->child_pbs[0][ile], lut);
        auto has_used_adder = pb_used_for_blif_model(&parent_pb->child_pbs[0][ile], adder);
        auto has_used_ff = pb_used_for_blif_model(&parent_pb->child_pbs[0][ile], ff);
        if ((has_used_lut || has_used_adder) && has_used_ff) {
            le_count[0]++;
        } else if (has_used_lut || has_used_adder) {
            le_count[1]++;
        } else if (has_used_ff) {
            le_count[2]++;
        }
    }
}
static void update_le_count ( const t_pb * pb , const t_logical_block_type_ptr logic_block_type , const t_pb_type * le_pb_type , std :: vector < int > & le_count ) { if ( ! logic_block_type || pb -> pb_graph_node != logic_block_type -> pb_graph_head || ! le_pb_type ) return ; const std :: string lut ( " " ) ; const std :: string ff ( " " ) ; const std :: string adder ( " " ) ; auto parent_pb = pb ; while ( parent_pb -> child_pbs [ 0 ] [ 0 ] . pb_graph_node -> pb_type != le_pb_type ) { parent_pb = & parent_pb -> child_pbs [ 0 ] [ 0 ] ; } for ( int ile = 0 ; ile < parent_pb -> get_num_children_of_type ( 0 ) ; ile ++ ) { if ( ! parent_pb -> child_pbs [ 0 ] [ ile ] . name ) continue ; auto has_used_lut = pb_used_for_blif_model ( & parent_pb -> child_pbs [ 0 ] [ ile ] , lut ) ; auto has_used_adder = pb_used_for_blif_model ( & parent_pb -> child_pbs [ 0 ] [ ile ] , adder ) ; auto has_used_ff = pb_used_for_blif_model ( & parent_pb -> child_pbs [ 0 ] [ ile ] , ff ) ; if ( ( has_used_lut || has_used_adder ) && has_used_ff ) { le_count [ 0 ] ++ ; } else if ( has_used_lut || has_used_adder ) { le_count [ 1 ] ++ ; } else if ( has_used_ff ) { le_count [ 2 ] ++ ; } } }
This function updates the le_count data structure from the given packed cluster
This function updates the le_count data structure from the given packed cluster
// if this cluster doesn't contain LEs or there // are no les in this architecture, ignore it // go down the hierarchy till the parent physical block of the LE is found // iterate over all the LEs and update the LE count accordingly // First type of LEs: used for logic and registers // Second type of LEs: used for logic only // Third type of LEs: used for registers only