Skip to content

Commit b98b952

Browse files
committed
Added a few constants for performance and readability.
Signed-off-by: Ethan Rogers <[email protected]>
1 parent 1a034f5 commit b98b952

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

vpr/src/draw/draw.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,17 +3021,18 @@ static void draw_pin_to_chan_edge(int pin_node, int chan_node, ezgl::renderer* g
30213021
* Any rr_node of a grid should have at least 1 side!!!
30223022
*/
30233023
e_side pin_side = NUM_SIDES;
3024+
const t_rr_type channel_type = rr_graph.node_type(RRNodeId(chan_node));
30243025
if (1 == pin_candidate_sides.size()) {
30253026
pin_side = pin_candidate_sides[0];
30263027
} else {
30273028
VTR_ASSERT(1 < pin_candidate_sides.size());
3028-
if (CHANX == rr_graph.node_type(RRNodeId(chan_node)) && pin_rr.ylow() <= chan_rr.ylow()) {
3029+
if (CHANX == channel_type && pin_rr.ylow() <= chan_rr.ylow()) {
30293030
pin_side = TOP;
3030-
} else if (CHANX == rr_graph.node_type(RRNodeId(chan_node)) && pin_rr.ylow() - 1 >= chan_rr.ylow()) {
3031+
} else if (CHANX == channel_type && pin_rr.ylow() - 1 >= chan_rr.ylow()) {
30313032
pin_side = BOTTOM;
3032-
} else if (CHANY == rr_graph.node_type(RRNodeId(chan_node)) && pin_rr.xlow() <= chan_rr.xlow()) {
3033+
} else if (CHANY == channel_type && pin_rr.xlow() <= chan_rr.xlow()) {
30333034
pin_side = RIGHT;
3034-
} else if (CHANY == rr_graph.node_type(RRNodeId(chan_node)) && pin_rr.xlow() - 1 >= chan_rr.xlow()) {
3035+
} else if (CHANY == channel_type && pin_rr.xlow() - 1 >= chan_rr.xlow()) {
30353036
pin_side = LEFT;
30363037
}
30373038
/* The inferred side must be in the list of sides of the pin rr_node!!! */
@@ -3078,7 +3079,7 @@ static void draw_pin_to_chan_edge(int pin_node, int chan_node, ezgl::renderer* g
30783079
ezgl::rectangle chan_bbox = draw_get_rr_chan_bbox(chan_node);
30793080

30803081
float x2 = 0, y2 = 0;
3081-
switch (rr_graph.node_type(RRNodeId(chan_node))) {
3082+
switch (channel_type) {
30823083
case CHANX: {
30833084
y1 += draw_pin_offset;
30843085
y2 = chan_bbox.bottom();

vpr/src/route/route_timing.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,8 @@ static size_t calculate_wirelength_available() {
16671667
size_t available_wirelength = 0;
16681668
// But really what's happening is that this for loop iterates over every node and determines the available wirelength
16691669
for (size_t i = 0; i < device_ctx.rr_nodes.size(); ++i) {
1670-
if (rr_graph.node_type(RRNodeId(i)) == CHANX || rr_graph.node_type(RRNodeId(i)) == CHANY) {
1670+
const t_rr_type channel_type = rr_graph.node_type(RRNodeId(i));
1671+
if (channel_type == CHANX || channel_type == CHANY) {
16711672
size_t length_x = device_ctx.rr_nodes[i].xhigh() - device_ctx.rr_nodes[i].xlow();
16721673
size_t length_y = device_ctx.rr_nodes[i].yhigh() - device_ctx.rr_nodes[i].ylow();
16731674

0 commit comments

Comments
 (0)