Skip to content

Commit 8c711d0

Browse files
global map for edge type --> color
1 parent bf0f777 commit 8c711d0

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

vpr/src/draw/draw_rr.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ void draw_rr_edges(RRNodeId inode, ezgl::renderer* g) {
255255
continue;
256256
}
257257

258-
ezgl::color color = DEFAULT_RR_NODE_COLOR;
259258
bool draw_edge = true;
260259
bool inode_inter_cluster = is_inter_cluster_node(rr_graph, inode);
261260
bool to_node_inter_cluster = is_inter_cluster_node(rr_graph, to_node);
@@ -284,17 +283,11 @@ void draw_rr_edges(RRNodeId inode, ezgl::renderer* g) {
284283
draw_edge = draw_state->draw_connection_box_edges;
285284
}
286285

287-
// Select edge colors
288-
const std::map<e_edge_type, ezgl::color> edge_color_map = {
289-
{e_edge_type::PIN_TO_OPIN, ezgl::LIGHT_PINK},
290-
{e_edge_type::PIN_TO_IPIN, ezgl::MEDIUM_PURPLE},
291-
{e_edge_type::OPIN_TO_CHAN, ezgl::PINK},
292-
{e_edge_type::CHAN_TO_IPIN, ezgl::PURPLE},
293-
{e_edge_type::CHAN_TO_CHAN, blk_DARKGREEN}};
286+
ezgl::color color = EDGE_COLOR_MAP.at(edge_type);
294287

295-
color = edge_color_map.at(edge_type);
296-
297-
if (!edge_configurable) color = blk_DARKGREY;
288+
if (!edge_configurable) {
289+
color = blk_DARKGREY;
290+
}
298291

299292
if ((from_type == e_rr_type::CHANX || from_type == e_rr_type::CHANY)
300293
&& (to_type == e_rr_type::IPIN)

vpr/src/draw/draw_types.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "ezgl/rectangle.hpp"
3232
#include "ezgl/color.hpp"
3333
#include "ezgl/application.hpp"
34+
#include "draw_color.h"
3435

3536
/// @brief Whether to draw routed nets or flylines (direct lines between sources and sinks).
3637
enum e_draw_nets {
@@ -124,6 +125,14 @@ enum class e_edge_type {
124125
NUM_EDGE_TYPES
125126
};
126127

128+
/// Maps edge types to the color with which they are visualized
129+
inline const vtr::array<e_edge_type, ezgl::color, (size_t)e_edge_type::NUM_EDGE_TYPES> EDGE_COLOR_MAP{
130+
ezgl::LIGHT_PINK,
131+
ezgl::MEDIUM_PURPLE,
132+
ezgl::PINK,
133+
ezgl::PURPLE,
134+
blk_DARKGREEN};
135+
127136
/**
128137
* @brief Structure used to hold data passed into the toggle checkbox callback function.
129138
*/

0 commit comments

Comments
 (0)