openfpga/src/tile_direct/build_tile_direct.cpp
/***************************************************************************************
 * Find the pin ids of a physical tile based on the given port name, LSB and MSB 
 ***************************************************************************************/
Find the pin ids of a physical tile based on the given port name, LSB and MSB
Find the pin ids of a physical tile based on the given port name LSB and MSB
static 
std::vector<size_t> find_physical_tile_pin_id(t_physical_tile_type_ptr physical_tile, 
                                              const size_t& pin_width_offset,
                                              const size_t& pin_height_offset,
                                              const BasicPort& tile_port,
                                              const e_side& pin_side) {
  std::vector<size_t> pin_ids;
  for (const t_physical_tile_port& physical_tile_port : physical_tile->ports) {
    if (std::string(physical_tile_port.name) != tile_port.get_name()) {
      continue;
    }
    if (false == tile_port.is_valid()) {
      for (int ipin = 0; ipin < physical_tile_port.num_pins; ++ipin) {
        int pin_id = physical_tile_port.absolute_first_pin_index + ipin;
        VTR_ASSERT(pin_id < physical_tile->num_pins);
        if (true == is_pin_locate_at_physical_tile_side(physical_tile,
                                                        pin_width_offset,
                                                        pin_height_offset,
                                                        pin_id, pin_side)) {
          pin_ids.push_back(pin_id);
        }
      }
      continue;
    }
    VTR_ASSERT_SAFE(true == tile_port.is_valid());
    BasicPort ref_port(physical_tile_port.name, physical_tile_port.num_pins); 
    if (false == ref_port.contained(tile_port)) {
      VTR_LOG_ERROR("Defined direct port '%s[%lu:%lu]' is out of range for physical port '%s[%lu:%lu]'!\n",
                    tile_port.get_name().c_str(),
                    tile_port.get_lsb(), tile_port.get_msb(),
                    ref_port.get_name().c_str(),
                    ref_port.get_lsb(), ref_port.get_msb());
      exit(1);
    }
    for (const size_t& ipin : tile_port.pins()) {
      int pin_id = physical_tile_port.absolute_first_pin_index + ipin;
      VTR_ASSERT(pin_id < physical_tile->num_pins);
      if (true == is_pin_locate_at_physical_tile_side(physical_tile,
                                                      pin_width_offset,
                                                      pin_height_offset,
                                                      pin_id, pin_side)) {
        pin_ids.push_back(pin_id);
      }
    }
  }
  return pin_ids;
}
static std :: vector < size_t > find_physical_tile_pin_id ( t_physical_tile_type_ptr physical_tile , const size_t & pin_width_offset , const size_t & pin_height_offset , const BasicPort & tile_port , const e_side & pin_side ) { std :: vector < size_t > pin_ids ; for ( const t_physical_tile_port & physical_tile_port : physical_tile -> ports ) { if ( std :: string ( physical_tile_port . name ) != tile_port . get_name ( ) ) { continue ; } if ( false == tile_port . is_valid ( ) ) { for ( int ipin = 0 ; ipin < physical_tile_port . num_pins ; ++ ipin ) { int pin_id = physical_tile_port . absolute_first_pin_index + ipin ; VTR_ASSERT ( pin_id < physical_tile -> num_pins ) ; if ( true == is_pin_locate_at_physical_tile_side ( physical_tile , pin_width_offset , pin_height_offset , pin_id , pin_side ) ) { pin_ids . push_back ( pin_id ) ; } } continue ; } VTR_ASSERT_SAFE ( true == tile_port . is_valid ( ) ) ; BasicPort ref_port ( physical_tile_port . name , physical_tile_port . num_pins ) ; if ( false == ref_port . contained ( tile_port ) ) { VTR_LOG_ERROR ( " \n " , tile_port . get_name ( ) . c_str ( ) , tile_port . get_lsb ( ) , tile_port . get_msb ( ) , ref_port . get_name ( ) . c_str ( ) , ref_port . get_lsb ( ) , ref_port . get_msb ( ) ) ; exit ( 1 ) ; } for ( const size_t & ipin : tile_port . pins ( ) ) { int pin_id = physical_tile_port . absolute_first_pin_index + ipin ; VTR_ASSERT ( pin_id < physical_tile -> num_pins ) ; if ( true == is_pin_locate_at_physical_tile_side ( physical_tile , pin_width_offset , pin_height_offset , pin_id , pin_side ) ) { pin_ids . push_back ( pin_id ) ; } } } return pin_ids ; }
Find the pin ids of a physical tile based on the given port name, LSB and MSB
Find the pin ids of a physical tile based on the given port name LSB and MSB
/* Walk through the port of the tile */ /* If the wanted port is invalid, it assumes that we want the full port */ /* Check if the pin is located on the wanted side */ /* Find the LSB and MSB of the pin */ /* Check if the pin is located on the wanted side */