3434static bool select_random_router_cluster (ClusterBlockId& b_from,
3535 t_pl_loc& from,
3636 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);
3839
3940/* *
4041 * @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) {
820821}
821822
822823/* 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) {
824826 /* A random number between 0-100 is generated here and compared to the user
825827 * supplied value. If the random number is less than the user supplied
826828 * value we indicate that a router block should be swapped. By doing this
827829 * we now only swap router blocks for the percentage of time the user
828830 * supplied.
829831 * */
830- return (vtr:: irand (99 ) < user_supplied_noc_router_swap_percentage);
832+ return (rng. irand (99 ) < user_supplied_noc_router_swap_percentage);
831833}
832834
833835static bool select_random_router_cluster (ClusterBlockId& b_from,
834836 t_pl_loc& from,
835837 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) {
837840 // need to access all the router cluster blocks in the design
838841 const auto & noc_ctx = g_vpr_ctx.noc ();
839842 auto & cluster_ctx = g_vpr_ctx.clustering ();
@@ -849,7 +852,7 @@ static bool select_random_router_cluster(ClusterBlockId& b_from,
849852 const int number_of_router_blocks = static_cast <int >(router_clusters.size ());
850853
851854 // 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 );
853856 b_from = router_clusters[random_cluster_block_index];
854857
855858 // check if the block is movable
@@ -867,7 +870,8 @@ static bool select_random_router_cluster(ClusterBlockId& b_from,
867870
868871e_create_move propose_router_swap (t_pl_blocks_to_be_moved& blocks_affected,
869872 float rlim,
870- const BlkLocRegistry& blk_loc_registry) {
873+ const BlkLocRegistry& blk_loc_registry,
874+ vtr::RngContainer& rng) {
871875 // block ID for the randomly selected router cluster
872876 ClusterBlockId b_from;
873877 // 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,
876880 t_logical_block_type_ptr cluster_from_type;
877881
878882 // 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);
880888
881889 // If a random router cluster could not be selected, no move can be proposed
882890 if (!random_select_success) {
@@ -886,7 +894,7 @@ e_create_move propose_router_swap(t_pl_blocks_to_be_moved& blocks_affected,
886894 // now choose a compatible block to swap with
887895 t_pl_loc to;
888896 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 )) {
890898 return e_create_move::ABORT;
891899 }
892900
0 commit comments