vpr/src/tileable_rr_graph/chan_node_details.cpp
/* rotate the track_node_id by an offset */
rotate the track_node_id by an offset
rotate the track_node_id by an offset
void ChanNodeDetails::rotate_track_node_id(const size_t& offset, const e_direction& track_direction, const bool& counter_rotate) {
  if (0 == offset) {
    return;
  }
  VTR_ASSERT(validate_chan_width());
  for (size_t itrack = 0; itrack < get_chan_width(); ++itrack) { 
    if (false == is_track_start(itrack) ) {
      continue;
    }
    if (track_direction != get_track_direction(itrack) ) {
      continue;
    }
    std::vector<size_t> track_group = get_seg_group(itrack);
    std::vector<size_t> track_group_node_id = get_seg_group_node_id(track_group);
    size_t actual_offset = offset % track_group_node_id.size();
    if (true == counter_rotate) {
      std::rotate(track_group_node_id.rbegin(), track_group_node_id.rbegin() + actual_offset, track_group_node_id.rend());
    } else {
      std::rotate(track_group_node_id.begin(), track_group_node_id.begin() + actual_offset, track_group_node_id.end());
    }
    for (size_t inode = 0; inode < track_group.size(); ++inode) {
      track_node_ids_[track_group[inode]] = track_group_node_id[inode];
    }
  }
  return;
}
void ChanNodeDetails :: rotate_track_node_id ( const size_t & offset , const e_direction & track_direction , const bool & counter_rotate ) { if ( 0 == offset ) { return ; } VTR_ASSERT ( validate_chan_width ( ) ) ; for ( size_t itrack = 0 ; itrack < get_chan_width ( ) ; ++ itrack ) { if ( false == is_track_start ( itrack ) ) { continue ; } if ( track_direction != get_track_direction ( itrack ) ) { continue ; } std :: vector < size_t > track_group = get_seg_group ( itrack ) ; std :: vector < size_t > track_group_node_id = get_seg_group_node_id ( track_group ) ; size_t actual_offset = offset % track_group_node_id . size ( ) ; if ( true == counter_rotate ) { std :: rotate ( track_group_node_id . rbegin ( ) , track_group_node_id . rbegin ( ) + actual_offset , track_group_node_id . rend ( ) ) ; } else { std :: rotate ( track_group_node_id . begin ( ) , track_group_node_id . begin ( ) + actual_offset , track_group_node_id . end ( ) ) ; } for ( size_t inode = 0 ; inode < track_group . size ( ) ; ++ inode ) { track_node_ids_ [ track_group [ inode ] ] = track_group_node_id [ inode ] ; } } return ; }
rotate the track_node_id by an offset
rotate the track_node_id by an offset
/* Direct return if offset = 0*/ /* Rotate the node_ids by groups
   * A group begins from a track_start and ends before another track_start  
   */ /* Bypass non-start segment */ /* Bypass segments do not match track_direction */ /* Find the group nodes */ /* Build a vector of the node ids of the tracks */ /* adapt offset to the range of track_group_node_id */ /* Rotate or Counter rotate */ /* Update the node_ids */