@@ -1102,6 +1102,7 @@ static void draw_congestion(ezgl::renderer* g) {
1102
1102
}
1103
1103
1104
1104
auto & device_ctx = g_vpr_ctx.device ();
1105
+ const auto & rr_graph = device_ctx.rr_graph ;
1105
1106
auto & route_ctx = g_vpr_ctx.routing ();
1106
1107
1107
1108
// Record min/max congestion
@@ -1178,7 +1179,7 @@ static void draw_congestion(ezgl::renderer* g) {
1178
1179
1179
1180
ezgl::color color = to_ezgl_color (cmap->color (congestion_ratio));
1180
1181
1181
- switch (device_ctx. rr_nodes [inode]. type ( )) {
1182
+ switch (rr_graph. node_type ( RRNodeId (inode) )) {
1182
1183
case CHANX: // fallthrough
1183
1184
case CHANY:
1184
1185
draw_rr_chan (inode, color, g);
@@ -1337,6 +1338,7 @@ void draw_rr(ezgl::renderer* g) {
1337
1338
* them drawn. */
1338
1339
t_draw_state* draw_state = get_draw_state_vars ();
1339
1340
auto & device_ctx = g_vpr_ctx.device ();
1341
+ const auto & rr_graph = device_ctx.rr_graph ;
1340
1342
1341
1343
if (draw_state->draw_rr_toggle == DRAW_NO_RR) {
1342
1344
g->set_line_width (3 );
@@ -1350,7 +1352,7 @@ void draw_rr(ezgl::renderer* g) {
1350
1352
for (size_t inode = 0 ; inode < device_ctx.rr_nodes .size (); inode++) {
1351
1353
if (!draw_state->draw_rr_node [inode].node_highlighted ) {
1352
1354
/* If not highlighted node, assign color based on type. */
1353
- switch (device_ctx. rr_nodes [inode]. type ( )) {
1355
+ switch (rr_graph. node_type ( RRNodeId (inode) )) {
1354
1356
case CHANX:
1355
1357
case CHANY:
1356
1358
draw_state->draw_rr_node [inode].color = DEFAULT_RR_NODE_COLOR;
@@ -1373,7 +1375,7 @@ void draw_rr(ezgl::renderer* g) {
1373
1375
}
1374
1376
1375
1377
/* Now call drawing routines to draw the node. */
1376
- switch (device_ctx. rr_nodes [inode]. type ( )) {
1378
+ switch (rr_graph. node_type ( RRNodeId (inode) )) {
1377
1379
case SINK:
1378
1380
draw_rr_src_sink (inode, draw_state->draw_rr_node [inode].color , g);
1379
1381
break ;
@@ -1404,7 +1406,7 @@ void draw_rr(ezgl::renderer* g) {
1404
1406
1405
1407
default :
1406
1408
vpr_throw (VPR_ERROR_OTHER, __FILE__, __LINE__,
1407
- " in draw_rr: Unexpected rr_node type: %d.\n " , device_ctx. rr_nodes [inode]. type ( ));
1409
+ " in draw_rr: Unexpected rr_node type: %d.\n " , rr_graph. node_type ( RRNodeId (inode) ));
1408
1410
}
1409
1411
}
1410
1412
@@ -1413,8 +1415,9 @@ void draw_rr(ezgl::renderer* g) {
1413
1415
1414
1416
static void draw_rr_chan (int inode, const ezgl::color color, ezgl::renderer* g) {
1415
1417
auto & device_ctx = g_vpr_ctx.device ();
1418
+ const auto & rr_graph = device_ctx.rr_graph ;
1416
1419
1417
- t_rr_type type = device_ctx. rr_nodes [inode]. type ( );
1420
+ t_rr_type type = rr_graph. node_type ( RRNodeId (inode) );
1418
1421
1419
1422
VTR_ASSERT (type == CHANX || type == CHANY);
1420
1423
@@ -1557,12 +1560,13 @@ static void draw_rr_edges(int inode, ezgl::renderer* g) {
1557
1560
* connects to. inode is assumed to be a CHANX, CHANY, or IPIN. */
1558
1561
t_draw_state* draw_state = get_draw_state_vars ();
1559
1562
auto & device_ctx = g_vpr_ctx.device ();
1563
+ const auto & rr_graph = device_ctx.rr_graph ;
1560
1564
1561
1565
t_rr_type from_type, to_type;
1562
1566
int to_node, from_ptc_num, to_ptc_num;
1563
1567
short switch_type;
1564
1568
1565
- from_type = device_ctx. rr_nodes [inode]. type ( );
1569
+ from_type = rr_graph. node_type ( RRNodeId (inode) );
1566
1570
1567
1571
if ((draw_state->draw_rr_toggle == DRAW_NODES_RR)
1568
1572
|| (draw_state->draw_rr_toggle == DRAW_NODES_SBOX_RR && (from_type == OPIN || from_type == SOURCE || from_type == IPIN))
@@ -1574,7 +1578,7 @@ static void draw_rr_edges(int inode, ezgl::renderer* g) {
1574
1578
1575
1579
for (t_edge_size iedge = 0 , l = device_ctx.rr_nodes [inode].num_edges (); iedge < l; iedge++) {
1576
1580
to_node = device_ctx.rr_nodes [inode].edge_sink_node (iedge);
1577
- to_type = device_ctx. rr_nodes [to_node]. type ( );
1581
+ to_type = rr_graph. node_type ( RRNodeId (to_node) );
1578
1582
to_ptc_num = device_ctx.rr_nodes [to_node].ptc_num ();
1579
1583
bool edge_configurable = device_ctx.rr_nodes [inode].edge_is_configurable (iedge);
1580
1584
@@ -2047,8 +2051,9 @@ ezgl::rectangle draw_get_rr_chan_bbox(int inode) {
2047
2051
double left = 0 , right = 0 , top = 0 , bottom = 0 ;
2048
2052
t_draw_coords* draw_coords = get_draw_coords_vars ();
2049
2053
auto & device_ctx = g_vpr_ctx.device ();
2054
+ const auto & rr_graph = device_ctx.rr_graph ;
2050
2055
2051
- switch (device_ctx. rr_nodes [inode]. type ( )) {
2056
+ switch (rr_graph. node_type ( RRNodeId (inode) )) {
2052
2057
case CHANX:
2053
2058
left = draw_coords->tile_x [device_ctx.rr_nodes [inode].xlow ()];
2054
2059
right = draw_coords->tile_x [device_ctx.rr_nodes [inode].xhigh ()]
@@ -2332,6 +2337,7 @@ static void draw_routed_net(ClusterNetId net_id, ezgl::renderer* g) {
2332
2337
void draw_partial_route (const std::vector<int >& rr_nodes_to_draw, ezgl::renderer* g) {
2333
2338
t_draw_state* draw_state = get_draw_state_vars ();
2334
2339
auto & device_ctx = g_vpr_ctx.device ();
2340
+ const auto & rr_graph = device_ctx.rr_graph ;
2335
2341
2336
2342
static vtr::OffsetMatrix<int > chanx_track; /* [1..device_ctx.grid.width() - 2][0..device_ctx.grid.height() - 2] */
2337
2343
static vtr::OffsetMatrix<int > chany_track; /* [0..device_ctx.grid.width() - 2][1..device_ctx.grid.height() - 2] */
@@ -2358,10 +2364,10 @@ void draw_partial_route(const std::vector<int>& rr_nodes_to_draw, ezgl::renderer
2358
2364
2359
2365
for (size_t i = 1 ; i < rr_nodes_to_draw.size (); ++i) {
2360
2366
int inode = rr_nodes_to_draw[i];
2361
- auto rr_type = device_ctx. rr_nodes [inode]. type ( );
2367
+ auto rr_type = rr_graph. node_type ( RRNodeId (inode) );
2362
2368
2363
2369
int prev_node = rr_nodes_to_draw[i - 1 ];
2364
- auto prev_type = device_ctx. rr_nodes [prev_node]. type ( );
2370
+ auto prev_type = rr_graph. node_type ( RRNodeId (prev_node) );
2365
2371
2366
2372
auto iedge = find_edge (prev_node, inode);
2367
2373
auto switch_type = device_ctx.rr_nodes [prev_node].edge_switch (iedge);
@@ -2373,7 +2379,7 @@ void draw_partial_route(const std::vector<int>& rr_nodes_to_draw, ezgl::renderer
2373
2379
}
2374
2380
case IPIN: {
2375
2381
draw_rr_pin (inode, draw_state->draw_rr_node [inode].color , g);
2376
- if (device_ctx. rr_nodes [prev_node]. type ( ) == OPIN) {
2382
+ if (rr_graph. node_type ( RRNodeId (prev_node) ) == OPIN) {
2377
2383
draw_pin_to_pin (prev_node, inode, g);
2378
2384
} else {
2379
2385
draw_pin_to_chan_edge (inode, prev_node, g);
@@ -2461,13 +2467,14 @@ static int get_track_num(int inode, const vtr::OffsetMatrix<int>& chanx_track, c
2461
2467
int i, j;
2462
2468
t_rr_type rr_type;
2463
2469
auto & device_ctx = g_vpr_ctx.device ();
2470
+ const auto & rr_graph = device_ctx.rr_graph ;
2464
2471
2465
2472
if (get_draw_state_vars ()->draw_route_type == DETAILED)
2466
2473
return (device_ctx.rr_nodes [inode].ptc_num ());
2467
2474
2468
2475
/* GLOBAL route stuff below. */
2469
2476
2470
- rr_type = device_ctx. rr_nodes [inode]. type ( );
2477
+ rr_type = rr_graph. node_type ( RRNodeId (inode) );
2471
2478
i = device_ctx.rr_nodes [inode].xlow (); /* NB: Global rr graphs must have only unit */
2472
2479
j = device_ctx.rr_nodes [inode].ylow (); /* length channel segments. */
2473
2480
@@ -2585,9 +2592,10 @@ static int draw_check_rr_node_hit(float click_x, float click_y) {
2585
2592
2586
2593
t_draw_coords* draw_coords = get_draw_coords_vars ();
2587
2594
auto & device_ctx = g_vpr_ctx.device ();
2595
+ const auto & rr_graph = device_ctx.rr_graph ;
2588
2596
2589
2597
for (size_t inode = 0 ; inode < device_ctx.rr_nodes .size (); inode++) {
2590
- switch (device_ctx. rr_nodes [inode]. type ( )) {
2598
+ switch (rr_graph. node_type ( RRNodeId (inode) )) {
2591
2599
case IPIN:
2592
2600
case OPIN: {
2593
2601
int i = device_ctx.rr_nodes [inode].xlow ();
@@ -2957,6 +2965,7 @@ static void draw_pin_to_chan_edge(int pin_node, int chan_node, ezgl::renderer* g
2957
2965
2958
2966
t_draw_coords* draw_coords = get_draw_coords_vars ();
2959
2967
auto & device_ctx = g_vpr_ctx.device ();
2968
+ const auto & rr_graph = device_ctx.rr_graph ;
2960
2969
2961
2970
const t_rr_node& pin_rr = device_ctx.rr_nodes [pin_node];
2962
2971
const t_rr_node& chan_rr = device_ctx.rr_nodes [chan_node];
@@ -3012,17 +3021,18 @@ static void draw_pin_to_chan_edge(int pin_node, int chan_node, ezgl::renderer* g
3012
3021
* Any rr_node of a grid should have at least 1 side!!!
3013
3022
*/
3014
3023
e_side pin_side = NUM_SIDES;
3024
+ const t_rr_type channel_type = rr_graph.node_type (RRNodeId (chan_node));
3015
3025
if (1 == pin_candidate_sides.size ()) {
3016
3026
pin_side = pin_candidate_sides[0 ];
3017
3027
} else {
3018
3028
VTR_ASSERT (1 < pin_candidate_sides.size ());
3019
- if (CHANX == chan_rr. type () && pin_rr.ylow () <= chan_rr.ylow ()) {
3029
+ if (CHANX == channel_type && pin_rr.ylow () <= chan_rr.ylow ()) {
3020
3030
pin_side = TOP;
3021
- } else if (CHANX == chan_rr. type () && pin_rr.ylow () - 1 >= chan_rr.ylow ()) {
3031
+ } else if (CHANX == channel_type && pin_rr.ylow () - 1 >= chan_rr.ylow ()) {
3022
3032
pin_side = BOTTOM;
3023
- } else if (CHANY == chan_rr. type () && pin_rr.xlow () <= chan_rr.xlow ()) {
3033
+ } else if (CHANY == channel_type && pin_rr.xlow () <= chan_rr.xlow ()) {
3024
3034
pin_side = RIGHT;
3025
- } else if (CHANY == chan_rr. type () && pin_rr.xlow () - 1 >= chan_rr.xlow ()) {
3035
+ } else if (CHANY == channel_type && pin_rr.xlow () - 1 >= chan_rr.xlow ()) {
3026
3036
pin_side = LEFT;
3027
3037
}
3028
3038
/* The inferred side must be in the list of sides of the pin rr_node!!! */
@@ -3069,7 +3079,7 @@ static void draw_pin_to_chan_edge(int pin_node, int chan_node, ezgl::renderer* g
3069
3079
ezgl::rectangle chan_bbox = draw_get_rr_chan_bbox (chan_node);
3070
3080
3071
3081
float x2 = 0 , y2 = 0 ;
3072
- switch (chan_rr. type () ) {
3082
+ switch (channel_type ) {
3073
3083
case CHANX: {
3074
3084
y1 += draw_pin_offset;
3075
3085
y2 = chan_bbox.bottom ();
@@ -3116,8 +3126,9 @@ static void draw_pin_to_chan_edge(int pin_node, int chan_node, ezgl::renderer* g
3116
3126
static void draw_pin_to_pin (int opin_node, int ipin_node, ezgl::renderer* g) {
3117
3127
/* This routine draws an edge from the opin rr node to the ipin rr node */
3118
3128
auto & device_ctx = g_vpr_ctx.device ();
3119
- VTR_ASSERT (device_ctx.rr_nodes [opin_node].type () == OPIN);
3120
- VTR_ASSERT (device_ctx.rr_nodes [ipin_node].type () == IPIN);
3129
+ const auto & rr_graph = device_ctx.rr_graph ;
3130
+ VTR_ASSERT (rr_graph.node_type (RRNodeId (opin_node)) == OPIN);
3131
+ VTR_ASSERT (rr_graph.node_type (RRNodeId (ipin_node)) == IPIN);
3121
3132
3122
3133
/* FIXME: May use a smarter strategy
3123
3134
* Currently, we use the last side found for both OPIN and IPIN
@@ -3876,6 +3887,7 @@ static void draw_rr_costs(ezgl::renderer* g, const std::vector<float>& rr_costs,
3876
3887
/* Draws routing costs */
3877
3888
3878
3889
auto & device_ctx = g_vpr_ctx.device ();
3890
+ const auto & rr_graph = device_ctx.rr_graph ;
3879
3891
3880
3892
g->set_line_width (0 );
3881
3893
@@ -3915,7 +3927,7 @@ static void draw_rr_costs(ezgl::renderer* g, const std::vector<float>& rr_costs,
3915
3927
3916
3928
ezgl::color color = to_ezgl_color (cmap->color (cost));
3917
3929
3918
- switch (device_ctx. rr_nodes [inode]. type ( )) {
3930
+ switch (rr_graph. node_type ( RRNodeId (inode) )) {
3919
3931
case CHANX: // fallthrough
3920
3932
case CHANY:
3921
3933
draw_rr_chan (inode, color, g);
0 commit comments