vpr/src/place/place.cpp
/* Allocates the major structures needed only by the placer, primarily for *
 * computing costs quickly and such.                                       */
Allocates the major structures needed only by the placer, primarily for
computing costs quickly and such.
Allocates the major structures needed only by the placer primarily for computing costs quickly and such .
static void alloc_and_load_placement_structs(float place_cost_exp,
                                             const t_placer_opts& placer_opts,
                                             t_direct_inf* directs,
                                             int num_directs) {
    int max_pins_per_clb;
    unsigned int ipin;
    auto& device_ctx = g_vpr_ctx.device();
    auto& cluster_ctx = g_vpr_ctx.clustering();
    auto& place_ctx = g_vpr_ctx.mutable_placement();
    size_t num_nets = cluster_ctx.clb_nlist.nets().size();
    init_placement_context();
    max_pins_per_clb = 0;
    for (const auto& type : device_ctx.physical_tile_types) {
        max_pins_per_clb = max(max_pins_per_clb, type.num_pins);
    }
    if (placer_opts.place_algorithm == PATH_TIMING_DRIVEN_PLACE
        || placer_opts.enable_timing_computations) {
        point_to_point_delay.resize(num_nets);
        temp_point_to_point_delay.resize(num_nets);
        point_to_point_timing_cost.resize(num_nets);
        temp_point_to_point_timing_cost.resize(num_nets);
        for (auto net_id : cluster_ctx.clb_nlist.nets()) {
            size_t num_sinks = cluster_ctx.clb_nlist.net_sinks(net_id).size();
            point_to_point_delay[net_id] = (float*)vtr::malloc(num_sinks * sizeof(float));
            point_to_point_delay[net_id]--;
            temp_point_to_point_delay[net_id] = (float*)vtr::malloc(num_sinks * sizeof(float));
            temp_point_to_point_delay[net_id]--;
            point_to_point_timing_cost[net_id] = (double*)vtr::malloc(num_sinks * sizeof(double));
            point_to_point_timing_cost[net_id]--;
            temp_point_to_point_timing_cost[net_id] = (double*)vtr::malloc(num_sinks * sizeof(double));
            temp_point_to_point_timing_cost[net_id]--;
        }
        for (auto net_id : cluster_ctx.clb_nlist.nets()) {
            for (ipin = 1; ipin < cluster_ctx.clb_nlist.net_pins(net_id).size(); ipin++) {
                point_to_point_delay[net_id][ipin] = 0;
                temp_point_to_point_delay[net_id][ipin] = 0;
            }
        }
    }
    net_cost.resize(num_nets, -1.);
    temp_net_cost.resize(num_nets, -1.);
    bb_coords.resize(num_nets, t_bb());
    bb_num_on_edges.resize(num_nets, t_bb());
    bb_updated_before.resize(num_nets, NOT_UPDATED_YET);
    alloc_and_load_for_fast_cost_update(place_cost_exp);
    alloc_and_load_net_pin_indices();
    alloc_and_load_try_swap_structs();
    place_ctx.pl_macros = alloc_and_load_placement_macros(directs, num_directs);
}
static void alloc_and_load_placement_structs ( float place_cost_exp , const t_placer_opts & placer_opts , t_direct_inf * directs , int num_directs ) { int max_pins_per_clb ; unsigned int ipin ; auto & device_ctx = g_vpr_ctx . device ( ) ; auto & cluster_ctx = g_vpr_ctx . clustering ( ) ; auto & place_ctx = g_vpr_ctx . mutable_placement ( ) ; size_t num_nets = cluster_ctx . clb_nlist . nets ( ) . size ( ) ; init_placement_context ( ) ; max_pins_per_clb = 0 ; for ( const auto & type : device_ctx . physical_tile_types ) { max_pins_per_clb = max ( max_pins_per_clb , type . num_pins ) ; } if ( placer_opts . place_algorithm == PATH_TIMING_DRIVEN_PLACE || placer_opts . enable_timing_computations ) { point_to_point_delay . resize ( num_nets ) ; temp_point_to_point_delay . resize ( num_nets ) ; point_to_point_timing_cost . resize ( num_nets ) ; temp_point_to_point_timing_cost . resize ( num_nets ) ; for ( auto net_id : cluster_ctx . clb_nlist . nets ( ) ) { size_t num_sinks = cluster_ctx . clb_nlist . net_sinks ( net_id ) . size ( ) ; point_to_point_delay [ net_id ] = ( float * ) vtr :: malloc ( num_sinks * sizeof ( float ) ) ; point_to_point_delay [ net_id ] -- ; temp_point_to_point_delay [ net_id ] = ( float * ) vtr :: malloc ( num_sinks * sizeof ( float ) ) ; temp_point_to_point_delay [ net_id ] -- ; point_to_point_timing_cost [ net_id ] = ( double * ) vtr :: malloc ( num_sinks * sizeof ( double ) ) ; point_to_point_timing_cost [ net_id ] -- ; temp_point_to_point_timing_cost [ net_id ] = ( double * ) vtr :: malloc ( num_sinks * sizeof ( double ) ) ; temp_point_to_point_timing_cost [ net_id ] -- ; } for ( auto net_id : cluster_ctx . clb_nlist . nets ( ) ) { for ( ipin = 1 ; ipin < cluster_ctx . clb_nlist . net_pins ( net_id ) . size ( ) ; ipin ++ ) { point_to_point_delay [ net_id ] [ ipin ] = 0 ; temp_point_to_point_delay [ net_id ] [ ipin ] = 0 ; } } } net_cost . resize ( num_nets , -1. ) ; temp_net_cost . resize ( num_nets , -1. ) ; bb_coords . resize ( num_nets , t_bb ( ) ) ; bb_num_on_edges . resize ( num_nets , t_bb ( ) ) ; bb_updated_before . resize ( num_nets , NOT_UPDATED_YET ) ; alloc_and_load_for_fast_cost_update ( place_cost_exp ) ; alloc_and_load_net_pin_indices ( ) ; alloc_and_load_try_swap_structs ( ) ; place_ctx . pl_macros = alloc_and_load_placement_macros ( directs , num_directs ) ; }
Allocates the major structures needed only by the placer, primarily for
 computing costs quickly and such.
Allocates the major structures needed only by the placer primarily for computing costs quickly and such .
/* Allocate structures associated with timing driven placement */ /* [0..cluster_ctx.clb_nlist.nets().size()-1][1..num_pins-1]  */ /* In the following, subract one so index starts at *
             * 1 instead of 0 */ /* Used to store costs for moves not yet made and to indicate when a net's   *
     * cost has been recomputed. temp_net_cost[inet] < 0 means net's cost hasn't *
     * been recomputed.                                                          */