#include "util.h"
#include "vpr_types.h"
#include "globals.h"
#include "rr_graph_util.h"
Go to the source code of this file.
Functions | |
t_linked_edge * | insert_in_edge_list (IN t_linked_edge *head, IN int edge, IN short iswitch) |
int | seg_index_of_cblock (t_rr_type from_rr_type, int to_node) |
int | seg_index_of_sblock (int from_node, int to_node) |
t_linked_edge* insert_in_edge_list | ( | IN t_linked_edge * | head, | |
IN int | edge, | |||
IN short | iswitch | |||
) |
Definition at line 10 of file rr_graph_util.c.
00013 { 00014 00015 /* Inserts a new element at the head of a linked list. Returns the new head * 00016 * of the list. One argument is the address of the head of a list of free * 00017 * edge_list elements. If there are any elements on this free list, the new * 00018 * element is taken from it. Otherwise a new one is malloced. */ 00019 00020 t_linked_edge *linked_edge; 00021 00022 linked_edge = (t_linked_edge *) my_malloc(sizeof(t_linked_edge)); 00023 00024 linked_edge->edge = edge; 00025 linked_edge->iswitch = iswitch; 00026 linked_edge->next = head; 00027 00028 return linked_edge; 00029 }
int seg_index_of_cblock | ( | t_rr_type | from_rr_type, | |
int | to_node | |||
) |
Definition at line 48 of file rr_graph_util.c.
00050 { 00051 00052 /* Returns the segment number (distance along the channel) of the connection * 00053 * box from from_rr_type (CHANX or CHANY) to to_node (IPIN). */ 00054 00055 if(from_rr_type == CHANX) 00056 return (rr_node[to_node].xlow); 00057 else /* CHANY */ 00058 return (rr_node[to_node].ylow); 00059 }
int seg_index_of_sblock | ( | int | from_node, | |
int | to_node | |||
) |
Definition at line 63 of file rr_graph_util.c.
00065 { 00066 00067 /* Returns the segment number (distance along the channel) of the switch box * 00068 * box from from_node (CHANX or CHANY) to to_node (CHANX or CHANY). The * 00069 * switch box on the left side of a CHANX segment at (i,j) has seg_index = * 00070 * i-1, while the switch box on the right side of that segment has seg_index * 00071 * = i. CHANY stuff works similarly. Hence the range of values returned is * 00072 * 0 to nx (if from_node is a CHANX) or 0 to ny (if from_node is a CHANY). */ 00073 00074 t_rr_type from_rr_type, to_rr_type; 00075 00076 from_rr_type = rr_node[from_node].type; 00077 to_rr_type = rr_node[to_node].type; 00078 00079 if(from_rr_type == CHANX) 00080 { 00081 if(to_rr_type == CHANY) 00082 { 00083 return (rr_node[to_node].xlow); 00084 } 00085 else if(to_rr_type == CHANX) 00086 { 00087 if(rr_node[to_node].xlow > rr_node[from_node].xlow) 00088 { /* Going right */ 00089 return (rr_node[from_node].xhigh); 00090 } 00091 else 00092 { /* Going left */ 00093 return (rr_node[to_node].xhigh); 00094 } 00095 } 00096 else 00097 { 00098 printf 00099 ("Error in seg_index_of_sblock: to_node %d is of type %d.\n", 00100 to_node, to_rr_type); 00101 exit(1); 00102 } 00103 } 00104 /* End from_rr_type is CHANX */ 00105 else if(from_rr_type == CHANY) 00106 { 00107 if(to_rr_type == CHANX) 00108 { 00109 return (rr_node[to_node].ylow); 00110 } 00111 else if(to_rr_type == CHANY) 00112 { 00113 if(rr_node[to_node].ylow > rr_node[from_node].ylow) 00114 { /* Going up */ 00115 return (rr_node[from_node].yhigh); 00116 } 00117 else 00118 { /* Going down */ 00119 return (rr_node[to_node].yhigh); 00120 } 00121 } 00122 else 00123 { 00124 printf 00125 ("Error in seg_index_of_sblock: to_node %d is of type %d.\n", 00126 to_node, to_rr_type); 00127 exit(1); 00128 } 00129 } 00130 /* End from_rr_type is CHANY */ 00131 else 00132 { 00133 printf 00134 ("Error in seg_index_of_sblock: from_node %d is of type %d.\n", 00135 from_node, from_rr_type); 00136 exit(1); 00137 } 00138 }