openfpga/src/repack/lb_router_utils.cpp
/***************************************************************************************
 * Load the routing results (routing tree) from lb router to 
 * a physical pb data structure
 ***************************************************************************************/
Load the routing results (routing tree) from lb router to
a physical pb data structure
Load the routing results ( routing tree ) from lb router to a physical pb data structure
void save_lb_router_results_to_physical_pb(PhysicalPb& phy_pb,
                                           const LbRouter& lb_router,
                                           const LbRRGraph& lb_rr_graph) {
  for (const LbRouter::NetId& net : lb_router.nets()) {
    std::vector<LbRRNodeId> routed_nodes = lb_router.net_routed_nodes(net);
    for (const LbRRNodeId& node : routed_nodes) {
      t_pb_graph_pin* pb_graph_pin = lb_rr_graph.node_pb_graph_pin(node);
      if (nullptr == pb_graph_pin) {
        continue;
      }
      const PhysicalPbId& pb_id = phy_pb.find_pb(pb_graph_pin->parent_node);
      VTR_ASSERT(true == phy_pb.valid_pb_id(pb_id));
      const AtomNetId& atom_net = lb_router.net_atom_net_id(net);
      if (AtomNetId::INVALID() == phy_pb.pb_graph_pin_atom_net(pb_id, pb_graph_pin)) {
        phy_pb.set_pb_graph_pin_atom_net(pb_id, pb_graph_pin, atom_net);
      } else {
        VTR_ASSERT(atom_net == phy_pb.pb_graph_pin_atom_net(pb_id, pb_graph_pin));
      }
    }
  }
}
void save_lb_router_results_to_physical_pb ( PhysicalPb & phy_pb , const LbRouter & lb_router , const LbRRGraph & lb_rr_graph ) { for ( const LbRouter :: NetId & net : lb_router . nets ( ) ) { std :: vector < LbRRNodeId > routed_nodes = lb_router . net_routed_nodes ( net ) ; for ( const LbRRNodeId & node : routed_nodes ) { t_pb_graph_pin * pb_graph_pin = lb_rr_graph . node_pb_graph_pin ( node ) ; if ( nullptr == pb_graph_pin ) { continue ; } const PhysicalPbId & pb_id = phy_pb . find_pb ( pb_graph_pin -> parent_node ) ; VTR_ASSERT ( true == phy_pb . valid_pb_id ( pb_id ) ) ; const AtomNetId & atom_net = lb_router . net_atom_net_id ( net ) ; if ( AtomNetId :: INVALID ( ) == phy_pb . pb_graph_pin_atom_net ( pb_id , pb_graph_pin ) ) { phy_pb . set_pb_graph_pin_atom_net ( pb_id , pb_graph_pin , atom_net ) ; } else { VTR_ASSERT ( atom_net == phy_pb . pb_graph_pin_atom_net ( pb_id , pb_graph_pin ) ) ; } } } }
Load the routing results (routing tree) from lb router to
 a physical pb data structure
Load the routing results ( routing tree ) from lb router to a physical pb data structure
/* Get mapping routing nodes per net */ /* Find the pb id */ /* Print info to help debug 
      bool verbose = true;
      VTR_LOGV(verbose,
               "\nSave net '%lu' to physical pb_graph_pin '%s.%s[%d]'\n",
               size_t(atom_net),
               pb_graph_pin->parent_node->pb_type->name,
               pb_graph_pin->port->name,
               pb_graph_pin->pin_number);
       */