openfpga/src/fabric/build_top_module_memory.cpp
/********************************************************************
 * Shuffle the configurable children in a random sequence 
 *
 * TODO: May use a more customized shuffle mechanism
 * TODO: Apply region-based shuffling
 *       The shuffling will be applied to each separated regions 
 *       Configurable children will not shuffled from a region
 *       to another, instead they should stay in the same region
 *
 * Note: 
 *   - This function should NOT be called 
 *     before allocating any configurable child
 ********************************************************************/
Shuffle the configurable children in a random sequence
TODO: May use a more customized shuffle mechanism
TODO: Apply region-based shuffling
The shuffling will be applied to each separated regions
Configurable children will not shuffled from a region
to another, instead they should stay in the same region

- This function should NOT be called
before allocating any configurable child
Shuffle the configurable children in a random sequence TODO : May use a more customized shuffle mechanism TODO : Apply region - based shuffling The shuffling will be applied to each separated regions Configurable children will not shuffled from a region to another instead they should stay in the same region - This function should NOT be called before allocating any configurable child
void shuffle_top_module_configurable_children(ModuleManager& module_manager, 
                                              const ModuleId& top_module,
                                              const ConfigProtocol& config_protocol) {
  size_t num_keys = module_manager.configurable_children(top_module).size();
  std::vector<size_t> shuffled_keys;
  shuffled_keys.reserve(num_keys);
  for (size_t ikey = 0; ikey < num_keys; ++ikey) {
    shuffled_keys.push_back(ikey);
  }
  std::random_shuffle(shuffled_keys.begin(), shuffled_keys.end());
  std::vector<ModuleId> orig_configurable_children = module_manager.configurable_children(top_module);
  std::vector<size_t> orig_configurable_child_instances = module_manager.configurable_child_instances(top_module);
  module_manager.clear_configurable_children(top_module);
  for (size_t ikey = 0; ikey < num_keys; ++ikey) {
    module_manager.add_configurable_child(top_module,
                                          orig_configurable_children[shuffled_keys[ikey]],
                                          orig_configurable_child_instances[shuffled_keys[ikey]]);
  }
  module_manager.clear_config_region(top_module);
  build_top_module_configurable_regions(module_manager, top_module, config_protocol);  
}
void shuffle_top_module_configurable_children ( ModuleManager & module_manager , const ModuleId & top_module , const ConfigProtocol & config_protocol ) { size_t num_keys = module_manager . configurable_children ( top_module ) . size ( ) ; std :: vector < size_t > shuffled_keys ; shuffled_keys . reserve ( num_keys ) ; for ( size_t ikey = 0 ; ikey < num_keys ; ++ ikey ) { shuffled_keys . push_back ( ikey ) ; } std :: random_shuffle ( shuffled_keys . begin ( ) , shuffled_keys . end ( ) ) ; std :: vector < ModuleId > orig_configurable_children = module_manager . configurable_children ( top_module ) ; std :: vector < size_t > orig_configurable_child_instances = module_manager . configurable_child_instances ( top_module ) ; module_manager . clear_configurable_children ( top_module ) ; for ( size_t ikey = 0 ; ikey < num_keys ; ++ ikey ) { module_manager . add_configurable_child ( top_module , orig_configurable_children [ shuffled_keys [ ikey ] ] , orig_configurable_child_instances [ shuffled_keys [ ikey ] ] ) ; } module_manager . clear_config_region ( top_module ) ; build_top_module_configurable_regions ( module_manager , top_module , config_protocol ) ; }
Shuffle the configurable children in a random sequence
 TODO: May use a more customized shuffle mechanism
 TODO: Apply region-based shuffling
       The shuffling will be applied to each separated regions
       Configurable children will not shuffled from a region
       to another, instead they should stay in the same region
Shuffle the configurable children in a random sequence TODO : May use a more customized shuffle mechanism TODO : Apply region - based shuffling The shuffling will be applied to each separated regions Configurable children will not shuffled from a region to another instead they should stay in the same region
/* Cache the configurable children and their instances */ /* Reorganize the configurable children */ /* Reset configurable regions */