Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions vpr/src/base/place_and_route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include "route.h"
#include "route_export.h"
#include "draw.h"
#ifndef NO_GRAPHICS
#include "draw_global.h"
#endif
#include "rr_graph.h"
#include "read_xml_arch_file.h"
#include "route_common.h"
Expand Down Expand Up @@ -604,4 +607,11 @@ void post_place_sync() {
for (const ClusterBlockId block_id : cluster_ctx.clb_nlist.blocks()) {
blk_loc_registry.place_sync_external_block_connections(block_id);
}

#ifndef NO_GRAPHICS
// update graphic resources incase of clustering changes
if (get_draw_state_vars()) {
get_draw_state_vars()->refresh_graphic_resources_after_cluster_change();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this bit of code belongs in this function. I recommend moving it somewhere else. Perhaps even into its own function. Post-place sync is not doing things related to drawing directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this to a full legalizer member function and it is called at the end of all versions of legalize().

}
#endif
}
18 changes: 18 additions & 0 deletions vpr/src/draw/draw_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ void t_draw_state::reset_block_colors() {
true);
}

void t_draw_state::refresh_graphic_resources_after_cluster_change() {
const ClusteringContext& cluster_ctx = g_vpr_ctx.clustering();
const AtomContext& atom_ctx = g_vpr_ctx.atom();

// Resize block color vectors to match the possibly new clustered size
block_color_.resize(cluster_ctx.clb_nlist.blocks().size());
use_default_block_color_.resize(cluster_ctx.clb_nlist.blocks().size());
reset_block_colors();

// Resize net color as well since they might be rebuild in analytical placement
if (is_flat) {
net_color.resize(atom_ctx.netlist().nets().size());
} else {
net_color.resize(cluster_ctx.clb_nlist.nets().size());
}
std::fill(net_color.begin(), net_color.end(), ezgl::BLACK);
}

/**************************************************
* begin t_draw_pb_type_info function definitions *
**************************************************/
Expand Down
3 changes: 3 additions & 0 deletions vpr/src/draw/draw_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ struct t_draw_state {
void reset_block_color(ClusterBlockId blk);
void reset_block_colors();

///@brief Refresh graphics resources' size after update to cluster blocks size
void refresh_graphic_resources_after_cluster_change();

std::vector<std::pair<t_pl_loc, ezgl::color>> colored_locations;

/// @brief Stores UI checkbox struct for passing into the callback functions
Expand Down