36
36
37
37
#include < array>
38
38
39
- using std::max;
40
39
using std::min;
41
40
42
41
@@ -572,12 +571,12 @@ void NetCostHandler::get_non_updatable_cube_bb_(ClusterNetId net_id, bool use_ts
572
571
* clip to 1 in both directions as well (since minimum channel index *
573
572
* is 0). See route_common.cpp for a channel diagram. */
574
573
575
- bb_coord_new.xmin = max ( min<int >(xmin, device_ctx.grid .width () - 2 ), 1 ); // -2 for no perim channels
576
- bb_coord_new.ymin = max ( min<int >(ymin, device_ctx.grid .height () - 2 ), 1 ); // -2 for no perim channels
577
- bb_coord_new.layer_min = max (min< int >( layer_min, device_ctx. grid . get_num_layers () - 1 ), 0 ) ;
578
- bb_coord_new.xmax = max ( min<int >(xmax, device_ctx.grid .width () - 2 ), 1 ); // -2 for no perim channels
579
- bb_coord_new.ymax = max ( min<int >(ymax, device_ctx.grid .height () - 2 ), 1 ); // -2 for no perim channels
580
- bb_coord_new.layer_max = max (min< int >( layer_max, device_ctx. grid . get_num_layers () - 1 ), 0 ) ;
574
+ bb_coord_new.xmin = min<int >(xmin, device_ctx.grid .width () - 2 ); // -2 for no perim channels
575
+ bb_coord_new.ymin = min<int >(ymin, device_ctx.grid .height () - 2 ); // -2 for no perim channels
576
+ bb_coord_new.layer_min = layer_min;
577
+ bb_coord_new.xmax = min<int >(xmax, device_ctx.grid .width () - 2 ); // -2 for no perim channels
578
+ bb_coord_new.ymax = min<int >(ymax, device_ctx.grid .height () - 2 ); // -2 for no perim channels
579
+ bb_coord_new.layer_max = layer_max;
581
580
}
582
581
583
582
void NetCostHandler::get_non_updatable_per_layer_bb_ (ClusterNetId net_id, bool use_ts) {
@@ -637,10 +636,10 @@ void NetCostHandler::get_non_updatable_per_layer_bb_(ClusterNetId net_id, bool u
637
636
* is 0). See route_common.cpp for a channel diagram. */
638
637
for (int layer_num = 0 ; layer_num < num_layers; layer_num++) {
639
638
bb_coord_new[layer_num].layer_num = layer_num;
640
- bb_coord_new[layer_num].xmin = max ( min<int >(bb_coord_new[layer_num].xmin , device_ctx.grid .width () - 2 ), 1 ); // -2 for no perim channels
641
- bb_coord_new[layer_num].ymin = max ( min<int >(bb_coord_new[layer_num].ymin , device_ctx.grid .height () - 2 ), 1 ); // -2 for no perim channels
642
- bb_coord_new[layer_num].xmax = max ( min<int >(bb_coord_new[layer_num].xmax , device_ctx.grid .width () - 2 ), 1 ); // -2 for no perim channels
643
- bb_coord_new[layer_num].ymax = max ( min<int >(bb_coord_new[layer_num].ymax , device_ctx.grid .height () - 2 ), 1 ); // -2 for no perim channels
639
+ bb_coord_new[layer_num].xmin = min<int >(bb_coord_new[layer_num].xmin , device_ctx.grid .width () - 2 ); // -2 for no perim channels
640
+ bb_coord_new[layer_num].ymin = min<int >(bb_coord_new[layer_num].ymin , device_ctx.grid .height () - 2 ); // -2 for no perim channels
641
+ bb_coord_new[layer_num].xmax = min<int >(bb_coord_new[layer_num].xmax , device_ctx.grid .width () - 2 ); // -2 for no perim channels
642
+ bb_coord_new[layer_num].ymax = min<int >(bb_coord_new[layer_num].ymax , device_ctx.grid .height () - 2 ); // -2 for no perim channels
644
643
}
645
644
}
646
645
@@ -663,12 +662,12 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
663
662
// Number of sinks of the given net on each layer
664
663
vtr::NdMatrixProxy<int , 1 > num_sink_pin_layer_new = ts_layer_sink_pin_count_[size_t (net_id)];
665
664
666
- pin_new_loc.x = max ( min<int >(pin_new_loc.x , device_ctx.grid .width () - 2 ), 1 ); // -2 for no perim channels
667
- pin_new_loc.y = max ( min<int >(pin_new_loc.y , device_ctx.grid .height () - 2 ), 1 ); // -2 for no perim channels
668
- pin_new_loc.layer_num = max (min< int >( pin_new_loc.layer_num , device_ctx. grid . get_num_layers () - 1 ), 0 ) ;
669
- pin_old_loc.x = max ( min<int >(pin_old_loc.x , device_ctx.grid .width () - 2 ), 1 ); // -2 for no perim channels
670
- pin_old_loc.y = max ( min<int >(pin_old_loc.y , device_ctx.grid .height () - 2 ), 1 ); // -2 for no perim channels
671
- pin_old_loc.layer_num = max (min< int >( pin_old_loc.layer_num , device_ctx. grid . get_num_layers () - 1 ), 0 ) ;
665
+ pin_new_loc.x = min<int >(pin_new_loc.x , device_ctx.grid .width () - 2 ); // -2 for no perim channels
666
+ pin_new_loc.y = min<int >(pin_new_loc.y , device_ctx.grid .height () - 2 ); // -2 for no perim channels
667
+ pin_new_loc.layer_num = pin_new_loc.layer_num ;
668
+ pin_old_loc.x = min<int >(pin_old_loc.x , device_ctx.grid .width () - 2 ); // -2 for no perim channels
669
+ pin_old_loc.y = min<int >(pin_old_loc.y , device_ctx.grid .height () - 2 ); // -2 for no perim channels
670
+ pin_old_loc.layer_num = pin_old_loc.layer_num ;
672
671
673
672
/* Check if the net had been updated before. */
674
673
if (bb_update_status_[net_id] == NetUpdateState::GOT_FROM_SCRATCH) {
@@ -927,10 +926,10 @@ void NetCostHandler::update_layer_bb_(ClusterNetId net_id,
927
926
auto & device_ctx = g_vpr_ctx.device ();
928
927
auto & place_move_ctx = placer_state_.move ();
929
928
930
- pin_new_loc.x = max ( min<int >(pin_new_loc.x , device_ctx.grid .width () - 2 ), 1 ); // -2 for no perim channels
931
- pin_new_loc.y = max ( min<int >(pin_new_loc.y , device_ctx.grid .height () - 2 ), 1 ); // -2 for no perim channels
932
- pin_old_loc.x = max ( min<int >(pin_old_loc.x , device_ctx.grid .width () - 2 ), 1 ); // -2 for no perim channels
933
- pin_old_loc.y = max ( min<int >(pin_old_loc.y , device_ctx.grid .height () - 2 ), 1 ); // -2 for no perim channels
929
+ pin_new_loc.x = min<int >(pin_new_loc.x , device_ctx.grid .width () - 2 ); // -2 for no perim channels
930
+ pin_new_loc.y = min<int >(pin_new_loc.y , device_ctx.grid .height () - 2 ); // -2 for no perim channels
931
+ pin_old_loc.x = min<int >(pin_old_loc.x , device_ctx.grid .width () - 2 ); // -2 for no perim channels
932
+ pin_old_loc.y = min<int >(pin_old_loc.y , device_ctx.grid .height () - 2 ); // -2 for no perim channels
934
933
935
934
std::vector<t_2D_bb>& bb_edge_new = layer_ts_bb_edge_new_[net_id];
936
935
std::vector<t_2D_bb>& bb_coord_new = layer_ts_bb_coord_new_[net_id];
@@ -1285,9 +1284,9 @@ void NetCostHandler::get_bb_from_scratch_(ClusterNetId net_id,
1285
1284
int y = block_loc.y + physical_tile_type (block_loc)->pin_height_offset [pnum];
1286
1285
int pin_layer = block_loc.layer ;
1287
1286
1288
- x = max ( min<int >(x, grid.width () - 2 ), 1 );
1289
- y = max ( min<int >(y, grid.height () - 2 ), 1 );
1290
- pin_layer = max ( min<int >(pin_layer, grid.get_num_layers () - 1 ), 0 );
1287
+ x = min<int >(x, grid.width () - 2 );
1288
+ y = min<int >(y, grid.height () - 2 );
1289
+ pin_layer = min<int >(pin_layer, grid.get_num_layers () - 1 );
1291
1290
1292
1291
int xmin = x;
1293
1292
int ymin = y;
@@ -1322,9 +1321,9 @@ void NetCostHandler::get_bb_from_scratch_(ClusterNetId net_id,
1322
1321
* the which channels are included within the bounding box, and it *
1323
1322
* simplifies the code a lot. */
1324
1323
1325
- x = max ( min<int >(x, grid.width () - 2 ), 1 ); // -2 for no perim channels
1326
- y = max ( min<int >(y, grid.height () - 2 ), 1 ); // -2 for no perim channels
1327
- pin_layer = max ( min<int >(pin_layer, grid.get_num_layers () - 1 ), 0 );
1324
+ x = min<int >(x, grid.width () - 2 ); // -2 for no perim channels
1325
+ y = min<int >(y, grid.height () - 2 ); // -2 for no perim channels
1326
+ pin_layer = min<int >(pin_layer, grid.get_num_layers () - 1 );
1328
1327
1329
1328
if (x == xmin) {
1330
1329
xmin_edge++;
@@ -1406,8 +1405,8 @@ void NetCostHandler::get_layer_bb_from_scratch_(ClusterNetId net_id,
1406
1405
int x_src = block_loc.x + physical_tile_type (block_loc)->pin_width_offset [pnum_src];
1407
1406
int y_src = block_loc.y + physical_tile_type (block_loc)->pin_height_offset [pnum_src];
1408
1407
1409
- x_src = max ( min<int >(x_src, grid.width () - 2 ), 1 );
1410
- y_src = max ( min<int >(y_src, grid.height () - 2 ), 1 );
1408
+ x_src = min<int >(x_src, grid.width () - 2 );
1409
+ y_src = min<int >(y_src, grid.height () - 2 );
1411
1410
1412
1411
// TODO: Currently we are assuming that crossing can only happen from OPIN. Because of that,
1413
1412
// when per-layer bounding box is used, we want the bounding box on each layer to also include
@@ -1435,8 +1434,8 @@ void NetCostHandler::get_layer_bb_from_scratch_(ClusterNetId net_id,
1435
1434
* the which channels are included within the bounding box, and it *
1436
1435
* simplifies the code a lot. */
1437
1436
1438
- x = max ( min<int >(x, grid.width () - 2 ), 1 ); // -2 for no perim channels
1439
- y = max ( min<int >(y, grid.height () - 2 ), 1 ); // -2 for no perim channels
1437
+ x = min<int >(x, grid.width () - 2 ); // -2 for no perim channels
1438
+ y = min<int >(y, grid.height () - 2 ); // -2 for no perim channels
1440
1439
1441
1440
if (x == coords[layer].xmin ) {
1442
1441
num_on_edges[layer].xmin ++;
0 commit comments