@@ -242,14 +242,11 @@ void draw_rr_chan(RRNodeId inode, const ezgl::color color, ezgl::renderer* g) {
242242 g->set_color (color, transparency_factor); // Ensure color is still set correctly if we drew any arrows/text
243243}
244244
245- /* Draws all the edges that the user wants shown between inode and what it
246- * connects to. inode is assumed to be a CHANX, CHANY, or IPIN. */
247245void draw_rr_edges (RRNodeId inode, ezgl::renderer* g) {
248246 t_draw_state* draw_state = get_draw_state_vars ();
249247 const DeviceContext& device_ctx = g_vpr_ctx.device ();
250248 const RRGraphView& rr_graph = device_ctx.rr_graph ;
251249
252- e_rr_type to_type;
253250 e_rr_type from_type = rr_graph.node_type (inode);
254251
255252 // Currently don't visualize source or sinks.
@@ -259,45 +256,22 @@ void draw_rr_edges(RRNodeId inode, ezgl::renderer* g) {
259256
260257 for (t_edge_size iedge = 0 , l = rr_graph.num_edges (inode); iedge < l; iedge++) {
261258 RRNodeId to_node = rr_graph.edge_sink_node (inode, iedge);
262- to_type = rr_graph.node_type (to_node);
259+ e_rr_type to_type = rr_graph.node_type (to_node);
263260 bool edge_configurable = rr_graph.edge_is_configurable (inode, iedge);
264261
265262 // Currently don't visualize source or sinks.
266263 if (to_type == e_rr_type::SOURCE || to_type == e_rr_type::SINK) {
267264 continue ;
268265 }
269266
270- ezgl::color color = DEFAULT_RR_NODE_COLOR;
271- e_edge_type edge_type;
272267 bool draw_edge = true ;
273268 bool inode_inter_cluster = is_inter_cluster_node (rr_graph, inode);
274269 bool to_node_inter_cluster = is_inter_cluster_node (rr_graph, to_node);
275270
276- // Color map for edges based on {from_type, to_type}
277- const std::map<std::pair<e_rr_type, e_rr_type>, e_edge_type> edge_type_map = {
278- // Pin to pin connections
279- {{e_rr_type::IPIN, e_rr_type::IPIN}, e_edge_type::PIN_TO_IPIN},
280- {{e_rr_type::OPIN, e_rr_type::IPIN}, e_edge_type::PIN_TO_IPIN},
281- {{e_rr_type::OPIN, e_rr_type::OPIN}, e_edge_type::PIN_TO_OPIN},
282- {{e_rr_type::IPIN, e_rr_type::OPIN}, e_edge_type::PIN_TO_OPIN},
283-
284- // Channel to pin connections
285- {{e_rr_type::OPIN, e_rr_type::CHANX}, e_edge_type::OPIN_TO_CHAN},
286- {{e_rr_type::OPIN, e_rr_type::CHANY}, e_edge_type::OPIN_TO_CHAN},
287- {{e_rr_type::CHANX, e_rr_type::IPIN}, e_edge_type::CHAN_TO_IPIN},
288- {{e_rr_type::CHANY, e_rr_type::IPIN}, e_edge_type::CHAN_TO_IPIN},
289-
290- // Channel to channel connections
291- {{e_rr_type::CHANX, e_rr_type::CHANX}, e_edge_type::CHAN_TO_CHAN},
292- {{e_rr_type::CHANX, e_rr_type::CHANY}, e_edge_type::CHAN_TO_CHAN},
293- {{e_rr_type::CHANY, e_rr_type::CHANY}, e_edge_type::CHAN_TO_CHAN},
294- {{e_rr_type::CHANY, e_rr_type::CHANX}, e_edge_type::CHAN_TO_CHAN},
295- };
296-
297- if (edge_type_map.find ({from_type, to_type}) == edge_type_map.end ()) {
271+ if (EDGE_TYPE_MAP.find ({from_type, to_type}) == EDGE_TYPE_MAP.end ()) {
298272 continue ; // Unsupported edge type
299273 }
300- edge_type = edge_type_map .at ({from_type, to_type});
274+ e_edge_type edge_type = EDGE_TYPE_MAP .at ({from_type, to_type});
301275
302276 // Determine whether to draw the edge based on user options
303277
@@ -318,17 +292,11 @@ void draw_rr_edges(RRNodeId inode, ezgl::renderer* g) {
318292 draw_edge = draw_state->draw_connection_box_edges ;
319293 }
320294
321- // Select edge colors
322- const std::map<e_edge_type, ezgl::color> edge_color_map = {
323- {e_edge_type::PIN_TO_OPIN, ezgl::LIGHT_PINK},
324- {e_edge_type::PIN_TO_IPIN, ezgl::MEDIUM_PURPLE},
325- {e_edge_type::OPIN_TO_CHAN, ezgl::PINK},
326- {e_edge_type::CHAN_TO_IPIN, ezgl::PURPLE},
327- {e_edge_type::CHAN_TO_CHAN, blk_DARKGREEN}};
295+ ezgl::color color = EDGE_COLOR_MAP.at (edge_type);
328296
329- color = edge_color_map. at (edge_type);
330-
331- if (!edge_configurable) color = blk_DARKGREY;
297+ if (!edge_configurable) {
298+ color = blk_DARKGREY;
299+ }
332300
333301 if ((from_type == e_rr_type::CHANX || from_type == e_rr_type::CHANY)
334302 && (to_type == e_rr_type::IPIN)
0 commit comments