Skip to content

Commit e15a796

Browse files
committed
[vpr][place][net_cost] use bb
1 parent 052d6b9 commit e15a796

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,35 +1595,31 @@ double NetCostHandler::get_net_wirelength_from_layer_bb_(ClusterNetId net_id) {
15951595
return ncost;
15961596
}
15971597

1598-
float NetCostHandler::get_chanz_cost_factor_(const t_bb& bounding_box) {
1598+
float NetCostHandler::get_chanz_cost_factor_(const t_bb& bb) {
15991599
float place_cost_exp = placer_opts_.place_cost_exp;
1600-
int x_high = bounding_box.xmax;
1601-
int x_low = bounding_box.xmin;
1602-
int y_high = bounding_box.ymax;
1603-
int y_low = bounding_box.ymin;
16041600

16051601
int num_inter_dir_conn;
16061602

1607-
if (x_low == 0 && y_low == 0) {
1608-
num_inter_dir_conn = acc_tile_num_inter_die_conn_[x_high][y_high];
1609-
} else if (x_low == 0) {
1610-
num_inter_dir_conn = acc_tile_num_inter_die_conn_[x_high][y_high] -
1611-
acc_tile_num_inter_die_conn_[x_high][y_low-1];
1612-
} else if (y_low == 0) {
1613-
num_inter_dir_conn = acc_tile_num_inter_die_conn_[x_high][y_high] -
1614-
acc_tile_num_inter_die_conn_[x_low-1][y_high];
1603+
if (bb.xmin == 0 && bb.ymin == 0) {
1604+
num_inter_dir_conn = acc_tile_num_inter_die_conn_[bb.xmax][bb.ymax];
1605+
} else if (bb.xmin == 0) {
1606+
num_inter_dir_conn = acc_tile_num_inter_die_conn_[bb.xmax][bb.ymax] -
1607+
acc_tile_num_inter_die_conn_[bb.xmax][bb.ymin-1];
1608+
} else if (bb.ymin == 0) {
1609+
num_inter_dir_conn = acc_tile_num_inter_die_conn_[bb.xmax][bb.ymax] -
1610+
acc_tile_num_inter_die_conn_[bb.xmin-1][bb.ymax];
16151611
} else {
1616-
num_inter_dir_conn = acc_tile_num_inter_die_conn_[x_high][y_high] -
1617-
acc_tile_num_inter_die_conn_[x_low-1][y_high] -
1618-
acc_tile_num_inter_die_conn_[x_high][y_low-1] +
1619-
acc_tile_num_inter_die_conn_[x_low-1][y_low-1];
1612+
num_inter_dir_conn = acc_tile_num_inter_die_conn_[bb.xmax][bb.ymax] -
1613+
acc_tile_num_inter_die_conn_[bb.xmin-1][bb.ymax] -
1614+
acc_tile_num_inter_die_conn_[bb.xmax][bb.ymin-1] +
1615+
acc_tile_num_inter_die_conn_[bb.xmin-1][bb.ymin-1];
16201616
}
16211617

16221618
float z_cost_factor;
16231619
if (num_inter_dir_conn == 0) {
16241620
return 1.0f;
16251621
} else {
1626-
int bb_num_tiles = (x_high - x_low + 1) * (y_high - y_low + 1);
1622+
int bb_num_tiles = (bb.xmax - bb.xmin + 1) * (bb.ymax - bb.ymin + 1);
16271623
z_cost_factor = bb_num_tiles / static_cast<float>(num_inter_dir_conn);
16281624
z_cost_factor = pow((double)z_cost_factor, (double)place_cost_exp);
16291625
}

vpr/src/place/net_cost_handler.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ class NetCostHandler {
256256
void alloc_and_load_chan_w_factors_for_place_cost_();
257257

258258
/**
259-
* @brief Allocates and loads the chanz_place_cost_fac array with the inverse of
260-
* the average number of inter-die connections between [subhigh] and [sublow].
259+
* @brief Allocates and loads acc_tile_num_inter_die_conn_ which contains the accumulative number of inter-die
260+
* conntections.
261261
*
262262
* @details This is only useful for multi-die FPGAs. The place_cost_exp factor specifies to
263263
* what power the average number of inter-die connections should be take -- larger numbers make narrower channels more expensive.
@@ -511,7 +511,9 @@ class NetCostHandler {
511511
* @brief Calculate the chanz cost factor based on the inverse of the average number of inter-die connections
512512
* in the given bounding box. This cost factor increases the placement cost for blocks that require inter-layer
513513
* connections in areas with, on average, fewer inter-die connections. If inter-die connections are evenly
514-
* distributed across tiles, the cost factor will be the same for all bounding boxes.
514+
* distributed across tiles, the cost factor will be the same for all bounding boxes, but it will still
515+
* weight z-directed vs. x- and y-directed connections appropriately.
516+
*
515517
* @param bounding_box Bounding box of the net which chanz cost factor is to be calculated
516518
* @return ChanZ cost factor
517519
*/

0 commit comments

Comments
 (0)