@@ -478,12 +478,13 @@ static util::Cost_Entry get_wire_cost_entry(e_rr_type rr_type, int seg_index, in
478
478
chan_index = 1 ;
479
479
}
480
480
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 )));
485
486
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];
487
488
}
488
489
489
490
static 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
494
495
auto & grid = device_ctx.grid ;
495
496
496
497
// 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 ()});
503
504
504
505
int longest_seg_length = 0 ;
505
506
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_
550
551
for (unsigned iy = 0 ; iy < routing_cost_map.dim_size (2 ); iy++) {
551
552
util::Expansion_Cost_Entry& expansion_cost_entry = routing_cost_map[to_layer][ix][iy];
552
553
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);
554
555
}
555
556
}
556
557
}
@@ -567,7 +568,7 @@ static void fill_in_missing_lookahead_entries(int segment_index, e_rr_type chan_
567
568
for (int to_layer_num = 0 ; to_layer_num < device_ctx.grid .get_num_layers (); ++to_layer_num) {
568
569
for (unsigned ix = 0 ; ix < device_ctx.grid .width (); ix++) {
569
570
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];
571
572
572
573
if (std::isnan (cost_entry.delay ) && std::isnan (cost_entry.congestion )) {
573
574
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_
576
577
to_layer_num,
577
578
segment_index,
578
579
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;
580
581
}
581
582
}
582
583
}
@@ -612,7 +613,7 @@ static util::Cost_Entry get_nearby_cost_entry(int from_layer_num, int x, int y,
612
613
copy_y = std::max (copy_y, 0 ); // Clip to zero
613
614
copy_x = std::max (copy_x, 0 ); // Clip to zero
614
615
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];
616
617
617
618
/* if the entry to be copied is also empty, recurse */
618
619
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
640
641
int segment_index,
641
642
int chan_index) {
642
643
// 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 ));
645
646
646
647
int neighbour_num = 0 ; // Number of neighbours with valid entry
647
648
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
657
658
if (neighbour_y < 0 || neighbour_y >= (int )f_wire_cost_map.dim_size (5 )) {
658
659
continue ;
659
660
}
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];
661
662
if (std::isnan (copy_entry.delay ) || std::isnan (copy_entry.congestion )) {
662
663
continue ;
663
664
}
@@ -779,10 +780,10 @@ static void min_chann_global_cost_map(vtr::NdMatrix<util::Cost_Entry, 4>& distan
779
780
for (int dx = 0 ; dx < width; dx++) {
780
781
for (int dy = 0 ; dy < height; dy++) {
781
782
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 );
786
787
if (cost.delay < min_cost.delay ) {
787
788
min_cost.delay = cost.delay ;
788
789
min_cost.congestion = cost.congestion ;
0 commit comments