From 21e156882bd65e0cc2ac671ed6cfda7db2cf7933 Mon Sep 17 00:00:00 2001 From: Meet Patel <77514463+Meet-Patel2580@users.noreply.github.com> Date: Sun, 3 Sep 2023 18:04:10 -0400 Subject: [PATCH] Formatted code ran the make format command --- vpr/src/draw/draw.cpp | 124 +++++++++++++++++++++--------------------- vpr/src/draw/draw.h | 2 +- 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/vpr/src/draw/draw.cpp b/vpr/src/draw/draw.cpp index f46b4d7aeea..d4e22cd3c95 100644 --- a/vpr/src/draw/draw.cpp +++ b/vpr/src/draw/draw.cpp @@ -995,54 +995,54 @@ static void highlight_blocks(double x, double y) { t_draw_state* draw_state = get_draw_state_vars(); char msg[vtr::bufsize]; - ClusterBlockId clb_index = get_cluster_block_id_from_xy_loc(x,y); + ClusterBlockId clb_index = get_cluster_block_id_from_xy_loc(x, y); if (clb_index == EMPTY_BLOCK_ID || clb_index == ClusterBlockId::INVALID()) { return; /* Nothing was found on any layer*/ } - auto& cluster_ctx = g_vpr_ctx.clustering(); - auto& place_ctx = g_vpr_ctx.placement(); + auto& cluster_ctx = g_vpr_ctx.clustering(); + auto& place_ctx = g_vpr_ctx.placement(); - VTR_ASSERT(clb_index != EMPTY_BLOCK_ID); + VTR_ASSERT(clb_index != EMPTY_BLOCK_ID); - ezgl::rectangle clb_bbox = draw_coords->get_absolute_clb_bbox(clb_index,cluster_ctx.clb_nlist.block_type(clb_index)); - // note: this will clear the selected sub-block if show_blk_internal is 0, - // or if it doesn't find anything - ezgl::point2d point_in_clb = ezgl::point2d(x, y) - clb_bbox.bottom_left(); - highlight_sub_block(point_in_clb, clb_index, - cluster_ctx.clb_nlist.block_pb(clb_index)); + ezgl::rectangle clb_bbox = draw_coords->get_absolute_clb_bbox(clb_index, cluster_ctx.clb_nlist.block_type(clb_index)); + // note: this will clear the selected sub-block if show_blk_internal is 0, + // or if it doesn't find anything + ezgl::point2d point_in_clb = ezgl::point2d(x, y) - clb_bbox.bottom_left(); + highlight_sub_block(point_in_clb, clb_index, + cluster_ctx.clb_nlist.block_pb(clb_index)); - if (get_selected_sub_block_info().has_selection()) { - t_pb* selected_subblock = get_selected_sub_block_info().get_selected_pb(); - sprintf(msg, "sub-block %s (a \"%s\") selected", - selected_subblock->name, - selected_subblock->pb_graph_node->pb_type->name); - } else { - /* Highlight block and fan-in/fan-outs. */ - draw_highlight_blocks_color(cluster_ctx.clb_nlist.block_type(clb_index), - clb_index); - sprintf(msg, "Block #%zu (%s) at (%d, %d) selected.", size_t(clb_index), - cluster_ctx.clb_nlist.block_name(clb_index).c_str(), - place_ctx.block_locs[clb_index].loc.x, - place_ctx.block_locs[clb_index].loc.y); - } + if (get_selected_sub_block_info().has_selection()) { + t_pb* selected_subblock = get_selected_sub_block_info().get_selected_pb(); + sprintf(msg, "sub-block %s (a \"%s\") selected", + selected_subblock->name, + selected_subblock->pb_graph_node->pb_type->name); + } else { + /* Highlight block and fan-in/fan-outs. */ + draw_highlight_blocks_color(cluster_ctx.clb_nlist.block_type(clb_index), + clb_index); + sprintf(msg, "Block #%zu (%s) at (%d, %d) selected.", size_t(clb_index), + cluster_ctx.clb_nlist.block_name(clb_index).c_str(), + place_ctx.block_locs[clb_index].loc.x, + place_ctx.block_locs[clb_index].loc.y); + } - //If manual moves is activated, then user can select block from the grid. - if (draw_state->manual_moves_state.manual_move_enabled) { - draw_state->manual_moves_state.user_highlighted_block = true; - if (!draw_state->manual_moves_state.manual_move_window_is_open) { - draw_manual_moves_window(std::to_string(size_t(clb_index))); - } + //If manual moves is activated, then user can select block from the grid. + if (draw_state->manual_moves_state.manual_move_enabled) { + draw_state->manual_moves_state.user_highlighted_block = true; + if (!draw_state->manual_moves_state.manual_move_window_is_open) { + draw_manual_moves_window(std::to_string(size_t(clb_index))); } + } - application.update_message(msg); - application.refresh_drawing(); - return; + application.update_message(msg); + application.refresh_drawing(); + return; } -ClusterBlockId get_cluster_block_id_from_xy_loc(double x,double y){ - t_draw_coords* draw_coords = get_draw_coords_vars(); - t_draw_state* draw_state = get_draw_state_vars(); +ClusterBlockId get_cluster_block_id_from_xy_loc(double x, double y) { + t_draw_coords* draw_coords = get_draw_coords_vars(); + t_draw_state* draw_state = get_draw_state_vars(); ClusterBlockId clb_index = EMPTY_BLOCK_ID; auto& device_ctx = g_vpr_ctx.device(); auto& cluster_ctx = g_vpr_ctx.clustering(); @@ -1052,36 +1052,36 @@ ClusterBlockId get_cluster_block_id_from_xy_loc(double x,double y){ ezgl::rectangle clb_bbox; //iterate over grid z (layers) first. Start search of the block at the top layer to prioritize highlighting of blocks at higher levels during overlapping of layers. - for (int layer_num = device_ctx.grid.get_num_layers()-1; layer_num >= 0 ; layer_num--) { - if (!draw_state->draw_layer_display[layer_num].visible) { - continue; /* Don't check for blocks on non-visible layers*/ + for (int layer_num = device_ctx.grid.get_num_layers() - 1; layer_num >= 0; layer_num--) { + if (!draw_state->draw_layer_display[layer_num].visible) { + continue; /* Don't check for blocks on non-visible layers*/ + } + // iterate over grid x + for (int i = 0; i < (int)device_ctx.grid.width(); ++i) { + if (draw_coords->tile_x[i] > x) { + break; // we've gone too far in the x direction + } + // iterate over grid y + for (int j = 0; j < (int)device_ctx.grid.height(); ++j) { + if (draw_coords->tile_y[j] > y) { + break; // we've gone too far in the y direction } - // iterate over grid x - for (int i = 0; i < (int)device_ctx.grid.width(); ++i) { - if (draw_coords->tile_x[i] > x) { - break; // we've gone too far in the x direction - } - // iterate over grid y - for (int j = 0; j < (int)device_ctx.grid.height(); ++j) { - if (draw_coords->tile_y[j] > y) { - break; // we've gone too far in the y direction - } - // iterate over sub_blocks - const auto& type = device_ctx.grid.get_physical_type({i, j, layer_num}); - for (int k = 0; k < type->capacity; ++k) { - clb_index = place_ctx.grid_blocks.block_at_location({i, j, k, layer_num}); - if (clb_index != EMPTY_BLOCK_ID) { - clb_bbox = draw_coords->get_absolute_clb_bbox(clb_index, - cluster_ctx.clb_nlist.block_type(clb_index)); - if (clb_bbox.contains({x, y})) { - return clb_index; // we've found the clb - } else { - clb_index = EMPTY_BLOCK_ID; - } - } + // iterate over sub_blocks + const auto& type = device_ctx.grid.get_physical_type({i, j, layer_num}); + for (int k = 0; k < type->capacity; ++k) { + clb_index = place_ctx.grid_blocks.block_at_location({i, j, k, layer_num}); + if (clb_index != EMPTY_BLOCK_ID) { + clb_bbox = draw_coords->get_absolute_clb_bbox(clb_index, + cluster_ctx.clb_nlist.block_type(clb_index)); + if (clb_bbox.contains({x, y})) { + return clb_index; // we've found the clb + } else { + clb_index = EMPTY_BLOCK_ID; } } } + } + } } // Searched all layers and found no clb at specified location, returning clb_index = EMPTY_BLOCK_ID. return clb_index; diff --git a/vpr/src/draw/draw.h b/vpr/src/draw/draw.h index 03f8ca7fd69..dcc9b0f51eb 100644 --- a/vpr/src/draw/draw.h +++ b/vpr/src/draw/draw.h @@ -164,7 +164,7 @@ t_draw_layer_display get_element_visibility_and_transparency(int src_layer, int * @return returns the ClusterBlockId of the clb at the specified (x,y) location as seen by looking downwards from the top of a 3D FPGA. * Chooses the clb on the top visible layer if there are overlapping blocks. Returns EMPTY_BLOCK_ID (-1) otherwise,if clb is not found on any visible layer. */ -ClusterBlockId get_cluster_block_id_from_xy_loc(double x,double y); +ClusterBlockId get_cluster_block_id_from_xy_loc(double x, double y); #endif /* NO_GRAPHICS */