Skip to content

Commit ea74465

Browse files
non-static member variable in CentroidMoveGenerator
1 parent 1bfe098 commit ea74465

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed

vpr/src/place/centroid_move_generator.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77

88
#include <queue>
99

10-
11-
// Static member variable definitions
12-
vtr::vector<NocGroupId, std::vector<ClusterBlockId>> CentroidMoveGenerator::noc_group_clusters_;
13-
vtr::vector<NocGroupId, std::vector<ClusterBlockId>> CentroidMoveGenerator::noc_group_routers_;
14-
vtr::vector<ClusterBlockId, NocGroupId> CentroidMoveGenerator::cluster_to_noc_grp_;
15-
std::map<ClusterBlockId, NocGroupId> CentroidMoveGenerator::noc_router_to_noc_group_;
16-
17-
1810
CentroidMoveGenerator::CentroidMoveGenerator(PlacerState& placer_state,
1911
e_reward_function reward_function)
2012
: MoveGenerator(placer_state, reward_function)
@@ -31,14 +23,7 @@ CentroidMoveGenerator::CentroidMoveGenerator(PlacerState& placer_state,
3123
, noc_attraction_enabled_(true) {
3224
VTR_ASSERT(noc_attraction_weight > 0.0 && noc_attraction_weight <= 1.0);
3325

34-
35-
// check if static member variables are already initialized
36-
if (!noc_group_clusters_.empty() && !noc_group_routers_.empty() &&
37-
!cluster_to_noc_grp_.empty() && !noc_router_to_noc_group_.empty()) {
38-
return;
39-
} else {
40-
initialize_noc_groups(high_fanout_net);
41-
}
26+
initialize_noc_groups(high_fanout_net);
4227
}
4328

4429
e_create_move CentroidMoveGenerator::propose_move(t_pl_blocks_to_be_moved& blocks_affected,
@@ -105,11 +90,11 @@ e_create_move CentroidMoveGenerator::propose_move(t_pl_blocks_to_be_moved& block
10590
}
10691

10792
const std::vector<ClusterBlockId>& CentroidMoveGenerator::get_noc_group_routers(NocGroupId noc_grp_id) {
108-
return CentroidMoveGenerator::noc_group_routers_[noc_grp_id];
93+
return noc_group_routers_[noc_grp_id];
10994
}
11095

11196
NocGroupId CentroidMoveGenerator::get_cluster_noc_group(ClusterBlockId blk_id) {
112-
return CentroidMoveGenerator::cluster_to_noc_grp_[blk_id];
97+
return cluster_to_noc_grp_[blk_id];
11398
}
11499

115100
void CentroidMoveGenerator::initialize_noc_groups(size_t high_fanout_net) {

vpr/src/place/centroid_move_generator.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ class CentroidMoveGenerator : public MoveGenerator {
5858
* @param noc_grp_id The NoC group ID whose NoC routers are requested.
5959
* @return The clustered block ID of all NoC routers in the given NoC group.
6060
*/
61-
static const std::vector<ClusterBlockId>& get_noc_group_routers(NocGroupId noc_grp_id);
61+
const std::vector<ClusterBlockId>& get_noc_group_routers(NocGroupId noc_grp_id);
6262

6363
/**
6464
* Returns the NoC group ID of clustered block.
6565
* @param blk_id The clustered block whose NoC group ID is requested.
6666
* @return The NoC group ID of the given clustered block or INVALID if
6767
* the given clustered block does not belong to any NoC groups.
6868
*/
69-
static NocGroupId get_cluster_noc_group(ClusterBlockId blk_id);
69+
NocGroupId get_cluster_noc_group(ClusterBlockId blk_id);
7070

7171
private:
7272
e_create_move propose_move(t_pl_blocks_to_be_moved& blocks_affected,
@@ -112,20 +112,20 @@ class CentroidMoveGenerator : public MoveGenerator {
112112
bool noc_attraction_enabled_;
113113

114114
/** Stores the ids of all non-router clustered blocks for each NoC group*/
115-
static vtr::vector<NocGroupId, std::vector<ClusterBlockId>> noc_group_clusters_;
115+
vtr::vector<NocGroupId, std::vector<ClusterBlockId>> noc_group_clusters_;
116116

117117
/** Stores NoC routers in each NoC group*/
118-
static vtr::vector<NocGroupId, std::vector<ClusterBlockId>> noc_group_routers_;
118+
vtr::vector<NocGroupId, std::vector<ClusterBlockId>> noc_group_routers_;
119119

120120
/** Specifies the NoC group that each block belongs to. A block cannot belong to more
121121
* than one NoC because this means those NoC groups can reach each other and form
122122
* a single NoC group. We use NocGroupId::INVALID to show that a block does not belong
123123
* to any NoC groups. This happens when a block is not reachable from any NoC router.
124124
* */
125-
static vtr::vector<ClusterBlockId, NocGroupId> cluster_to_noc_grp_;
125+
vtr::vector<ClusterBlockId, NocGroupId> cluster_to_noc_grp_;
126126

127127
/** Specifies the NoC group for each NoC router*/
128-
static std::map<ClusterBlockId, NocGroupId> noc_router_to_noc_group_;
128+
std::map<ClusterBlockId, NocGroupId> noc_router_to_noc_group_;
129129

130130
/**
131131
* @brief This function forms NoC groups by finding connected components
@@ -135,7 +135,7 @@ class CentroidMoveGenerator : public MoveGenerator {
135135
* @param high_fanout_net All nets with a fanout larger than this number are
136136
* ignored when forming NoC groups.
137137
*/
138-
static void initialize_noc_groups(size_t high_fanout_net);
138+
void initialize_noc_groups(size_t high_fanout_net);
139139
};
140140

141141
#endif

0 commit comments

Comments
 (0)