@@ -299,8 +299,8 @@ static void update_layer_bb(ClusterNetId net_id,
299
299
bool is_output_pin);
300
300
301
301
/* *
302
- * @brief This function is called in update_layer_bb to update the net's bounding box incrementally if
303
- * the pin under consideration change layer.
302
+ * @brief This function is called in update_layer_bb to update the net's bounding box incrementally if
303
+ * the pin under consideration change layer.
304
304
* @param net_id ID of the net which the moving pin belongs to
305
305
* @param pin_old_loc Old location of the moving pin
306
306
* @param pin_new_loc New location of the moving pin
@@ -509,8 +509,7 @@ void BBUpdater::get_non_updatable_bb(const ClusterNetId& net) {
509
509
::get_non_updatable_bb (net,
510
510
ts_info.ts_bb_coord_new[net],
511
511
ts_info.ts_layer_sink_pin_count[size_t (net)]);
512
- }
513
- else {
512
+ } else {
514
513
::get_non_updatable_layer_bb (net,
515
514
ts_info.layer_ts_bb_coord_new[net],
516
515
ts_info.ts_layer_sink_pin_count[size_t (net)]);
@@ -526,8 +525,7 @@ void BBUpdater::update_bb(ClusterNetId net_id, t_physical_tile_loc pin_old_loc,
526
525
pin_old_loc,
527
526
pin_new_loc,
528
527
is_driver);
529
- }
530
- else {
528
+ } else {
531
529
::update_layer_bb (net_id,
532
530
ts_info.layer_ts_bb_edge_new[net_id],
533
531
ts_info.layer_ts_bb_coord_new[net_id],
@@ -541,8 +539,7 @@ void BBUpdater::update_bb(ClusterNetId net_id, t_physical_tile_loc pin_old_loc,
541
539
double BBUpdater::get_net_cost (const ClusterNetId net_id) {
542
540
if (m_cube_bb) {
543
541
return ::get_net_cost (net_id, ts_info.ts_bb_coord_new [net_id]);
544
- }
545
- else {
542
+ } else {
546
543
return ::get_net_layer_bb_wire_cost (net_id, ts_info.layer_ts_bb_coord_new [net_id], ts_info.ts_layer_sink_pin_count [size_t (net_id)]);
547
544
}
548
545
}
@@ -1381,10 +1378,10 @@ static inline void update_bb_layer_changed(ClusterNetId net_id,
1381
1378
VTR_ASSERT_SAFE (old_layer_num != new_layer_num);
1382
1379
1383
1380
/*
1384
- This funcitn is called when BB per layer is used and when the moving block is moving from one layer to another.
1385
- Thus, we need to update bounding box on both "from" and "to" layer. Here, we update the bounding box on "from" or
1386
- "old_layer". Then, "add_block_to_bb" is called to update the bounding box on the new layer.
1387
- */
1381
+ * This funcitn is called when BB per layer is used and when the moving block is moving from one layer to another.
1382
+ * Thus, we need to update bounding box on both "from" and "to" layer. Here, we update the bounding box on "from" or
1383
+ * "old_layer". Then, "add_block_to_bb" is called to update the bounding box on the new layer.
1384
+ */
1388
1385
if (x_old == curr_bb_coord[old_layer_num].xmax ) {
1389
1386
update_bb_edge (net_id,
1390
1387
bb_edge_new,
@@ -1489,10 +1486,10 @@ static void add_block_to_bb(const t_physical_tile_loc& new_pin_loc,
1489
1486
int y_new = new_pin_loc.y ;
1490
1487
1491
1488
/*
1492
- This function is called to only update the bounding box on the new layer from a block
1493
- moving to this layer from another layer. Thus, we only need to assess the effect of this
1494
- new block on the edges.
1495
- */
1489
+ * This function is called to only update the bounding box on the new layer from a block
1490
+ * moving to this layer from another layer. Thus, we only need to assess the effect of this
1491
+ * new block on the edges.
1492
+ */
1496
1493
1497
1494
if (x_new > bb_coord_old.xmax ) {
1498
1495
bb_edge_new.xmax = 1 ;
@@ -1801,10 +1798,10 @@ static double get_net_layer_bb_wire_cost(ClusterNetId /* net_id */,
1801
1798
continue ;
1802
1799
}
1803
1800
/*
1804
- adjust the bounding box half perimeter by the wirelength correction
1805
- factor based on terminal count, which is 1 for the source + the number
1806
- of sinks on this layer.
1807
- */
1801
+ * adjust the bounding box half perimeter by the wirelength correction
1802
+ * factor based on terminal count, which is 1 for the source + the number
1803
+ * of sinks on this layer.
1804
+ */
1808
1805
crossing = wirelength_crossing_count (layer_pin_sink_count[layer_num] + 1 );
1809
1806
1810
1807
/* Could insert a check for xmin == xmax. In that case, assume *
@@ -1856,45 +1853,44 @@ void get_cong_matrix(ClusterNetId net_id, const t_bb& bb) {
1856
1853
1857
1854
/* Cost = wire length along channel * cross_count / average *
1858
1855
* channel capacity. Do this for x, then y direction and add. */
1859
- for (int i= bb.xmin ;i< bb.xmax ;i++){
1860
- for (int j= bb.ymin ;j< bb.ymax ;j++){
1861
- cong_matrix[i][j] += get_net_wirelength_estimate (net_id,bb)/ double ((bb.xmax - bb.xmin + 1 )* (bb.ymax - bb.ymin + 1 ));
1856
+ for (int i = bb.xmin ; i < bb.xmax ; i++) {
1857
+ for (int j = bb.ymin ; j < bb.ymax ; j++) {
1858
+ cong_matrix[i][j] += get_net_wirelength_estimate (net_id, bb) / double ((bb.xmax - bb.xmin + 1 ) * (bb.ymax - bb.ymin + 1 ));
1862
1859
}
1863
1860
}
1864
1861
}
1865
1862
1866
-
1867
1863
double get_cong_cost (double chan_width) {
1868
1864
auto & device_ctx = g_vpr_ctx.device ();
1869
1865
double max = 0.0 ;
1870
- double avg = 1e-4 ,var= 0.0 ;
1866
+ double avg = 1e-4 , var = 0.0 ;
1871
1867
double num = 0.0 ;
1872
1868
double max_width = chan_width;
1873
- for (int i= 0 ;i< int (device_ctx.grid .width ());i++){
1874
- for (int j= 0 ;j< int (device_ctx.grid .height ());j++){
1875
- if (max< cong_matrix_new[i][j]){
1869
+ for (int i = 0 ; i < int (device_ctx.grid .width ()); i++) {
1870
+ for (int j = 0 ; j < int (device_ctx.grid .height ()); j++) {
1871
+ if (max < cong_matrix_new[i][j]) {
1876
1872
max = cong_matrix_new[i][j];
1877
1873
}
1878
1874
}
1879
1875
}
1880
1876
1881
- for (int i= 0 ;i< int (device_ctx.grid .width ());i++){
1882
- for (int j= 0 ;j< int (device_ctx.grid .height ());j++){
1883
- if (cong_matrix_new[i][j]> max_width){
1884
- avg+= cong_matrix_new[i][j]- max_width;
1885
- num+= 1.0 ;
1877
+ for (int i = 0 ; i < int (device_ctx.grid .width ()); i++) {
1878
+ for (int j = 0 ; j < int (device_ctx.grid .height ()); j++) {
1879
+ if (cong_matrix_new[i][j] > max_width) {
1880
+ avg += cong_matrix_new[i][j] - max_width;
1881
+ num += 1.0 ;
1886
1882
}
1887
1883
}
1888
1884
}
1889
1885
1890
- for (int i= 0 ;i< int (device_ctx.grid .width ());i++){
1891
- for (int j= 0 ;j< int (device_ctx.grid .height ());j++){
1892
- double var_var= cong_matrix_new[i][j]- avg;
1893
- var_var = var_var* var_var;
1886
+ for (int i = 0 ; i < int (device_ctx.grid .width ()); i++) {
1887
+ for (int j = 0 ; j < int (device_ctx.grid .height ()); j++) {
1888
+ double var_var = cong_matrix_new[i][j] - avg;
1889
+ var_var = var_var * var_var;
1894
1890
var += var_var;
1895
1891
}
1896
1892
}
1897
- var = var/ double ((device_ctx.grid .width ()* device_ctx.grid .height ()));
1893
+ var = var / double ((device_ctx.grid .width () * device_ctx.grid .height ()));
1898
1894
return avg;
1899
1895
}
1900
1896
@@ -1957,7 +1953,7 @@ static double wirelength_crossing_count(size_t fanout) {
1957
1953
}
1958
1954
1959
1955
static void set_bb_delta_cost (double & bb_delta_c) {
1960
- for (const ClusterNetId ts_net: ts_info.ts_nets_to_update ) {
1956
+ for (const ClusterNetId ts_net : ts_info.ts_nets_to_update ) {
1961
1957
ClusterNetId net_id = ts_net;
1962
1958
1963
1959
pl_net_cost.proposed_net_cost [net_id] = bb_updater.get_net_cost (net_id);
@@ -2017,9 +2013,9 @@ double comp_bb_cost(e_cost_methods method, const t_place_algorithm& place_algori
2017
2013
auto & place_move_ctx = g_placer_ctx.mutable_move ();
2018
2014
auto & device_ctx = g_vpr_ctx.device ();
2019
2015
// VTR_LOG("\n\n\nwidth = %d and height= %d\n\n\n",device_ctx.grid.width(), device_ctx.grid.height());
2020
- if (place_algorithm == CONGESTION_AWARE_PLACE){
2021
- for (int i = 0 ; i < int (device_ctx.grid .width ()); i++){
2022
- for (int j = 0 ; j < int (device_ctx.grid .height ()); j++){
2016
+ if (place_algorithm == CONGESTION_AWARE_PLACE) {
2017
+ for (int i = 0 ; i < int (device_ctx.grid .width ()); i++) {
2018
+ for (int j = 0 ; j < int (device_ctx.grid .height ()); j++) {
2023
2019
cong_matrix[i][j] = 0.0 ;
2024
2020
// cong_matrix_new[i][j] = 0.0;
2025
2021
}
@@ -2042,7 +2038,7 @@ double comp_bb_cost(e_cost_methods method, const t_place_algorithm& place_algori
2042
2038
place_move_ctx.num_sink_pin_layer [size_t (net_id)]);
2043
2039
}
2044
2040
2045
- if (place_algorithm == CONGESTION_AWARE_PLACE){
2041
+ if (place_algorithm == CONGESTION_AWARE_PLACE) {
2046
2042
get_cong_matrix (net_id, place_move_ctx.bb_coords [net_id]);
2047
2043
}
2048
2044
@@ -2053,19 +2049,19 @@ double comp_bb_cost(e_cost_methods method, const t_place_algorithm& place_algori
2053
2049
}
2054
2050
}
2055
2051
2056
- if (place_algorithm == CONGESTION_AWARE_PLACE){
2057
- for (int i = 0 ; i < int (device_ctx.grid .width ()); i++){
2058
- for (int j = 0 ; j < int (device_ctx.grid .height ()); j++){
2052
+ if (place_algorithm == CONGESTION_AWARE_PLACE) {
2053
+ for (int i = 0 ; i < int (device_ctx.grid .width ()); i++) {
2054
+ for (int j = 0 ; j < int (device_ctx.grid .height ()); j++) {
2059
2055
cong_matrix_new[i][j] = cong_matrix[i][j];
2060
2056
}
2061
2057
}
2062
2058
}
2063
2059
2064
2060
// cost = get_cong_cost();
2065
- if (place_algorithm == CONGESTION_AWARE_PLACE){
2066
- for (int i= 0 ;i< int (device_ctx.grid .width ());i++){
2067
- for (int j= 0 ;j< int (device_ctx.grid .height ());j++){
2068
- VTR_LOG (" %4.0f\t " ,cong_matrix[i][j]);
2061
+ if (place_algorithm == CONGESTION_AWARE_PLACE) {
2062
+ for (int i = 0 ; i < int (device_ctx.grid .width ()); i++) {
2063
+ for (int j = 0 ; j < int (device_ctx.grid .height ()); j++) {
2064
+ VTR_LOG (" %4.0f\t " , cong_matrix[i][j]);
2069
2065
}
2070
2066
VTR_LOG (" \n " );
2071
2067
}
@@ -2173,7 +2169,7 @@ void recompute_costs_from_scratch(const t_placer_opts& placer_opts,
2173
2169
2174
2170
double new_bb_cost = recompute_bb_cost ();
2175
2171
double new_cong_cost = 0.0 ;
2176
- if (placer_opts.place_algorithm == CONGESTION_AWARE_PLACE){
2172
+ if (placer_opts.place_algorithm == CONGESTION_AWARE_PLACE) {
2177
2173
new_cong_cost = get_cong_cost (placer_opts.congestion_tradeoff );
2178
2174
}
2179
2175
check_and_print_cost (new_bb_cost, costs->bb_cost , " bb_cost" );
@@ -2240,10 +2236,10 @@ void alloc_and_load_chan_w_factors_for_place_cost(float place_cost_exp) {
2240
2236
auto & device_ctx = g_vpr_ctx.device ();
2241
2237
2242
2238
/*
2243
- Access arrays below as chan?_place_cost_fac[subhigh][sublow]. Since subhigh must be greater than or
2244
- equal to sublow, we will only access the lower half of a matrix, but we allocate the whole matrix anyway
2245
- for simplicity so we can use the vtr utility matrix functions.
2246
- */
2239
+ * Access arrays below as chan?_place_cost_fac[subhigh][sublow]. Since subhigh must be greater than or
2240
+ * equal to sublow, we will only access the lower half of a matrix, but we allocate the whole matrix anyway
2241
+ * for simplicity so we can use the vtr utility matrix functions.
2242
+ */
2247
2243
2248
2244
chanx_place_cost_fac.resize ({device_ctx.grid .height (), device_ctx.grid .height () + 1 });
2249
2245
chany_place_cost_fac.resize ({device_ctx.grid .width (), device_ctx.grid .width () + 1 });
0 commit comments