@@ -66,7 +66,7 @@ void draw_rr(ezgl::renderer* g) {
66
66
draw_state->draw_rr_node [inode].color = ezgl::PINK;
67
67
break ;
68
68
case e_rr_type::IPIN:
69
- draw_state->draw_rr_node [inode].color = blk_LIGHTSKYBLUE ;
69
+ draw_state->draw_rr_node [inode].color = ezgl::PURPLE ;
70
70
break ;
71
71
case e_rr_type::SOURCE:
72
72
draw_state->draw_rr_node [inode].color = ezgl::PLUM;
@@ -240,7 +240,7 @@ void draw_rr_edges(RRNodeId inode, ezgl::renderer* g) {
240
240
e_rr_type from_type, to_type;
241
241
242
242
from_type = rr_graph.node_type (inode);
243
- if (from_type == e_rr_type::SOURCE || from_type == e_rr_type::SINK || ! is_inter_cluster_node (rr_graph, inode) ) {
243
+ if (from_type == e_rr_type::SOURCE || from_type == e_rr_type::SINK) {
244
244
return ;
245
245
}
246
246
@@ -255,51 +255,51 @@ void draw_rr_edges(RRNodeId inode, ezgl::renderer* g) {
255
255
to_type = rr_graph.node_type (to_node);
256
256
bool edge_configurable = rr_graph.edge_is_configurable (inode, iedge);
257
257
258
- if (to_type == e_rr_type::SOURCE || to_type == e_rr_type::SINK || ! is_inter_cluster_node (rr_graph, to_node) ) {
258
+ if (to_type == e_rr_type::SOURCE || to_type == e_rr_type::SINK) {
259
259
continue ;
260
260
}
261
261
262
262
ezgl::color color = DEFAULT_RR_NODE_COLOR;
263
- // Determine the color based on the type of the edge
264
- switch (from_type) {
265
- case e_rr_type::OPIN:
266
- if (to_type == e_rr_type::CHANX || to_type == e_rr_type::CHANY) {
267
- color = ezgl::PINK;
268
- } else if (to_type == e_rr_type::IPIN) {
269
- color = ezgl::MEDIUM_PURPLE;
270
- } else {
271
- vpr_throw (VPR_ERROR_OTHER, __FILE__, __LINE__,
272
- " in draw_rr_edges: node %d (type: %d) connects to node %d (type: %d).\n " ,
273
- inode, from_type, to_node, to_type);
274
- }
275
- break ;
276
- case e_rr_type::CHANX:
277
- case e_rr_type::CHANY:
278
- if (to_type == e_rr_type::IPIN) {
279
- color = blk_LIGHTSKYBLUE;
280
- if (draw_state->draw_rr_node [to_node].node_highlighted && draw_state->draw_rr_node [inode].color == DEFAULT_RR_NODE_COLOR) {
281
- // If the IPIN is clicked on, draw connection to all the CHANX
282
- // wire segments fanning into the pin. If a CHANX wire is clicked
283
- // on, draw only the connection between that wire and the IPIN, with
284
- // the pin fanning out from the wire.
285
- color = ezgl::MAGENTA;
286
- }
287
- } else if (to_type == e_rr_type::CHANX || to_type == e_rr_type::CHANY) {
288
- if (edge_configurable) {
289
- color = blk_DARKGREEN;
290
- } else {
291
- color = blk_DARKGREY;
292
- }
293
- } else {
294
- vpr_throw (VPR_ERROR_OTHER, __FILE__, __LINE__,
295
- " in draw_rr_edges: node %d (type: %d) connects to node %d (type: %d).\n " ,
296
- inode, from_type, to_node, to_type);
297
- }
298
- break ;
299
- default :
300
- break ;
263
+
264
+ // Color map for edges based on {from_type, to_type}
265
+ static const std::map<std::pair<e_rr_type, e_rr_type>, ezgl::color> edge_color_map = {
266
+ // Pin to pin connections
267
+ {{e_rr_type::IPIN, e_rr_type::IPIN}, ezgl::MEDIUM_PURPLE},
268
+ {{e_rr_type::OPIN, e_rr_type::IPIN}, ezgl::MEDIUM_PURPLE},
269
+ {{e_rr_type::OPIN, e_rr_type::OPIN}, ezgl::LIGHT_PINK},
270
+ {{e_rr_type::IPIN, e_rr_type::OPIN}, ezgl::LIGHT_PINK},
271
+
272
+ // Channel to pin connections
273
+ {{e_rr_type::OPIN, e_rr_type::CHANX}, ezgl::PINK},
274
+ {{e_rr_type::OPIN, e_rr_type::CHANY}, ezgl::PINK},
275
+ {{e_rr_type::CHANX, e_rr_type::IPIN}, ezgl::PURPLE},
276
+ {{e_rr_type::CHANY, e_rr_type::IPIN}, ezgl::PURPLE},
277
+
278
+ // Channel to channel connections
279
+ {{e_rr_type::CHANX, e_rr_type::CHANX}, blk_DARKGREEN},
280
+ {{e_rr_type::CHANX, e_rr_type::CHANY}, blk_DARKGREEN},
281
+ {{e_rr_type::CHANY, e_rr_type::CHANY}, blk_DARKGREEN},
282
+ {{e_rr_type::CHANY, e_rr_type::CHANX}, blk_DARKGREEN},
283
+ };
284
+
285
+ if (edge_color_map.find ({from_type, to_type}) != edge_color_map.end ()) {
286
+ color = edge_color_map.at ({from_type, to_type});
287
+ }
288
+
289
+ if (!edge_configurable) color = blk_DARKGREY;
290
+
291
+ if ((from_type == e_rr_type::CHANX || from_type == e_rr_type::CHANY)
292
+ && (to_type == e_rr_type::IPIN)
293
+ && draw_state->draw_rr_node [to_node].node_highlighted
294
+ && draw_state->draw_rr_node [inode].color == DEFAULT_RR_NODE_COLOR){
295
+ // If the IPIN is clicked on, draw connection to all the CHANX
296
+ // wire segments fanning into the pin. If a CHANX wire is clicked
297
+ // on, draw only the connection between that wire and the IPIN, with
298
+ // the pin fanning out from the wire.
299
+ color = ezgl::MAGENTA;
301
300
}
302
301
302
+ // If the node is highlighted, use its color
303
303
if (rgb_is_same (draw_state->draw_rr_node [inode].color , ezgl::MAGENTA) || rgb_is_same (draw_state->draw_rr_node [to_node].color , ezgl::MAGENTA)) {
304
304
color = draw_state->draw_rr_node [to_node].color ;
305
305
}
0 commit comments