VPR-6.0

vpr/SRC/route/check_route.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void check_route (enum e_route_type route_type, int num_switch, t_ivec **clb_opins_used_locally)

Function Documentation

void check_route ( enum e_route_type  route_type,
int  num_switch,
t_ivec **  clb_opins_used_locally 
)

This routine checks that a routing: (1) Describes a properly connected path for each net, (2) this path connects all the pins spanned by that net, and (3) that no routing resources are oversubscribed (the occupancy of everything is recomputed from scratch).

Definition at line 45 of file check_route.c.

{

    int inet, ipin, max_pins, inode, prev_node;
    boolean valid, connects;
    boolean *connected_to_route;        /* [0 .. num_rr_nodes-1] */
    struct s_trace *tptr;
    boolean *pin_done;

    printf("\nChecking to ensure routing is legal ...\n");

/* Recompute the occupancy from scratch and check for overuse of routing *
 * resources.  This was already checked in order to determine that this  *
 * is a successful routing, but I want to double check it here.          */

    recompute_occupancy_from_scratch(clb_opins_used_locally);
    valid = feasible_routing();
    if(valid == FALSE)
        {
            printf
                ("Error in check_route -- routing resources are overused.\n");
            exit(1);
        }

    check_locally_used_clb_opins(clb_opins_used_locally, route_type);

    connected_to_route = (boolean *) my_calloc(num_rr_nodes, sizeof(boolean));

    max_pins = 0;
    for(inet = 0; inet < num_nets; inet++)
        max_pins = max(max_pins, (clb_net[inet].num_sinks + 1));

    pin_done = (boolean *) my_malloc(max_pins * sizeof(boolean));

/* Now check that all nets are indeed connected. */

    for(inet = 0; inet < num_nets; inet++)
        {

                if(clb_net[inet].is_global || clb_net[inet].num_sinks == 0)     /* Skip global nets. */
                continue;

            for(ipin = 0; ipin < (clb_net[inet].num_sinks + 1); ipin++)
                pin_done[ipin] = FALSE;

/* Check the SOURCE of the net. */

            tptr = trace_head[inet];
            if(tptr == NULL)
                {
                    printf("Error in check_route:  net %d has no routing.\n",
                           inet);
                    exit(1);
                }

            inode = tptr->index;
            check_node_and_range(inode, route_type);
            check_switch(tptr, num_switch);
            connected_to_route[inode] = TRUE;   /* Mark as in path. */

            check_source(inode, inet);
            pin_done[0] = TRUE;

            prev_node = inode;
            tptr = tptr->next;

/* Check the rest of the net */

            while(tptr != NULL)
                {
                    inode = tptr->index;
                    check_node_and_range(inode, route_type);
                    check_switch(tptr, num_switch);

                    if(rr_node[prev_node].type == SINK)
                        {
                            if(connected_to_route[inode] == FALSE)
                                {
                                    printf
                                        ("Error in check_route.  Node %d does not link "
                                         "into the existing routing for net %d.\n",
                                         inode, inet);
                                    exit(1);
                                }
                        }

                    else
                        {
                            connects = check_adjacent(prev_node, inode);
                            if(!connects)
                                {
                                    printf
                                        ("Error in check_route while checking net %d.\n",
                                         inet);
                                    printf
                                        ("Non-adjacent segments in traceback.\n");
                                    exit(1);
                                }

                            if(connected_to_route[inode]
                               && rr_node[inode].type != SINK)
                                {

                                    /* Note:  Can get multiple connections to the same logically-equivalent     *
                                     * SINK in some logic blocks.                                               */

                                    printf
                                        ("Error in check_route:  net %d routing is not a tree.\n",
                                         inet);
                                    exit(1);
                                }

                            connected_to_route[inode] = TRUE;   /* Mark as in path. */

                            if(rr_node[inode].type == SINK)
                                check_sink(inode, inet, pin_done);

                        }       /* End of prev_node type != SINK */
                    prev_node = inode;
                    tptr = tptr->next;
                }               /* End while */

            if(rr_node[prev_node].type != SINK)
                {
                    printf("Error in check_route.  Net %d does not end\n",
                           inet);
                    printf("with a SINK.\n");
                    exit(1);
                }

            for(ipin = 0; ipin < (clb_net[inet].num_sinks + 1); ipin++)
                {
                    if(pin_done[ipin] == FALSE)
                        {
                            printf
                                ("Error in check_route.  Net %d does not \n",
                                 inet);
                            printf("connect to pin %d.\n", ipin);
                            exit(1);
                        }
                }

            reset_flags(inet, connected_to_route);

        }                       /* End for each net */

    free(pin_done);
    free(connected_to_route);
    printf("Completed routing consistency check successfully.\n\n");
}

Here is the call graph for this function:

Here is the caller graph for this function: