34
34
static bool select_random_router_cluster (ClusterBlockId& b_from,
35
35
t_pl_loc& from,
36
36
t_logical_block_type_ptr& cluster_from_type,
37
- const vtr::vector_map<ClusterBlockId, t_block_loc>& block_locs);
37
+ const vtr::vector_map<ClusterBlockId, t_block_loc>& block_locs,
38
+ vtr::RngContainer& rng);
38
39
39
40
/* *
40
41
* @brief Given two traffic flow routes, finds links that appear
@@ -820,20 +821,22 @@ std::vector<NocLink> NocCostHandler::get_top_n_congested_links(int n) {
820
821
}
821
822
822
823
/* Below are functions related to the feature that forces to the placer to swap router blocks for a certain percentage of the total number of swaps */
823
- bool check_for_router_swap (int user_supplied_noc_router_swap_percentage) {
824
+ bool check_for_router_swap (int user_supplied_noc_router_swap_percentage,
825
+ vtr::RngContainer& rng) {
824
826
/* A random number between 0-100 is generated here and compared to the user
825
827
* supplied value. If the random number is less than the user supplied
826
828
* value we indicate that a router block should be swapped. By doing this
827
829
* we now only swap router blocks for the percentage of time the user
828
830
* supplied.
829
831
* */
830
- return (vtr:: irand (99 ) < user_supplied_noc_router_swap_percentage);
832
+ return (rng. irand (99 ) < user_supplied_noc_router_swap_percentage);
831
833
}
832
834
833
835
static bool select_random_router_cluster (ClusterBlockId& b_from,
834
836
t_pl_loc& from,
835
837
t_logical_block_type_ptr& cluster_from_type,
836
- const vtr::vector_map<ClusterBlockId, t_block_loc>& block_locs) {
838
+ const vtr::vector_map<ClusterBlockId, t_block_loc>& block_locs,
839
+ vtr::RngContainer& rng) {
837
840
// need to access all the router cluster blocks in the design
838
841
const auto & noc_ctx = g_vpr_ctx.noc ();
839
842
auto & cluster_ctx = g_vpr_ctx.clustering ();
@@ -849,7 +852,7 @@ static bool select_random_router_cluster(ClusterBlockId& b_from,
849
852
const int number_of_router_blocks = static_cast <int >(router_clusters.size ());
850
853
851
854
// randomly choose a router block to move
852
- const int random_cluster_block_index = vtr:: irand (number_of_router_blocks - 1 );
855
+ const int random_cluster_block_index = rng. irand (number_of_router_blocks - 1 );
853
856
b_from = router_clusters[random_cluster_block_index];
854
857
855
858
// check if the block is movable
@@ -867,7 +870,8 @@ static bool select_random_router_cluster(ClusterBlockId& b_from,
867
870
868
871
e_create_move propose_router_swap (t_pl_blocks_to_be_moved& blocks_affected,
869
872
float rlim,
870
- const BlkLocRegistry& blk_loc_registry) {
873
+ const BlkLocRegistry& blk_loc_registry,
874
+ vtr::RngContainer& rng) {
871
875
// block ID for the randomly selected router cluster
872
876
ClusterBlockId b_from;
873
877
// current location of the randomly selected router cluster
@@ -876,7 +880,11 @@ e_create_move propose_router_swap(t_pl_blocks_to_be_moved& blocks_affected,
876
880
t_logical_block_type_ptr cluster_from_type;
877
881
878
882
// Randomly select a router cluster
879
- bool random_select_success = select_random_router_cluster (b_from, from, cluster_from_type, blk_loc_registry.block_locs ());
883
+ bool random_select_success = select_random_router_cluster (b_from,
884
+ from,
885
+ cluster_from_type,
886
+ blk_loc_registry.block_locs (),
887
+ rng);
880
888
881
889
// If a random router cluster could not be selected, no move can be proposed
882
890
if (!random_select_success) {
@@ -886,7 +894,7 @@ e_create_move propose_router_swap(t_pl_blocks_to_be_moved& blocks_affected,
886
894
// now choose a compatible block to swap with
887
895
t_pl_loc to;
888
896
to.layer = from.layer ;
889
- if (!find_to_loc_uniform (cluster_from_type, rlim, from, to, b_from, blk_loc_registry)) {
897
+ if (!find_to_loc_uniform (cluster_from_type, rlim, from, to, b_from, blk_loc_registry, rng )) {
890
898
return e_create_move::ABORT;
891
899
}
892
900
0 commit comments