Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions vpr/src/analytical_place/full_legalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@

#include "setup_grid.h"
#include "stats.h"
#ifndef NO_GRAPHICS
#include "draw_global.h"
#endif

std::unique_ptr<FullLegalizer> make_full_legalizer(e_ap_full_legalizer full_legalizer_type,
const APNetlist& ap_netlist,
Expand Down Expand Up @@ -1003,6 +1006,7 @@ void FlatRecon::legalize(const PartialPlacement& p_placement) {

// Perform the initial placement on created clusters.
place_clusters(p_placement);
update_drawing_data_structures();
}

void NaiveFullLegalizer::create_clusters(const PartialPlacement& p_placement) {
Expand Down Expand Up @@ -1219,6 +1223,7 @@ void NaiveFullLegalizer::legalize(const PartialPlacement& p_placement) {
// made part of the placement and verify placement should check for
// it.
post_place_sync();
update_drawing_data_structures();
}

void APPack::legalize(const PartialPlacement& p_placement) {
Expand Down Expand Up @@ -1304,4 +1309,14 @@ void APPack::legalize(const PartialPlacement& p_placement) {

// Synchronize the pins in the clusters after placement.
post_place_sync();
update_drawing_data_structures();
}

void FullLegalizer::update_drawing_data_structures() {
#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();
}
#endif
}
3 changes: 3 additions & 0 deletions vpr/src/analytical_place/full_legalizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ class FullLegalizer {
* device grid and fixed blocks are observed.
*/
virtual void legalize(const PartialPlacement& p_placement) = 0;

/// @brief Update drawing data structure for current placement
void update_drawing_data_structures();

protected:
/// @brief The AP Netlist to fully legalize the flat placement of.
Expand Down
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