Skip to content

Commit 44a2f9a

Browse files
committed
changed hit nodes to set
1 parent d606a5d commit 44a2f9a

File tree

7 files changed

+45
-40
lines changed

7 files changed

+45
-40
lines changed

vpr/src/draw/draw.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ static void draw_main_canvas(ezgl::renderer* g) {
190190

191191
if (draw_state->pic_on_screen == PLACEMENT) {
192192
if (draw_state->draw_nets == DRAW_FLYLINES && draw_state->show_nets) {
193-
drawnets(g);
193+
draw_flylines_placement(g);
194194
}
195-
} else { /* ROUTING on screen */
195+
} else { // ROUTING on screen
196196

197197
if (draw_state->show_nets && draw_state->draw_nets == DRAW_ROUTED_NETS) {
198198
draw_route(ALL_NETS, g);
@@ -564,7 +564,6 @@ void init_draw_coords(float clb_width, const BlkLocRegistry& blk_loc_registry) {
564564
for (RRNodeId inode : rr_graph.nodes()) {
565565
draw_state->draw_rr_node[inode].color = DEFAULT_RR_NODE_COLOR;
566566
draw_state->draw_rr_node[inode].node_highlighted = false;
567-
draw_state->draw_rr_node[inode].node_hit = false;
568567
}
569568
}
570569
draw_coords->set_tile_width(clb_width);

vpr/src/draw/draw_basic.cpp

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void drawplace(ezgl::renderer* g) {
196196
/* This routine draws the nets on the placement. The nets have not *
197197
* yet been routed, so we just draw a chain showing a possible path *
198198
* for each net. This gives some idea of future congestion. */
199-
void drawnets(ezgl::renderer* g) {
199+
void draw_flylines_placement(ezgl::renderer* g) {
200200
t_draw_state* draw_state = get_draw_state_vars();
201201
t_draw_coords* draw_coords = get_draw_coords_vars();
202202
const ClusteringContext& cluster_ctx = g_vpr_ctx.clustering();
@@ -616,14 +616,16 @@ void draw_partial_route(const std::vector<RRNodeId>& rr_nodes_to_draw, ezgl::ren
616616

617617
bool inter_cluster_node = is_inter_cluster_node(rr_graph, inode);
618618

619-
// skip drawing INTER-cluster nets if the user has disabled them
620-
if (inter_cluster_node && !draw_state->draw_inter_cluster_nets) {
621-
continue;
622-
}
619+
if(!(draw_state->draw_rr_node[inode].node_highlighted && draw_state->highlight_fan_in_fan_out)){
620+
// skip drawing INTER-cluster nets if the user has disabled them
621+
if (inter_cluster_node && !draw_state->draw_inter_cluster_nets) {
622+
continue;
623+
}
623624

624-
// skip drawing INTRA-cluster nets if the user has disabled them
625-
if (!inter_cluster_node && !draw_state->draw_intra_cluster_nets) {
626-
continue;
625+
// skip drawing INTRA-cluster nets if the user has disabled them
626+
if (!inter_cluster_node && !draw_state->draw_intra_cluster_nets) {
627+
continue;
628+
}
627629
}
628630

629631
draw_rr_node(inode, color, g);
@@ -636,14 +638,16 @@ void draw_partial_route(const std::vector<RRNodeId>& rr_nodes_to_draw, ezgl::ren
636638
bool inter_cluster_node = is_inter_cluster_node(rr_graph, inode);
637639
bool prev_inter_cluster_node = is_inter_cluster_node(rr_graph, prev_node);
638640

639-
// If this is an edge between two inter-cluster nodes, draw only if the user has enabled inter-cluster nets
640-
if ((inter_cluster_node && prev_inter_cluster_node) && !draw_state->draw_inter_cluster_nets) {
641-
continue;
642-
}
641+
if(!(draw_state->draw_rr_node[inode].node_highlighted && draw_state->highlight_fan_in_fan_out)){
642+
// If this is an edge between two inter-cluster nodes, draw only if the user has enabled inter-cluster nets
643+
if ((inter_cluster_node && prev_inter_cluster_node) && !draw_state->draw_inter_cluster_nets) {
644+
continue;
645+
}
643646

644-
// If this is an edge containing an intra-cluster node, draw only if the user has enabled intra-cluster nets
645-
if ((!inter_cluster_node || !prev_inter_cluster_node) && !draw_state->draw_intra_cluster_nets) {
646-
continue;
647+
// If this is an edge containing an intra-cluster node, draw only if the user has enabled intra-cluster nets
648+
if ((!inter_cluster_node || !prev_inter_cluster_node) && !draw_state->draw_intra_cluster_nets) {
649+
continue;
650+
}
647651
}
648652

649653
// avoid highlighting edge unless both nodes are highlighted

vpr/src/draw/draw_basic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void drawplace(ezgl::renderer* g);
3232
/* This routine draws the nets on the placement. The nets have not *
3333
* yet been routed, so we just draw a chain showing a possible path *
3434
* for each net. This gives some idea of future congestion. */
35-
void drawnets(ezgl::renderer* g);
35+
void draw_flylines_placement(ezgl::renderer* g);
3636

3737
/* Draws all the overused routing resources (i.e. congestion) in various contrasting colors showing congestion ratio. */
3838
void draw_congestion(ezgl::renderer* g);

vpr/src/draw/draw_rr.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,13 @@ void draw_rr_edges(RRNodeId inode, ezgl::renderer* g) {
332332
color = ezgl::MAGENTA;
333333
}
334334

335-
// If the node is highlighted, color the edges as blue for fanin and red for fanout
335+
// If the node is clicked on, color the edges as blue for fanin and red for fanout
336+
// Need to check both highlighting and hit nodes since when the user clicks off a node, the node is de-highlighted but still in the hit nodes.
336337
if (draw_state->highlight_rr_edges) {
337-
if (draw_state->draw_rr_node[inode].node_hit) {
338+
if (draw_state->draw_rr_node[inode].node_highlighted && draw_state->hit_nodes.find(inode) != draw_state->hit_nodes.end()) {
338339
color = draw_state->draw_rr_node[to_node].color;
339340
draw_edge = true;
340-
} else if (draw_state->draw_rr_node[to_node].node_hit) {
341+
} else if (draw_state->draw_rr_node[to_node].node_highlighted && draw_state->hit_nodes.find(to_node) != draw_state->hit_nodes.end()) {
341342
color = draw_state->draw_rr_node[inode].color;
342343
draw_edge = true;
343344
}

vpr/src/draw/draw_searchbar.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,22 @@ void draw_highlight_blocks_color(t_logical_block_type_ptr type,
7373
ClusterBlockId blk_id) {
7474
t_draw_state* draw_state = get_draw_state_vars();
7575
const ClusteringContext& cluster_ctx = g_vpr_ctx.clustering();
76+
const AtomLookup& atom_lookup = g_vpr_ctx.atom().lookup();
7677
const auto& block_locs = draw_state->get_graphics_blk_loc_registry_ref().block_locs();
7778

7879
for (int k = 0; k < type->pb_type->num_pins; k++) { /* Each pin on a CLB */
79-
ClusterNetId net_id = cluster_ctx.clb_nlist.block_net(blk_id, k);
80+
ClusterNetId cluster_net_id = cluster_ctx.clb_nlist.block_net(blk_id, k);
8081

81-
if (net_id == ClusterNetId::INVALID()) {
82+
if (cluster_net_id == ClusterNetId::INVALID()) {
8283
continue;
8384
}
8485

86+
// Convert to atom net id if flat routing is enabled
87+
ParentNetId net_id = cluster_net_id;
88+
if (draw_state->is_flat){
89+
net_id = atom_lookup.atom_net(cluster_net_id);
90+
}
91+
8592
t_pl_loc block_loc = block_locs[blk_id].loc;
8693
auto physical_tile = physical_tile_type(block_loc);
8794
int physical_pin = get_physical_pin(physical_tile, type, k);
@@ -92,14 +99,14 @@ void draw_highlight_blocks_color(t_logical_block_type_ptr type,
9299
if (draw_state->block_color(blk_id) == SELECTED_COLOR) {
93100
/* If block already highlighted, de-highlight the fanout. (the deselect case)*/
94101
draw_state->net_color[net_id] = ezgl::BLACK;
95-
for (auto pin_id : cluster_ctx.clb_nlist.net_sinks(net_id)) {
102+
for (auto pin_id : cluster_ctx.clb_nlist.net_sinks(cluster_net_id)) {
96103
ClusterBlockId fanblk = cluster_ctx.clb_nlist.pin_block(pin_id);
97104
draw_reset_blk_color(fanblk);
98105
}
99106
} else {
100107
/* Highlight the fanout */
101108
draw_state->net_color[net_id] = DRIVES_IT_COLOR;
102-
for (auto pin_id : cluster_ctx.clb_nlist.net_sinks(net_id)) {
109+
for (auto pin_id : cluster_ctx.clb_nlist.net_sinks(cluster_net_id)) {
103110
ClusterBlockId fanblk = cluster_ctx.clb_nlist.pin_block(pin_id);
104111
draw_state->set_block_color(fanblk, DRIVES_IT_COLOR);
105112
}
@@ -108,12 +115,12 @@ void draw_highlight_blocks_color(t_logical_block_type_ptr type,
108115
if (draw_state->block_color(blk_id) == SELECTED_COLOR) {
109116
/* If block already highlighted, de-highlight the fanin. (the deselect case)*/
110117
draw_state->net_color[net_id] = ezgl::BLACK;
111-
ClusterBlockId fanblk = cluster_ctx.clb_nlist.net_driver_block(net_id); /* DRIVER to net */
118+
ClusterBlockId fanblk = cluster_ctx.clb_nlist.net_driver_block(cluster_net_id); /* DRIVER to net */
112119
draw_reset_blk_color(fanblk);
113120
} else {
114121
/* Highlight the fanin */
115122
draw_state->net_color[net_id] = DRIVEN_BY_IT_COLOR;
116-
ClusterBlockId fanblk = cluster_ctx.clb_nlist.net_driver_block(net_id); /* DRIVER to net */
123+
ClusterBlockId fanblk = cluster_ctx.clb_nlist.net_driver_block(cluster_net_id); /* DRIVER to net */
117124
draw_state->set_block_color(fanblk, DRIVEN_BY_IT_COLOR);
118125
}
119126
}
@@ -271,7 +278,6 @@ void deselect_all() {
271278
for (RRNodeId inode : device_ctx.rr_graph.nodes()) {
272279
draw_state->draw_rr_node[inode].color = DEFAULT_RR_NODE_COLOR;
273280
draw_state->draw_rr_node[inode].node_highlighted = false;
274-
draw_state->draw_rr_node[inode].node_hit = false;
275281
}
276282
get_selected_sub_block_info().clear();
277283
}

vpr/src/draw/draw_types.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,16 @@ typedef struct {
140140
bool* toggle_state;
141141
} t_checkbox_data;
142142

143-
/* Structure which stores state information of a rr_node. Used
144-
* for controling the drawing each rr_node when ROUTING is on screen.
145-
* color: Color of the rr_node
146-
* node_highlighted: Whether the node is highlighted. Useful for
147-
* highlighting routing resources on rr_graph
148-
*/
143+
149144
/**
150145
* @brief Structure used to store the state information of an rr_node.
151146
* Used to control drawing each rr_node when ROUTING is on screen.
152147
* color: Color of the rr_node
153148
* node_highlighted: Whether the node is highlighted. Useful for highlighting routing resources on rr_graph.
154-
* node_hit: Whether the node is hit by a mouse click. Required since multiple RR nodes can be clicked on at the same time.
155149
*/
156150
typedef struct {
157151
ezgl::color color;
158152
bool node_highlighted;
159-
bool node_hit;
160153
} t_draw_rr_node;
161154

162155
/**
@@ -276,6 +269,9 @@ struct t_draw_state {
276269
///@brief color in which each net should be drawn. [0..cluster_ctx.clb_nlist.nets().size()-1]
277270
vtr::vector<ParentNetId, ezgl::color> net_color;
278271

272+
///@brief RR Nodes which the user has clicked on.
273+
std::set<RRNodeId> hit_nodes;
274+
279275
/**
280276
* @brief stores the state information of each routing resource.
281277
*

vpr/src/draw/search_bar.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,18 @@ bool highlight_rr_nodes(RRNodeId hit_node) {
224224
// If the node hasn't been clicked on before, highlight it in magenta.
225225
draw_state->draw_rr_node[node].color = ezgl::MAGENTA;
226226
draw_state->draw_rr_node[node].node_highlighted = true;
227-
draw_state->draw_rr_node[node].node_hit = true;
228-
229227
} else {
230228
//Using white color to represent de-highlighting (or de-selecting) of node.
231229
draw_state->draw_rr_node[node].color = ezgl::WHITE;
232230
draw_state->draw_rr_node[node].node_highlighted = false;
233-
draw_state->draw_rr_node[node].node_hit = false;
234231
}
235232

236233
//Print info about all nodes to terminal including neighboring non-configurable nodes
237234
VTR_LOG("%s\n", describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, node, draw_state->is_flat).c_str());
238235
}
239236

237+
draw_state->hit_nodes = nodes;
238+
240239
//Show info about *only* hit node to graphics
241240
std::string info = describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, hit_node, draw_state->is_flat);
242241
sprintf(message, "Selected %s", info.c_str());

0 commit comments

Comments
 (0)