openfpga/src/repack/lb_router.cpp
// Check one edge for mode conflict.
Check one edge for mode conflict.
Check one edge for mode conflict .
bool LbRouter::check_edge_for_route_conflicts(std::unordered_map<const t_pb_graph_node*, const t_mode*>& mode_map,
                                              const t_pb_graph_pin* driver_pin,
                                              const t_pb_graph_pin* pin) {
  if (driver_pin == nullptr) {
    return false;
  }
  if (pin == nullptr || pin->port == nullptr || pin->port->type != OUT_PORT) {
    return false;
  }
  VTR_ASSERT(!pin->port->is_clock);
  auto* pb_graph_node = pin->parent_node;
  VTR_ASSERT(pb_graph_node->pb_type == pin->port->parent_pb_type);
  const t_pb_graph_edge* edge = get_edge_between_pins(driver_pin, pin);
  VTR_ASSERT(edge != nullptr);
  auto mode_of_edge = edge->interconnect->parent_mode_index;
  auto* mode = &pb_graph_node->pb_type->modes[mode_of_edge];
  auto result = mode_map.insert(std::make_pair(pb_graph_node, mode));
  if (!result.second) {
    if (result.first->second != mode) {
      VTR_LOG("Differing modes for block. Got %s mode, while previously was %s for interconnect %s.\n",
              mode->name, result.first->second->name,
              edge->interconnect->name);
      auto it = illegal_modes_.find(pb_graph_node);
      if (it == illegal_modes_.end()) {
        illegal_modes_[pb_graph_node].push_back(result.first->second);
      } else {
        if (std::find(illegal_modes_.at(pb_graph_node).begin(), illegal_modes_.at(pb_graph_node).end(), result.first->second) == illegal_modes_.at(pb_graph_node).end()) {
          it->second.push_back(result.first->second);
        }
      }
      if ((int)illegal_modes_.at(pb_graph_node).size() >= pb_graph_node->pb_type->num_modes) {
        VPR_FATAL_ERROR(VPR_ERROR_PACK, "There are no more available modes to be used. Routing Failed!");
      }
      return true;
    }
  }
  return false;
}
bool LbRouter :: check_edge_for_route_conflicts ( std :: unordered_map < const t_pb_graph_node * , const t_mode * > & mode_map , const t_pb_graph_pin * driver_pin , const t_pb_graph_pin * pin ) { if ( driver_pin == nullptr ) { return false ; } if ( pin == nullptr || pin -> port == nullptr || pin -> port -> type != OUT_PORT ) { return false ; } VTR_ASSERT ( ! pin -> port -> is_clock ) ; auto * pb_graph_node = pin -> parent_node ; VTR_ASSERT ( pb_graph_node -> pb_type == pin -> port -> parent_pb_type ) ; const t_pb_graph_edge * edge = get_edge_between_pins ( driver_pin , pin ) ; VTR_ASSERT ( edge != nullptr ) ; auto mode_of_edge = edge -> interconnect -> parent_mode_index ; auto * mode = & pb_graph_node -> pb_type -> modes [ mode_of_edge ] ; auto result = mode_map . insert ( std :: make_pair ( pb_graph_node , mode ) ) ; if ( ! result . second ) { if ( result . first -> second != mode ) { VTR_LOG ( " \n " , mode -> name , result . first -> second -> name , edge -> interconnect -> name ) ; auto it = illegal_modes_ . find ( pb_graph_node ) ; if ( it == illegal_modes_ . end ( ) ) { illegal_modes_ [ pb_graph_node ] . push_back ( result . first -> second ) ; } else { if ( std :: find ( illegal_modes_ . at ( pb_graph_node ) . begin ( ) , illegal_modes_ . at ( pb_graph_node ) . end ( ) , result . first -> second ) == illegal_modes_ . at ( pb_graph_node ) . end ( ) ) { it -> second . push_back ( result . first -> second ) ; } } if ( ( int ) illegal_modes_ . at ( pb_graph_node ) . size ( ) >= pb_graph_node -> pb_type -> num_modes ) { VPR_FATAL_ERROR ( VPR_ERROR_PACK , " " ) ; } return true ; } } return false ; }
Check one edge for mode conflict.
Check one edge for mode conflict .
// Only check pins that are OUT_PORTs. // The illegal mode is added to the pb_graph_node as it resulted in a conflict during atom-to-atom routing. This mode cannot be used in the consequent cluster // generation try. // If the number of illegal modes equals the number of available mode for a specific pb_graph_node it means that no cluster can be generated. This resuts // in a fatal error.