vpr/src/route/rr_graph.cpp
/* Allocates and loads the global rr_switch_inf array based on the global
 * arch_switch_inf array and the fan-ins used by the rr nodes.
 * Also changes switch indices of rr_nodes to index into rr_switch_inf
 * instead of arch_switch_inf.
 *
 * Returns the number of rr switches created.
 * Also returns, through a pointer, the index of a representative ipin cblock switch.
 * - Currently we're not allowing a designer to specify an ipin cblock switch with
 * multiple fan-ins, so there's just one of these switches in the device_ctx.rr_switch_inf array.
 * But in the future if we allow this, we can return an index to a representative switch
 *
 * The rr_switch_inf switches are derived from the arch_switch_inf switches
 * (which were read-in from the architecture file) based on fan-in. The delays of
 * the rr switches depend on their fan-in, so we first go through the rr_nodes
 * and count how many different fan-ins exist for each arch switch.
 * Then we create these rr switches and update the switch indices
 * of rr_nodes to index into the rr_switch_inf array. */
Allocates and loads the global rr_switch_inf array based on the global
arch_switch_inf array and the fan-ins used by the rr nodes.
Also changes switch indices of rr_nodes to index into rr_switch_inf
instead of arch_switch_inf.

Returns the number of rr switches created.
Also returns, through a pointer, the index of a representative ipin cblock switch.
- Currently we're not allowing a designer to specify an ipin cblock switch with
multiple fan-ins, so there's just one of these switches in the device_ctx.rr_switch_inf array.
But in the future if we allow this, we can return an index to a representative switch

The rr_switch_inf switches are derived from the arch_switch_inf switches
(which were read-in from the architecture file) based on fan-in. The delays of
the rr switches depend on their fan-in, so we first go through the rr_nodes
and count how many different fan-ins exist for each arch switch.
Then we create these rr switches and update the switch indices
of rr_nodes to index into the rr_switch_inf array.
Allocates and loads the global rr_switch_inf array based on the global arch_switch_inf array and the fan - ins used by the rr nodes . Also changes switch indices of rr_nodes to index into rr_switch_inf instead of arch_switch_inf . Returns the number of rr switches created . Also returns through a pointer the index of a representative ipin cblock switch . - Currently we ' re not allowing a designer to specify an ipin cblock switch with multiple fan - ins so there ' s just one of these switches in the device_ctx . rr_switch_inf array . But in the future if we allow this we can return an index to a representative switch The rr_switch_inf switches are derived from the arch_switch_inf switches ( which were read - in from the architecture file ) based on fan - in . The delays of the rr switches depend on their fan - in so we first go through the rr_nodes and count how many different fan - ins exist for each arch switch . Then we create these rr switches and update the switch indices of rr_nodes to index into the rr_switch_inf array .
void alloc_and_load_rr_switch_inf(const int num_arch_switches, const float R_minW_nmos, const float R_minW_pmos, const int wire_to_arch_ipin_switch, int* wire_to_rr_ipin_switch) {
    t_arch_switch_fanin arch_switch_fanins(num_arch_switches);
    alloc_rr_switch_inf(arch_switch_fanins);
    load_rr_switch_inf(num_arch_switches, R_minW_nmos, R_minW_pmos, arch_switch_fanins);
    remap_rr_node_switch_indices(arch_switch_fanins);
    if (arch_switch_fanins[wire_to_arch_ipin_switch].count(UNDEFINED)) {
        (*wire_to_rr_ipin_switch) = arch_switch_fanins[wire_to_arch_ipin_switch][UNDEFINED];
    } else if (arch_switch_fanins[wire_to_arch_ipin_switch].size() != 0) {
        VPR_FATAL_ERROR(VPR_ERROR_ARCH,
                        "Not currently allowing an ipin cblock switch to have multiple fan-ins");
    } else {
        Instead of throwing an error we issue a warning. This means that check_rr_graph() etc. will run to give more information
        and allow graphics to be brought up for users to debug their architectures.
        (*wire_to_rr_ipin_switch) = OPEN;
        VTR_LOG_WARN("No switch found for the ipin cblock in RR graph. Check if there is an error in arch file, or if no connection blocks are being built in RR graph\n");
    }
}
void alloc_and_load_rr_switch_inf ( const int num_arch_switches , const float R_minW_nmos , const float R_minW_pmos , const int wire_to_arch_ipin_switch , int * wire_to_rr_ipin_switch ) { t_arch_switch_fanin arch_switch_fanins ( num_arch_switches ) ; alloc_rr_switch_inf ( arch_switch_fanins ) ; load_rr_switch_inf ( num_arch_switches , R_minW_nmos , R_minW_pmos , arch_switch_fanins ) ; remap_rr_node_switch_indices ( arch_switch_fanins ) ; if ( arch_switch_fanins [ wire_to_arch_ipin_switch ] . count ( UNDEFINED ) ) { ( * wire_to_rr_ipin_switch ) = arch_switch_fanins [ wire_to_arch_ipin_switch ] [ UNDEFINED ] ; } else if ( arch_switch_fanins [ wire_to_arch_ipin_switch ] . size ( ) != 0 ) { VPR_FATAL_ERROR ( VPR_ERROR_ARCH , " " ) ; } else { ( * wire_to_rr_ipin_switch ) = OPEN ; VTR_LOG_WARN ( " \n " ) ; } }
Allocates and loads the global rr_switch_inf array based on the global
 arch_switch_inf array and the fan-ins used by the rr nodes.
Allocates and loads the global rr_switch_inf array based on the global arch_switch_inf array and the fan - ins used by the rr nodes .
/* we will potentially be creating a couple of versions of each arch switch where
     * each version corresponds to a different fan-in. We will need to fill device_ctx.rr_switch_inf
     * with this expanded list of switches.
     *
     * To do this we will use arch_switch_fanins, which is indexed as:
     *      arch_switch_fanins[i_arch_switch][fanin] -> new_switch_id
     */ /* Determine what the different fan-ins are for each arch switch, and also
     * how many entries the rr_switch_inf array should have */ /* create the rr switches. also keep track of, for each arch switch, what index of the rr_switch_inf
     * array each version of its fanin has been mapped to */ /* next, walk through rr nodes again and remap their switch indices to rr_switch_inf */ /* now we need to set the wire_to_rr_ipin_switch variable which points the detailed routing architecture
     * to the representative ipin cblock switch. currently we're not allowing the specification of an ipin cblock switch
     * with multiple fan-ins, so right now there's just one. May change in the future, in which case we'd need to
     * return a representative switch */ /* only have one ipin cblock switch. OK. */ //This likely indicates that no connection block has been constructed, indicating significant issues with //the generated RR graph. // //Instead of throwing an error we issue a warning. This means that check_rr_graph() etc. will run to give more information //and allow graphics to be brought up for users to debug their architectures.