Go to the source code of this file.
Functions | |
void | check_route (enum e_route_type route_type, int num_switch, t_ivec **fb_opins_used_locally) |
void check_route | ( | enum e_route_type | route_type, | |
int | num_switch, | |||
t_ivec ** | fb_opins_used_locally | |||
) |
Definition at line 39 of file check_route.c.
00042 { 00043 00044 /* This routine checks that a routing: (1) Describes a properly * 00045 * connected path for each net, (2) this path connects all the * 00046 * pins spanned by that net, and (3) that no routing resources are * 00047 * oversubscribed (the occupancy of everything is recomputed from * 00048 * scratch). */ 00049 00050 int inet, ipin, max_pins, inode, prev_node; 00051 boolean valid, connects; 00052 boolean *connected_to_route; /* [0 .. num_rr_nodes-1] */ 00053 struct s_trace *tptr; 00054 boolean *pin_done; 00055 00056 printf("\nChecking to ensure routing is legal ...\n"); 00057 00058 /* Recompute the occupancy from scratch and check for overuse of routing * 00059 * resources. This was already checked in order to determine that this * 00060 * is a successful routing, but I want to double check it here. */ 00061 00062 recompute_occupancy_from_scratch(fb_opins_used_locally); 00063 valid = feasible_routing(); 00064 if(valid == FALSE) 00065 { 00066 printf 00067 ("Error in check_route -- routing resources are overused.\n"); 00068 exit(1); 00069 } 00070 00071 check_locally_used_fb_opins(fb_opins_used_locally, route_type); 00072 00073 connected_to_route = (boolean *) my_calloc(num_rr_nodes, sizeof(boolean)); 00074 00075 max_pins = 0; 00076 for(inet = 0; inet < num_nets; inet++) 00077 max_pins = max(max_pins, (net[inet].num_sinks + 1)); 00078 00079 pin_done = (boolean *) my_malloc(max_pins * sizeof(boolean)); 00080 00081 /* Now check that all nets are indeed connected. */ 00082 00083 for(inet = 0; inet < num_nets; inet++) 00084 { 00085 00086 if(net[inet].is_global) /* Skip global nets. */ 00087 continue; 00088 00089 for(ipin = 0; ipin < (net[inet].num_sinks + 1); ipin++) 00090 pin_done[ipin] = FALSE; 00091 00092 /* Check the SOURCE of the net. */ 00093 00094 tptr = trace_head[inet]; 00095 if(tptr == NULL) 00096 { 00097 printf("Error in check_route: net %d has no routing.\n", 00098 inet); 00099 exit(1); 00100 } 00101 00102 inode = tptr->index; 00103 check_node_and_range(inode, route_type); 00104 check_switch(tptr, num_switch); 00105 connected_to_route[inode] = TRUE; /* Mark as in path. */ 00106 00107 check_source(inode, inet); 00108 pin_done[0] = TRUE; 00109 00110 prev_node = inode; 00111 tptr = tptr->next; 00112 00113 /* Check the rest of the net */ 00114 00115 while(tptr != NULL) 00116 { 00117 inode = tptr->index; 00118 check_node_and_range(inode, route_type); 00119 check_switch(tptr, num_switch); 00120 00121 if(rr_node[prev_node].type == SINK) 00122 { 00123 if(connected_to_route[inode] == FALSE) 00124 { 00125 printf 00126 ("Error in check_route. Node %d does not link " 00127 "into the existing routing for net %d.\n", 00128 inode, inet); 00129 exit(1); 00130 } 00131 } 00132 00133 else 00134 { 00135 connects = check_adjacent(prev_node, inode); 00136 if(!connects) 00137 { 00138 printf 00139 ("Error in check_route while checking net %d.\n", 00140 inet); 00141 printf 00142 ("Non-adjacent segments in traceback.\n"); 00143 exit(1); 00144 } 00145 00146 if(connected_to_route[inode] 00147 && rr_node[inode].type != SINK) 00148 { 00149 00150 /* Note: Can get multiple connections to the same logically-equivalent * 00151 * SINK in some logic blocks. */ 00152 00153 printf 00154 ("Error in check_route: net %d routing is not a tree.\n", 00155 inet); 00156 exit(1); 00157 } 00158 00159 connected_to_route[inode] = TRUE; /* Mark as in path. */ 00160 00161 if(rr_node[inode].type == SINK) 00162 check_sink(inode, inet, pin_done); 00163 00164 } /* End of prev_node type != SINK */ 00165 prev_node = inode; 00166 tptr = tptr->next; 00167 } /* End while */ 00168 00169 if(rr_node[prev_node].type != SINK) 00170 { 00171 printf("Error in check_route. Net %d does not end\n", 00172 inet); 00173 printf("with a SINK.\n"); 00174 exit(1); 00175 } 00176 00177 for(ipin = 0; ipin < (net[inet].num_sinks + 1); ipin++) 00178 { 00179 if(pin_done[ipin] == FALSE) 00180 { 00181 printf 00182 ("Error in check_route. Net %d does not \n", 00183 inet); 00184 printf("connect to pin %d.\n", ipin); 00185 exit(1); 00186 } 00187 } 00188 00189 reset_flags(inet, connected_to_route); 00190 00191 } /* End for each net */ 00192 00193 free(pin_done); 00194 free(connected_to_route); 00195 printf("Completed routing consistency check successfully.\n\n"); 00196 }