Skip to content

Commit 11d01c0

Browse files
committed
renamed certain variables for clarity
1 parent a958d7e commit 11d01c0

File tree

10 files changed

+36
-40
lines changed

10 files changed

+36
-40
lines changed

vpr/src/draw/draw_basic.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ void draw_congestion(ezgl::renderer* g) {
357357

358358
case e_rr_type::IPIN: //fallthrough
359359
case e_rr_type::OPIN:
360-
draw_rr_pin(inode, color, g);
360+
draw_cluster_pin(inode, color, g);
361361
break;
362362
default:
363363
break;
@@ -633,13 +633,13 @@ void draw_partial_route(const std::vector<RRNodeId>& rr_nodes_to_draw, ezgl::ren
633633

634634
// Draw intra-cluster nodes
635635
if (!is_inode_inter_cluster) {
636-
draw_rr_intrapin(inode, color, g);
636+
draw_rr_intra_cluster_pin(inode, color, g);
637637
continue;
638638
}
639639

640640
// Draw cluster-level IO Pins
641641
if (rr_type == e_rr_type::OPIN || rr_type == e_rr_type::IPIN) {
642-
draw_rr_pin(inode, color, g);
642+
draw_cluster_pin(inode, color, g);
643643
continue;
644644
}
645645

@@ -655,12 +655,12 @@ void draw_partial_route(const std::vector<RRNodeId>& rr_nodes_to_draw, ezgl::ren
655655

656656
RRNodeId inode = rr_nodes_to_draw[i];
657657
auto rr_type = rr_graph.node_type(inode);
658-
bool is_inode_inter_cluster = is_inter_cluster_node(rr_graph, inode);
658+
bool inode_inter_cluster = is_inter_cluster_node(rr_graph, inode);
659659
int current_node_layer = rr_graph.node_layer(inode);
660660

661661
RRNodeId prev_node = rr_nodes_to_draw[i - 1];
662662
auto prev_type = rr_graph.node_type(RRNodeId(prev_node));
663-
bool is_prev_node_inter_cluster = is_inter_cluster_node(rr_graph, prev_node);
663+
bool prev_node_inter_cluster = is_inter_cluster_node(rr_graph, prev_node);
664664
int prev_node_layer = rr_graph.node_layer(prev_node);
665665

666666
t_draw_layer_display edge_visibility = get_element_visibility_and_transparency(prev_node_layer, current_node_layer);
@@ -678,18 +678,17 @@ void draw_partial_route(const std::vector<RRNodeId>& rr_nodes_to_draw, ezgl::ren
678678

679679
g->set_color(color, edge_visibility.alpha);
680680

681-
if (!is_inode_inter_cluster && !is_prev_node_inter_cluster) {
682-
draw_intrapin_to_intrapin(inode, prev_node, g);
681+
if (!inode_inter_cluster && !prev_node_inter_cluster) {
682+
draw_intra_cluster_edge(inode, prev_node, g);
683683
continue;
684684
}
685685

686-
if (!is_inode_inter_cluster || !is_prev_node_inter_cluster) {
687-
draw_intrapin_to_pin(inode, prev_node, g);
686+
if (!inode_inter_cluster || !prev_node_inter_cluster) {
687+
draw_intra_cluster_pin_to_pin(inode, prev_node, g);
688688
continue;
689689
}
690690

691691
draw_inter_cluster_rr_edge(inode, prev_node, rr_type, prev_type, rr_graph, g);
692-
693692
}
694693
}
695694

@@ -723,8 +722,8 @@ void draw_inter_cluster_rr_edge(RRNodeId inode, RRNodeId prev_node, e_rr_type rr
723722
}
724723
default: {
725724
VPR_ERROR(VPR_ERROR_OTHER,
726-
"Unexpected connection from an rr_node of type %d to one of type %d.\n",
727-
prev_type, rr_type);
725+
"Unexpected connection from an rr_node of type %d to one of type %d.\n",
726+
prev_type, rr_type);
728727
}
729728
}
730729
break;
@@ -733,12 +732,12 @@ void draw_inter_cluster_rr_edge(RRNodeId inode, RRNodeId prev_node, e_rr_type rr
733732
switch (prev_type) {
734733
case e_rr_type::CHANX: {
735734
draw_chanx_to_chany_edge(prev_node, inode,
736-
FROM_X_TO_Y, switch_type, g);
735+
FROM_X_TO_Y, switch_type, g);
737736
break;
738737
}
739738
case e_rr_type::CHANY: {
740739
draw_chany_to_chany_edge(RRNodeId(prev_node), RRNodeId(inode),
741-
switch_type, g);
740+
switch_type, g);
742741
break;
743742
}
744743
case e_rr_type::OPIN: {
@@ -748,8 +747,8 @@ void draw_inter_cluster_rr_edge(RRNodeId inode, RRNodeId prev_node, e_rr_type rr
748747
}
749748
default: {
750749
VPR_ERROR(VPR_ERROR_OTHER,
751-
"Unexpected connection from an rr_node of type %d to one of type %d.\n",
752-
prev_type, rr_type);
750+
"Unexpected connection from an rr_node of type %d to one of type %d.\n",
751+
prev_type, rr_type);
753752
}
754753
}
755754
break;
@@ -759,7 +758,6 @@ void draw_inter_cluster_rr_edge(RRNodeId inode, RRNodeId prev_node, e_rr_type rr
759758
}
760759
}
761760
}
762-
763761

