vpr/src/route/rr_graph.cpp
/* Allocates space for the global device_ctx.rr_switch_inf variable and returns the
 * number of rr switches that were allocated */
Allocates space for the global device_ctx.rr_switch_inf variable and returns the
number of rr switches that were allocated
Allocates space for the global device_ctx . rr_switch_inf variable and returns the number of rr switches that were allocated
static void alloc_rr_switch_inf(t_arch_switch_fanin& arch_switch_fanins) {
    auto& device_ctx = g_vpr_ctx.mutable_device();
    int num_rr_switches = 0;
    {
        Note that since we don't store backward edge info in the RR graph we need to walk
        the whole graph to get the per-switch-type fanin info
        vtr::vector<RRNodeId, vtr::flat_map<int, int>> inward_switch_inf(device_ctx.rr_graph.nodes().size()); [to_node][arch_switch] -> fanin
        for (const RRNodeId& inode : device_ctx.rr_graph.nodes()) {
            for (const RREdgeId& iedge : device_ctx.rr_graph.node_out_edges(inode)) {
                int iswitch = (int)size_t(device_ctx.rr_graph.edge_switch(iedge));
                RRNodeId to_node = device_ctx.rr_graph.edge_sink_node(iedge);
                if (inward_switch_inf[to_node].count(iswitch) == 0) {
                    inward_switch_inf[to_node][iswitch] = 0;
                }
                inward_switch_inf[to_node][iswitch]++;
            }
        }
        Record the unique switch type/fanin combinations
        for (const RRNodeId& inode : device_ctx.rr_graph.nodes()) {
            for (auto& switch_fanin : inward_switch_inf[inode]) {
                int iswitch, fanin;
                std::tie(iswitch, fanin) = switch_fanin;
                if (device_ctx.arch_switch_inf[iswitch].fixed_Tdel()) {
                    If delay is independent of fanin drop the unique fanin info
                    fanin = UNDEFINED;
                }
                if (arch_switch_fanins[iswitch].count(fanin) == 0) {        New fanin for this switch
                    arch_switch_fanins[iswitch][fanin] = num_rr_switches++; Assign it a unique index
                }
            }
        }
    }
    device_ctx.rr_switch_inf.resize(num_rr_switches);
}
static void alloc_rr_switch_inf ( t_arch_switch_fanin & arch_switch_fanins ) { auto & device_ctx = g_vpr_ctx . mutable_device ( ) ; int num_rr_switches = 0 ; { vtr :: vector < RRNodeId , vtr :: flat_map < int , int > > inward_switch_inf ( device_ctx . rr_graph . nodes ( ) . size ( ) ) ; for ( const RRNodeId & inode : device_ctx . rr_graph . nodes ( ) ) { for ( const RREdgeId & iedge : device_ctx . rr_graph . node_out_edges ( inode ) ) { int iswitch = ( int ) size_t ( device_ctx . rr_graph . edge_switch ( iedge ) ) ; RRNodeId to_node = device_ctx . rr_graph . edge_sink_node ( iedge ) ; if ( inward_switch_inf [ to_node ] . count ( iswitch ) == 0 ) { inward_switch_inf [ to_node ] [ iswitch ] = 0 ; } inward_switch_inf [ to_node ] [ iswitch ] ++ ; } } for ( const RRNodeId & inode : device_ctx . rr_graph . nodes ( ) ) { for ( auto & switch_fanin : inward_switch_inf [ inode ] ) { int iswitch , fanin ; std :: tie ( iswitch , fanin ) = switch_fanin ; if ( device_ctx . arch_switch_inf [ iswitch ] . fixed_Tdel ( ) ) { fanin = UNDEFINED ; } if ( arch_switch_fanins [ iswitch ] . count ( fanin ) == 0 ) { arch_switch_fanins [ iswitch ] [ fanin ] = num_rr_switches ++ ; } } } } device_ctx . rr_switch_inf . resize ( num_rr_switches ) ; }
Allocates space for the global device_ctx.rr_switch_inf variable and returns the
 number of rr switches that were allocated
Allocates space for the global device_ctx . rr_switch_inf variable and returns the number of rr switches that were allocated
//Collect the fan-in per switch type for each node in the graph // //Note that since we don't store backward edge info in the RR graph we need to walk //the whole graph to get the per-switch-type fanin info //[to_node][arch_switch] -> fanin //Record the unique switch type/fanin combinations //If delay is independent of fanin drop the unique fanin info //New fanin for this switch //Assign it a unique index /* allocate space for the rr_switch_inf array */