@@ -478,12 +478,13 @@ static util::Cost_Entry get_wire_cost_entry(e_rr_type rr_type, int seg_index, in
478478 chan_index = 1 ;
479479 }
480480
481- VTR_ASSERT_SAFE (from_layer_num < (int )f_wire_cost_map.dim_size (0 ));
482- VTR_ASSERT_SAFE (to_layer_num < (int )f_wire_cost_map.dim_size (3 ));
483- VTR_ASSERT_SAFE (delta_x < (int )f_wire_cost_map.dim_size (4 ));
484- VTR_ASSERT_SAFE (delta_y < (int )f_wire_cost_map.dim_size (5 ));
481+ VTR_ASSERT_SAFE (from_layer_num < static_cast <int >(f_wire_cost_map.dim_size (0 )));
482+ VTR_ASSERT_SAFE (to_layer_num < static_cast <int >(f_wire_cost_map.dim_size (1 )));
483+ VTR_ASSERT_SAFE (seg_index < static_cast <int >(f_wire_cost_map.dim_size (3 )));
484+ VTR_ASSERT_SAFE (delta_x < static_cast <int >(f_wire_cost_map.dim_size (4 )));
485+ VTR_ASSERT_SAFE (delta_y < static_cast <int >(f_wire_cost_map.dim_size (5 )));
485486
486- return f_wire_cost_map[from_layer_num][chan_index][seg_index][to_layer_num ][delta_x][delta_y];
487+ return f_wire_cost_map[from_layer_num][to_layer_num][chan_index][seg_index ][delta_x][delta_y];
487488}
488489
489490static void compute_router_wire_lookahead (const std::vector<t_segment_inf>& segment_inf_vec) {
@@ -494,12 +495,12 @@ static void compute_router_wire_lookahead(const std::vector<t_segment_inf>& segm
494495 auto & grid = device_ctx.grid ;
495496
496497 // Re-allocate
497- f_wire_cost_map = t_wire_cost_map ({static_cast <unsigned long >(grid.get_num_layers ()),
498- 2 ,
499- segment_inf_vec. size () ,
500- static_cast < unsigned long >(grid. get_num_layers () ),
501- device_ctx.grid .width (),
502- device_ctx.grid .height ()});
498+ f_wire_cost_map = t_wire_cost_map ({static_cast <unsigned long >(grid.get_num_layers ()),
499+ static_cast < unsigned long >(grid. get_num_layers ()),
500+ 2 ,
501+ segment_inf_vec. size ( ),
502+ device_ctx.grid .width (),
503+ device_ctx.grid .height ()});
503504
504505 int longest_seg_length = 0 ;
505506 for (const auto & seg_inf : segment_inf_vec) {
@@ -550,7 +551,7 @@ static void set_lookahead_map_costs(int from_layer_num, int segment_index, e_rr_
550551 for (unsigned iy = 0 ; iy < routing_cost_map.dim_size (2 ); iy++) {
551552 util::Expansion_Cost_Entry& expansion_cost_entry = routing_cost_map[to_layer][ix][iy];
552553
553- f_wire_cost_map[from_layer_num][chan_index][segment_index][to_layer ][ix][iy] = expansion_cost_entry.get_representative_cost_entry (util::e_representative_entry_method::SMALLEST);
554+ f_wire_cost_map[from_layer_num][to_layer][chan_index][segment_index ][ix][iy] = expansion_cost_entry.get_representative_cost_entry (util::e_representative_entry_method::SMALLEST);
554555 }
555556 }
556557 }
@@ -567,7 +568,7 @@ static void fill_in_missing_lookahead_entries(int segment_index, e_rr_type chan_
567568 for (int to_layer_num = 0 ; to_layer_num < device_ctx.grid .get_num_layers (); ++to_layer_num) {
568569 for (unsigned ix = 0 ; ix < device_ctx.grid .width (); ix++) {
569570 for (unsigned iy = 0 ; iy < device_ctx.grid .height (); iy++) {
570- util::Cost_Entry cost_entry = f_wire_cost_map[from_layer_num][chan_index][segment_index][to_layer_num ][ix][iy];
571+ util::Cost_Entry cost_entry = f_wire_cost_map[from_layer_num][to_layer_num][chan_index][segment_index ][ix][iy];
571572
572573 if (std::isnan (cost_entry.delay ) && std::isnan (cost_entry.congestion )) {
573574 util::Cost_Entry copied_entry = get_nearby_cost_entry_average_neighbour (from_layer_num,
@@ -576,7 +577,7 @@ static void fill_in_missing_lookahead_entries(int segment_index, e_rr_type chan_
576577 to_layer_num,
577578 segment_index,
578579 chan_index);
579- f_wire_cost_map[from_layer_num][chan_index][segment_index][to_layer_num ][ix][iy] = copied_entry;
580+ f_wire_cost_map[from_layer_num][to_layer_num][chan_index][segment_index ][ix][iy] = copied_entry;
580581 }
581582 }
582583 }
@@ -612,7 +613,7 @@ static util::Cost_Entry get_nearby_cost_entry(int from_layer_num, int x, int y,
612613 copy_y = std::max (copy_y, 0 ); // Clip to zero
613614 copy_x = std::max (copy_x, 0 ); // Clip to zero
614615
615- util::Cost_Entry copy_entry = f_wire_cost_map[from_layer_num][chan_index][segment_index][to_layer_num ][copy_x][copy_y];
616+ util::Cost_Entry copy_entry = f_wire_cost_map[from_layer_num][to_layer_num][chan_index][segment_index ][copy_x][copy_y];
616617
617618 /* if the entry to be copied is also empty, recurse */
618619 if (std::isnan (copy_entry.delay ) && std::isnan (copy_entry.congestion )) {
@@ -640,8 +641,8 @@ static util::Cost_Entry get_nearby_cost_entry_average_neighbour(int from_layer_n
640641 int segment_index,
641642 int chan_index) {
642643 // Make sure that the given location doesn't have a valid entry
643- VTR_ASSERT (std::isnan (f_wire_cost_map[from_layer_num][chan_index][segment_index][to_layer_num ][missing_dx][missing_dy].delay ));
644- VTR_ASSERT (std::isnan (f_wire_cost_map[from_layer_num][chan_index][segment_index][to_layer_num ][missing_dx][missing_dy].congestion ));
644+ VTR_ASSERT (std::isnan (f_wire_cost_map[from_layer_num][to_layer_num][chan_index][segment_index ][missing_dx][missing_dy].delay ));
645+ VTR_ASSERT (std::isnan (f_wire_cost_map[from_layer_num][to_layer_num][chan_index][segment_index ][missing_dx][missing_dy].congestion ));
645646
646647 int neighbour_num = 0 ; // Number of neighbours with valid entry
647648 float neighbour_delay_sum = 0 ; // Acc of valid delay costs
@@ -657,7 +658,7 @@ static util::Cost_Entry get_nearby_cost_entry_average_neighbour(int from_layer_n
657658 if (neighbour_y < 0 || neighbour_y >= (int )f_wire_cost_map.dim_size (5 )) {
658659 continue ;
659660 }
660- util::Cost_Entry copy_entry = f_wire_cost_map[from_layer_num][chan_index][segment_index][to_layer_num ][neighbour_x][neighbour_y];
661+ util::Cost_Entry copy_entry = f_wire_cost_map[from_layer_num][to_layer_num][chan_index][segment_index ][neighbour_x][neighbour_y];
661662 if (std::isnan (copy_entry.delay ) || std::isnan (copy_entry.congestion )) {
662663 continue ;
663664 }
@@ -779,10 +780,10 @@ static void min_chann_global_cost_map(vtr::NdMatrix<util::Cost_Entry, 4>& distan
779780 for (int dx = 0 ; dx < width; dx++) {
780781 for (int dy = 0 ; dy < height; dy++) {
781782 util::Cost_Entry min_cost (std::numeric_limits<float >::max (), std::numeric_limits<float >::max ());
782- for (int chan_idx = 0 ; chan_idx < (int )f_wire_cost_map.dim_size (1 ); chan_idx++) {
783- for (int seg_idx = 0 ; seg_idx < (int )f_wire_cost_map.dim_size (2 ); seg_idx++) {
784- auto cost = util::Cost_Entry (f_wire_cost_map[from_layer_num][chan_idx][seg_idx][to_layer_num ][dx][dy].delay ,
785- f_wire_cost_map[from_layer_num][chan_idx][seg_idx][to_layer_num ][dx][dy].congestion );
783+ for (int chan_idx = 0 ; chan_idx < (int )f_wire_cost_map.dim_size (2 ); chan_idx++) {
784+ for (int seg_idx = 0 ; seg_idx < (int )f_wire_cost_map.dim_size (3 ); seg_idx++) {
785+ auto cost = util::Cost_Entry (f_wire_cost_map[from_layer_num][to_layer_num][chan_idx][seg_idx ][dx][dy].delay ,
786+ f_wire_cost_map[from_layer_num][to_layer_num][chan_idx][seg_idx ][dx][dy].congestion );
786787 if (cost.delay < min_cost.delay ) {
787788 min_cost.delay = cost.delay ;
788789 min_cost.congestion = cost.congestion ;
0 commit comments