VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
rr_graph_util.c File Reference
#include "util.h"
#include "vpr_types.h"
#include "globals.h"
#include "rr_graph_util.h"
+ Include dependency graph for rr_graph_util.c:

Go to the source code of this file.

Functions

t_linked_edgeinsert_in_edge_list (INP t_linked_edge *head, INP int edge, INP 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)
 

Function Documentation

t_linked_edge* insert_in_edge_list ( INP t_linked_edge head,
INP int  edge,
INP short  iswitch 
)

Definition at line 7 of file rr_graph_util.c.

7  {
8 
9  /* Inserts a new element at the head of a linked list. Returns the new head *
10  * of the list. One argument is the address of the head of a list of free *
11  * edge_list elements. If there are any elements on this free list, the new *
12  * element is taken from it. Otherwise a new one is malloced. */
13 
14  t_linked_edge *linked_edge;
15 
16  linked_edge = (t_linked_edge *) my_malloc(sizeof(t_linked_edge));
17 
18  linked_edge->edge = edge;
19  linked_edge->iswitch = iswitch;
20  linked_edge->next = head;
21 
22  return linked_edge;
23 }
static void * my_malloc(int ibytes)
Definition: graphics.c:499
struct s_linked_edge * next
Definition: rr_graph_util.h:4

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int seg_index_of_cblock ( t_rr_type  from_rr_type,
int  to_node 
)

Definition at line 40 of file rr_graph_util.c.

40  {
41 
42  /* Returns the segment number (distance along the channel) of the connection *
43  * box from from_rr_type (CHANX or CHANY) to to_node (IPIN). */
44 
45  if (from_rr_type == CHANX)
46  return (rr_node[to_node].xlow);
47  else
48  /* CHANY */
49  return (rr_node[to_node].ylow);
50 }
t_rr_node * rr_node
Definition: globals.c:70

+ Here is the caller graph for this function:

int seg_index_of_sblock ( int  from_node,
int  to_node 
)

Definition at line 52 of file rr_graph_util.c.

52  {
53 
54  /* Returns the segment number (distance along the channel) of the switch box *
55  * box from from_node (CHANX or CHANY) to to_node (CHANX or CHANY). The *
56  * switch box on the left side of a CHANX segment at (i,j) has seg_index = *
57  * i-1, while the switch box on the right side of that segment has seg_index *
58  * = i. CHANY stuff works similarly. Hence the range of values returned is *
59  * 0 to nx (if from_node is a CHANX) or 0 to ny (if from_node is a CHANY). */
60 
61  t_rr_type from_rr_type, to_rr_type;
62 
63  from_rr_type = rr_node[from_node].type;
64  to_rr_type = rr_node[to_node].type;
65 
66  if (from_rr_type == CHANX) {
67  if (to_rr_type == CHANY) {
68  return (rr_node[to_node].xlow);
69  } else if (to_rr_type == CHANX) {
70  if (rr_node[to_node].xlow > rr_node[from_node].xlow) { /* Going right */
71  return (rr_node[from_node].xhigh);
72  } else { /* Going left */
73  return (rr_node[to_node].xhigh);
74  }
75  } else {
76  vpr_printf(TIO_MESSAGE_ERROR, "in seg_index_of_sblock: to_node %d is of type %d.\n",
77  to_node, to_rr_type);
78  exit(1);
79  }
80  }
81  /* End from_rr_type is CHANX */
82  else if (from_rr_type == CHANY) {
83  if (to_rr_type == CHANX) {
84  return (rr_node[to_node].ylow);
85  } else if (to_rr_type == CHANY) {
86  if (rr_node[to_node].ylow > rr_node[from_node].ylow) { /* Going up */
87  return (rr_node[from_node].yhigh);
88  } else { /* Going down */
89  return (rr_node[to_node].yhigh);
90  }
91  } else {
92  vpr_printf(TIO_MESSAGE_ERROR, "in seg_index_of_sblock: to_node %d is of type %d.\n",
93  to_node, to_rr_type);
94  exit(1);
95  }
96  }
97  /* End from_rr_type is CHANY */
98  else {
99  vpr_printf(TIO_MESSAGE_ERROR, "in seg_index_of_sblock: from_node %d is of type %d.\n",
100  from_node, from_rr_type);
101  exit(1);
102  }
103 }
t_rr_node * rr_node
Definition: globals.c:70
enum e_rr_type t_rr_type
messagelogger vpr_printf
Definition: util.c:17
t_rr_type type
Definition: vpr_types.h:902

+ Here is the caller graph for this function: