Skip to content

Commit 59188ac

Browse files
committed
correcting code format
1 parent c680685 commit 59188ac

File tree

6 files changed

+118
-126
lines changed

6 files changed

+118
-126
lines changed

vpr/src/base/SetupVPR.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,6 @@ static void SetupNocOpts(const t_options& Options, t_noc_opts* NocOpts) {
784784
}
785785
NocOpts->noc_sat_routing_log_search_progress = Options.noc_sat_routing_log_search_progress;
786786
NocOpts->noc_placement_file_name = Options.noc_placement_file_name;
787-
788-
789787
}
790788

791789
static void SetupServerOpts(const t_options& Options, t_server_opts* ServerOpts) {

vpr/src/base/read_options.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ struct ParsePlaceAlgorithm {
398398
conv_value.set_value(CRITICALITY_TIMING_PLACE);
399399
} else if (str == "slack_timing") {
400400
conv_value.set_value(SLACK_TIMING_PLACE);
401-
} else if (str == "congestion_aware"){
401+
} else if (str == "congestion_aware") {
402402
conv_value.set_value(CONGESTION_AWARE_PLACE);
403403
} else {
404404
std::stringstream msg;
@@ -2075,7 +2075,6 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
20752075
.default_value({"100"})
20762076
.show_in(argparse::ShowIn::HELP_ONLY);
20772077

2078-
20792078
place_grp.add_argument(args.place_high_fanout_net, "--place_high_fanout_net")
20802079
.help(
20812080
"Sets the assumed high fanout net during placement. "
@@ -2244,7 +2243,7 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
22442243
" 0.0 focuses completely on wirelength, 1.0 completely on timing")
22452244
.default_value("0.5")
22462245
.show_in(argparse::ShowIn::HELP_ONLY);
2247-
2246+
22482247
place_timing_grp.add_argument(args.CongestionTradeoff, "--congest_tradeoff")
22492248
.help(
22502249
"Trade-off control the bouding value for the contestion matrix.\n"
@@ -2913,13 +2912,13 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
29132912
.default_value("0.25")
29142913
.show_in(argparse::ShowIn::HELP_ONLY);
29152914

2916-
noc_grp.add_argument<double>(args.noc_centroid_weight, "--noc_centroid_weight")
2915+
noc_grp.add_argument<double>(args.noc_centroid_weight, "--noc_centroid_weight")
29172916
.help(
29182917
"Sets the minimum fraction of swaps attempted by the placer that are NoC blocks."
29192918
"This value is an integer ranging from 0-100. 0 means NoC blocks will be moved at the same rate as other blocks. 100 means all swaps attempted by the placer are NoC router blocks.")
29202919
.default_value("0")
29212920
.show_in(argparse::ShowIn::HELP_ONLY);
2922-
2921+
29232922
noc_grp.add_argument<double>(args.noc_swap_percentage, "--noc_swap_percentage")
29242923
.help(
29252924
"Sets the minimum fraction of swaps attempted by the placer that are NoC blocks. "
@@ -2971,8 +2970,9 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
29712970
auto& server_grp = parser.add_argument_group("server options");
29722971

29732972
server_grp.add_argument<bool, ParseOnOff>(args.is_server_mode_enabled, "--server")
2974-
.help("Run in server mode."
2975-
"Accept client application connection and respond to requests." )
2973+
.help(
2974+
"Run in server mode."
2975+
"Accept client application connection and respond to requests.")
29762976
.action(argparse::Action::STORE_TRUE)
29772977
.default_value("off");
29782978

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ class t_place_algorithm {
10941094

10951095
///@brief Check if the algorithm belongs to the timing driven category.
10961096
inline bool is_timing_driven() const {
1097-
return algo == CRITICALITY_TIMING_PLACE || algo == SLACK_TIMING_PLACE || algo== CONGESTION_AWARE_PLACE;
1097+
return algo == CRITICALITY_TIMING_PLACE || algo == SLACK_TIMING_PLACE || algo == CONGESTION_AWARE_PLACE;
10981098
}
10991099

11001100
///@brief Accessor: returns the underlying e_place_algorithm enum value.

vpr/src/place/net_cost_handler.cpp

Lines changed: 51 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ static void update_layer_bb(ClusterNetId net_id,
299299
bool is_output_pin);
300300

301301
/**
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.
304304
* @param net_id ID of the net which the moving pin belongs to
305305
* @param pin_old_loc Old location of the moving pin
306306
* @param pin_new_loc New location of the moving pin
@@ -509,8 +509,7 @@ void BBUpdater::get_non_updatable_bb(const ClusterNetId& net) {
509509
::get_non_updatable_bb(net,
510510
ts_info.ts_bb_coord_new[net],
511511
ts_info.ts_layer_sink_pin_count[size_t(net)]);
512-
}
513-
else {
512+
} else {
514513
::get_non_updatable_layer_bb(net,
515514
ts_info.layer_ts_bb_coord_new[net],
516515
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,
526525
pin_old_loc,
527526
pin_new_loc,
528527
is_driver);
529-
}
530-
else {
528+
} else {
531529
::update_layer_bb(net_id,
532530
ts_info.layer_ts_bb_edge_new[net_id],
533531
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,
541539
double BBUpdater::get_net_cost(const ClusterNetId net_id) {
542540
if (m_cube_bb) {
543541
return ::get_net_cost(net_id, ts_info.ts_bb_coord_new[net_id]);
544-
}
545-
else {
542+
} else {
546543
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)]);
547544
}
548545
}
@@ -1381,10 +1378,10 @@ static inline void update_bb_layer_changed(ClusterNetId net_id,
13811378
VTR_ASSERT_SAFE(old_layer_num != new_layer_num);
13821379

13831380
/*
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+
*/
13881385
if (x_old == curr_bb_coord[old_layer_num].xmax) {
13891386
update_bb_edge(net_id,
13901387
bb_edge_new,
@@ -1489,10 +1486,10 @@ static void add_block_to_bb(const t_physical_tile_loc& new_pin_loc,
14891486
int y_new = new_pin_loc.y;
14901487

14911488
/*
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+
*/
14961493

14971494
if (x_new > bb_coord_old.xmax) {
14981495
bb_edge_new.xmax = 1;
@@ -1801,10 +1798,10 @@ static double get_net_layer_bb_wire_cost(ClusterNetId /* net_id */,
18011798
continue;
18021799
}
18031800
/*
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+
*/
18081805
crossing = wirelength_crossing_count(layer_pin_sink_count[layer_num] + 1);
18091806

18101807
/* 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) {
18561853

18571854
/* Cost = wire length along channel * cross_count / average *
18581855
* 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));
18621859
}
18631860
}
18641861
}
18651862

1866-
18671863
double get_cong_cost(double chan_width) {
18681864
auto& device_ctx = g_vpr_ctx.device();
18691865
double max = 0.0;
1870-
double avg = 1e-4,var=0.0;
1866+
double avg = 1e-4, var = 0.0;
18711867
double num = 0.0;
18721868
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]) {
18761872
max = cong_matrix_new[i][j];
18771873
}
18781874
}
18791875
}
18801876

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;
18861882
}
18871883
}
18881884
}
18891885

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;
18941890
var += var_var;
18951891
}
18961892
}
1897-
var = var/double((device_ctx.grid.width()*device_ctx.grid.height()));
1893+
var = var / double((device_ctx.grid.width() * device_ctx.grid.height()));
18981894
return avg;
18991895
}
19001896

@@ -1957,7 +1953,7 @@ static double wirelength_crossing_count(size_t fanout) {
19571953
}
19581954

19591955
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) {
19611957
ClusterNetId net_id = ts_net;
19621958

19631959
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
20172013
auto& place_move_ctx = g_placer_ctx.mutable_move();
20182014
auto& device_ctx = g_vpr_ctx.device();
20192015
// 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++) {
20232019
cong_matrix[i][j] = 0.0;
20242020
// cong_matrix_new[i][j] = 0.0;
20252021
}
@@ -2042,7 +2038,7 @@ double comp_bb_cost(e_cost_methods method, const t_place_algorithm& place_algori
20422038
place_move_ctx.num_sink_pin_layer[size_t(net_id)]);
20432039
}
20442040

2045-
if(place_algorithm == CONGESTION_AWARE_PLACE){
2041+
if (place_algorithm == CONGESTION_AWARE_PLACE) {
20462042
get_cong_matrix(net_id, place_move_ctx.bb_coords[net_id]);
20472043
}
20482044

@@ -2053,19 +2049,19 @@ double comp_bb_cost(e_cost_methods method, const t_place_algorithm& place_algori
20532049
}
20542050
}
20552051

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++) {
20592055
cong_matrix_new[i][j] = cong_matrix[i][j];
20602056
}
20612057
}
20622058
}
20632059

20642060
// 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]);
20692065
}
20702066
VTR_LOG("\n");
20712067
}
@@ -2173,7 +2169,7 @@ void recompute_costs_from_scratch(const t_placer_opts& placer_opts,
21732169

21742170
double new_bb_cost = recompute_bb_cost();
21752171
double new_cong_cost = 0.0;
2176-
if(placer_opts.place_algorithm == CONGESTION_AWARE_PLACE){
2172+
if (placer_opts.place_algorithm == CONGESTION_AWARE_PLACE) {
21772173
new_cong_cost = get_cong_cost(placer_opts.congestion_tradeoff);
21782174
}
21792175
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) {
22402236
auto& device_ctx = g_vpr_ctx.device();
22412237

22422238
/*
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+
*/
22472243

22482244
chanx_place_cost_fac.resize({device_ctx.grid.height(), device_ctx.grid.height() + 1});
22492245
chany_place_cost_fac.resize({device_ctx.grid.width(), device_ctx.grid.width() + 1});

0 commit comments

Comments
 (0)