Skip to content

Commit 2e4b26c

Browse files
authored
Merge pull request #3321 from AlexandreSinger/feature-cluster-legalizer
[Pack][Legalizer] Added get_cluster_name Method
2 parents a3a6b16 + 85be893 commit 2e4b26c

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

vpr/src/pack/cluster_legalizer.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* externally to the Packer in VPR.
1212
*/
1313

14+
#include <string>
1415
#include <vector>
1516
#include "atom_netlist_fwd.h"
1617
#include "noc_data_types.h"
@@ -433,6 +434,13 @@ class ClusterLegalizer {
433434
return cluster.pb;
434435
}
435436

437+
/// @brief Gets the name of the given cluster.
438+
inline std::string get_cluster_name(LegalizationClusterId cluster_id) const {
439+
VTR_ASSERT_SAFE(cluster_id.is_valid() && (size_t)cluster_id < legalization_clusters_.size());
440+
const LegalizationCluster& cluster = legalization_clusters_[cluster_id];
441+
return cluster.pb->name;
442+
}
443+
436444
/// @brief Gets the logical block type of the given cluster.
437445
inline t_logical_block_type_ptr get_cluster_type(LegalizationClusterId cluster_id) const {
438446
VTR_ASSERT_SAFE(cluster_id.is_valid() && (size_t)cluster_id < legalization_clusters_.size());

vpr/src/pack/cluster_util.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ static void echo_clusters(char* filename, const ClusterLegalizer& cluster_legali
3939
}
4040

4141
for (auto& cluster_atom : cluster_atoms) {
42-
const std::string& cluster_name = cluster_legalizer.get_cluster_pb(cluster_atom.first)->name;
43-
fprintf(fp, "Cluster %s Id: %zu \n", cluster_name.c_str(), size_t(cluster_atom.first));
42+
fprintf(fp, "Cluster %s Id: %zu \n",
43+
cluster_legalizer.get_cluster_name(cluster_atom.first).c_str(),
44+
size_t(cluster_atom.first));
4445
fprintf(fp, "\tAtoms in cluster: \n");
4546

4647
int num_atoms = cluster_atom.second.size();

vpr/src/pack/greedy_clusterer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ LegalizationClusterId GreedyClusterer::start_new_cluster(
443443

444444
VTR_LOGV(log_verbosity_ > 2,
445445
"Complex block %zu: '%s' (%s) ", size_t(new_cluster_id),
446-
cluster_legalizer.get_cluster_pb(new_cluster_id)->name,
446+
cluster_legalizer.get_cluster_name(new_cluster_id).c_str(),
447447
cluster_legalizer.get_cluster_type(new_cluster_id)->name.c_str());
448448
VTR_LOGV(log_verbosity_ > 2, ".");
449449
//Progress dot for seed-block

0 commit comments

Comments
 (0)