764762
/* Helper function that checks whether the edges between the current and previous nodes can be drawn
765763
* based on whether the cross-layer connections option is enabled and whether the layer on which the

vpr/src/draw/draw_rr.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ void draw_rr(ezgl::renderer* g) {
107107
break;
108108

109109
case e_rr_type::IPIN:
110-
draw_rr_pin(inode, draw_state->draw_rr_node[inode].color, g);
110+
draw_cluster_pin(inode, draw_state->draw_rr_node[inode].color, g);
111111
draw_rr_edges(inode, g);
112112
break;
113113

114114
case e_rr_type::OPIN:
115-
draw_rr_pin(inode, draw_state->draw_rr_node[inode].color, g);
115+
draw_cluster_pin(inode, draw_state->draw_rr_node[inode].color, g);
116116
draw_rr_edges(inode, g);
117117
break;
118118

@@ -513,7 +513,7 @@ void draw_rr_edges(RRNodeId inode, ezgl::renderer* g) {
513513
} /* End of for each edge loop */
514514
}
515515

516-
void draw_rr_intrapin(RRNodeId inode, const ezgl::color& color, ezgl::renderer* g) {
516+
void draw_rr_intra_cluster_pin(RRNodeId inode, const ezgl::color& color, ezgl::renderer* g) {
517517
t_draw_state* draw_state = get_draw_state_vars();
518518
t_draw_coords* draw_coords = get_draw_coords_vars();
519519

@@ -536,7 +536,7 @@ void draw_rr_intrapin(RRNodeId inode, const ezgl::color& color, ezgl::renderer*
536536
/* Draws an IPIN or OPIN rr_node. Note that the pin can appear on more *
537537
* than one side of a clb. Also note that this routine can change the *
538538
* current color to BLACK. */
539-
void draw_rr_pin(RRNodeId inode, const ezgl::color& color, ezgl::renderer* g) {
539+
void draw_cluster_pin(RRNodeId inode, const ezgl::color& color, ezgl::renderer* g) {
540540
t_draw_coords* draw_coords = get_draw_coords_vars();
541541

542542
float xcen, ycen;
@@ -866,11 +866,11 @@ void draw_rr_costs(ezgl::renderer* g, const vtr::vector<RRNodeId, float>& rr_cos
866866
break;
867867

868868
case e_rr_type::IPIN: //fallthrough
869-
draw_rr_pin(inode, color, g);
869+
draw_cluster_pin(inode, color, g);
870870
if (with_edges) draw_rr_edges(inode, g);
871871
break;
872872
case e_rr_type::OPIN:
873-
draw_rr_pin(inode, color, g);
873+
draw_cluster_pin(inode, color, g);
874874
if (with_edges) draw_rr_edges(inode, g);
875875
break;
876876
case e_rr_type::SOURCE:

vpr/src/draw/draw_rr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ void draw_rr_chan(RRNodeId inode, const ezgl::color color, ezgl::renderer* g);
3030
/**
3131
* @brief Draws the intra-cluster pin for a given RRNodeId when flat routing is enabled.
3232
*/
33-
void draw_rr_intrapin(RRNodeId inode, const ezgl::color& color, ezgl::renderer* g);
33+
void draw_rr_intra_cluster_pin(RRNodeId inode, const ezgl::color& color, ezgl::renderer* g);
3434
/* Draws an IPIN or OPIN rr_node. Note that the pin can appear on more
3535
* than one side of a clb. Also note that this routine can change the
3636
* current color to BLACK. */
37-
void draw_rr_pin(RRNodeId inode, const ezgl::color& color, ezgl::renderer* g);
37+
void draw_cluster_pin(RRNodeId inode, const ezgl::color& color, ezgl::renderer* g);
3838

3939
void draw_rr_src_sink(RRNodeId inode, ezgl::color color, ezgl::renderer* g);
4040
void draw_get_rr_src_sink_coords(const t_rr_node& node, float* xcen, float* ycen);

vpr/src/draw/draw_rr_edges.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ void draw_chanx_to_chany_edge(RRNodeId chanx_node, RRNodeId chany_node, enum e_e
279279
}
280280
}
281281

282-
void draw_intrapin_to_intrapin(RRNodeId inode, RRNodeId prev_node, ezgl::renderer* g) {
282+
void draw_intra_cluster_edge(RRNodeId inode, RRNodeId prev_node, ezgl::renderer* g) {
283283
t_draw_state* draw_state = get_draw_state_vars();
284284
t_draw_coords* draw_coords = get_draw_coords_vars();
285285

@@ -300,7 +300,7 @@ void draw_intrapin_to_intrapin(RRNodeId inode, RRNodeId prev_node, ezgl::rendere
300300
draw_triangle_along_line(g, triangle_coord_x, triangle_coord_y, prev_coord.x, icoord.x, prev_coord.y, icoord.y);
301301
}
302302

303-
void draw_intrapin_to_pin(RRNodeId inode, RRNodeId prev_node, ezgl::renderer* g) {
303+
void draw_intra_cluster_pin_to_pin(RRNodeId inode, RRNodeId prev_node, ezgl::renderer* g) {
304304
t_draw_state* draw_state = get_draw_state_vars();
305305
t_draw_coords* draw_coords = get_draw_coords_vars();
306306

@@ -344,7 +344,6 @@ void draw_intrapin_to_pin(RRNodeId inode, RRNodeId prev_node, ezgl::renderer* g)
344344
float triangle_coord_x = icoord.x + (prev_coord.x - icoord.x) / 10.;
345345
float triangle_coord_y = icoord.y + (prev_coord.y - icoord.y) / 10.;
346346
draw_triangle_along_line(g, triangle_coord_x, triangle_coord_y, prev_coord.x, icoord.x, prev_coord.y, icoord.y);
347-
348347
}
349348

350349
void draw_pin_to_pin(RRNodeId opin_node, RRNodeId ipin_node, ezgl::renderer* g) {

vpr/src/draw/draw_rr_edges.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ void draw_chanx_to_chany_edge(RRNodeId chanx_node, RRNodeId chany_node, enum e_e
4343
* @param prev_node The previous node to draw from
4444
* @param g The ezgl renderer
4545
*/
46-
void draw_intrapin_to_pin(RRNodeId inode, RRNodeId prev_node, ezgl::renderer* g);
46+
void draw_intra_cluster_pin_to_pin(RRNodeId inode, RRNodeId prev_node, ezgl::renderer* g);
4747
/**
4848
* @brief Draws the edge between two intra-cluster pins when flat routing is enabled.
4949
* @param inode The current node to draw to
5050
* @param prev_node The previous node to draw from
5151
* @param g The ezgl renderer
5252
*/
53-
void draw_intrapin_to_intrapin(RRNodeId inode, RRNodeId prev_node, ezgl::renderer* g);
53+
void draw_intra_cluster_edge(RRNodeId inode, RRNodeId prev_node, ezgl::renderer* g);
5454

5555
/**
5656
* @brief This routine directly draws an edge from an inter-cluster output pin to an inter-cluster input pin.

vpr/src/draw/draw_searchbar.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ ezgl::rectangle draw_get_rr_chan_bbox(RRNodeId inode);
2626
/* Highlights a block and its fanout/fanin. */
2727
void draw_highlight_blocks_color(t_logical_block_type_ptr type, ClusterBlockId blk_id);
2828

29-
3029
/**
3130
* @brief Highlights the net associated with the specified RRNodeId in Magenta. De-highlights all other nets. Also appends relevant net information to the provided message char pointer.
3231
*

vpr/src/draw/draw_types.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ ezgl::rectangle t_draw_coords::get_absolute_pb_bbox(const ClusterBlockId clb_ind
152152
}
153153

154154
ezgl::point2d t_draw_coords::get_absolute_pin_location(const ClusterBlockId clb_index, const t_pb_graph_pin* pb_graph_pin) {
155-
// Pins are positioned on a horizontal row at the top of each internal block.
155+
// Pins are positioned on a horizontal row at the top of each internal block.
156156

157157
t_pb_graph_node* pb_gnode = pb_graph_pin->parent_node;
158158
ezgl::rectangle pb_bbox = this->get_absolute_pb_bbox(clb_index, pb_gnode);

vpr/src/draw/intra_logic_block.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#include "draw.h"
3535
#include "draw_triangle.h"
3636

37+
constexpr float FRACTION_TEXT_PADDING = 0.01;
38+
3739
/************************* Subroutines local to this file. *******************************/
3840

3941
/**
@@ -262,7 +264,7 @@ static void draw_internal_load_coords(int type_descrip_index, t_pb_graph_node* p
262264
/* Find the number of instances for each child pb_type. */
263265
int num_pb = mode.pb_type_children[j].num_pb;
264266

265-
// Determine how we want to arrange the sub-blocks in the parent block. We want the blocks to be squarish, and not too wide or too tall. In other words, we want the number of rows to be as close to the number of columns as possible such that num_rows * num_columns = num_blocks.
267+
// Determine how we want to arrange the sub-blocks in the parent block. We want the blocks to be squarish, and not too wide or too tall. In other words, we want the number of rows to be as close to the number of columns as possible such that num_rows * num_columns = num_blocks.
266268

267269
int num_blocks = num_pb * num_children;
268270

@@ -313,10 +315,9 @@ draw_internal_calc_coords(int type_descrip_index, t_pb_graph_node* pb_graph_node
313315

314316
float tile_width = get_draw_coords_vars()->get_tile_width();
315317

316-
const float FRACTION_PARENT_PADDING = 0.005;
317-
const float FRACTION_CHILD_MARGIN = 0.003;
318-
const float FRACTION_TEXT_PADDING = 0.01;
319-
const int MIN_WIDTH_HEIGHT_RATIO = 2;
318+
constexpr float FRACTION_PARENT_PADDING = 0.005;
319+
constexpr float FRACTION_CHILD_MARGIN = 0.003;
320+
constexpr int MIN_WIDTH_HEIGHT_RATIO = 2;
320321

321322
float abs_parent_padding = tile_width * FRACTION_PARENT_PADDING;
322323
float abs_text_padding = tile_width * FRACTION_TEXT_PADDING;
@@ -445,7 +446,7 @@ static void draw_internal_pb(const ClusterBlockId clb_index, t_pb* pb, const ezg
445446
if (draw_state->draw_block_text) {
446447
g->draw_text(
447448
ezgl::point2d(abs_bbox.center_x(),
448-
abs_bbox.top() - draw_coords->get_tile_height() * 0.01),
449+
abs_bbox.top() - draw_coords->get_tile_height() * FRACTION_TEXT_PADDING),
449450
pb_type->name,
450451
abs_bbox.width(),
451452
abs_bbox.height());

vpr/src/draw/search_bar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ bool highlight_rr_nodes(RRNodeId hit_node) {
248248

249249
if (draw_state->show_nets)
250250
highlight_nets(message, hit_node);
251-
251+
252252
application.update_message(message);
253253

254254
application.refresh_drawing();

vpr/src/util/vpr_utils.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,6 @@ t_pb_graph_pin* get_pb_graph_node_pin_from_model_port_pin(const t_model_ports* m
857857
return nullptr;
858858
}
859859

860-
861860
AtomPinId find_atom_pin(ClusterBlockId blk_id, const t_pb_graph_pin* pb_gpin) {
862861
auto& cluster_ctx = g_vpr_ctx.clustering();
863862
auto& atom_ctx = g_vpr_ctx.atom();

0 commit comments

Comments
 (0)