VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
rr_graph.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef enum e_graph_type t_graph_type
 

Enumerations

enum  e_graph_type { GRAPH_GLOBAL, GRAPH_BIDIR, GRAPH_UNIDIR, GRAPH_UNIDIR_TILEABLE }
 
enum  { RR_GRAPH_NO_WARN = 0x00, RR_GRAPH_WARN_FC_CLIPPED = 0x01, RR_GRAPH_WARN_CHAN_WIDTH_CHANGED = 0x02 }
 

Functions

void build_rr_graph (INP t_graph_type graph_type, INP int L_num_types, INP t_type_ptr types, INP int L_nx, INP int L_ny, INP struct s_grid_tile **L_grid, INP int chan_width, INP struct s_chan_width_dist *chan_capacity_inf, INP enum e_switch_block_type sb_type, INP int Fs, INP int num_seg_types, INP int num_switches, INP t_segment_inf *segment_inf, INP int global_route_switch, INP int delayless_switch, INP t_timing_inf timing_inf, INP int wire_to_ipin_switch, INP enum e_base_cost_type base_cost_type, INP t_direct_inf *directs, INP int num_directs, INP boolean ignore_Fc_0, OUTP int *Warnings)
 
void free_rr_graph (void)
 
void dump_rr_graph (INP const char *file_name)
 
void print_rr_indexed_data (FILE *fp, int index)
 
void load_net_rr_terminals (t_ivec ***L_rr_node_indices)
 
void print_rr_node (FILE *fp, t_rr_node *L_rr_node, int inode)
 

Typedef Documentation

typedef enum e_graph_type t_graph_type

Definition at line 11 of file rr_graph.h.

Enumeration Type Documentation

anonymous enum
Enumerator
RR_GRAPH_NO_WARN 
RR_GRAPH_WARN_FC_CLIPPED 
RR_GRAPH_WARN_CHAN_WIDTH_CHANGED 

Definition at line 15 of file rr_graph.h.

Enumerator
GRAPH_GLOBAL 
GRAPH_BIDIR 
GRAPH_UNIDIR 
GRAPH_UNIDIR_TILEABLE 

Definition at line 4 of file rr_graph.h.

4  {
5  GRAPH_GLOBAL, /* One node per channel with wire capacity > 1 and full connectivity */
6  GRAPH_BIDIR, /* Detailed bidirectional graph */
7  GRAPH_UNIDIR, /* Detailed unidir graph, untilable */
8  /* RESEARCH TODO: Get this option debugged */
9  GRAPH_UNIDIR_TILEABLE /* Detail unidir graph with wire groups multiples of 2*L */
10 };

Function Documentation

void build_rr_graph ( INP t_graph_type  graph_type,
INP int  L_num_types,
INP t_type_ptr  types,
INP int  L_nx,
INP int  L_ny,
INP struct s_grid_tile **  L_grid,
INP int  chan_width,
INP struct s_chan_width_dist chan_capacity_inf,
INP enum e_switch_block_type  sb_type,
INP int  Fs,
INP int  num_seg_types,
INP int  num_switches,
INP t_segment_inf segment_inf,
INP int  global_route_switch,
INP int  delayless_switch,
INP t_timing_inf  timing_inf,
INP int  wire_to_ipin_switch,
INP enum e_base_cost_type  base_cost_type,
INP t_direct_inf directs,
INP int  num_directs,
INP boolean  ignore_Fc_0,
OUTP int *  Warnings 
)

Definition at line 192 of file rr_graph.c.

201  {
202  /* Temp structures used to build graph */
203  int nodes_per_chan, i, j;
204  t_seg_details *seg_details = NULL;
205  int **Fc_in = NULL; /* [0..num_types-1][0..num_pins-1] */
206  int **Fc_out = NULL; /* [0..num_types-1][0..num_pins-1] */
207 
208  int *****opin_to_track_map = NULL; /* [0..num_types-1][0..num_pins-1][0..height][0..3][0..Fc-1] */
209  int *****ipin_to_track_map = NULL; /* [0..num_types-1][0..num_pins-1][0..height][0..3][0..Fc-1] */
210  t_ivec ****track_to_ipin_lookup = NULL; /* [0..num_types-1][0..nodes_per_chan-1][0..height][0..3] */
211  t_ivec ***switch_block_conn = NULL;
212  short *****unidir_sb_pattern = NULL;
213  boolean *L_rr_edge_done = NULL;
214  boolean is_global_graph;
215  boolean Fc_clipped;
216  boolean use_full_seg_groups;
217  boolean *perturb_ipins = NULL;
218  enum e_directionality directionality;
219  int **Fc_xofs = NULL; /* [0..ny-1][0..nx-1] */
220  int **Fc_yofs = NULL; /* [0..nx-1][0..ny-1] */
221  t_clb_to_clb_directs *clb_to_clb_directs;
222 
223  rr_node_indices = NULL;
224  rr_node = NULL;
225  num_rr_nodes = 0;
226 
227  /* Reset warning flag */
228  *Warnings = RR_GRAPH_NO_WARN;
229 
230  /* Decode the graph_type */
231  is_global_graph = FALSE;
232  if (GRAPH_GLOBAL == graph_type) {
233  is_global_graph = TRUE;
234  }
235  use_full_seg_groups = FALSE;
236  if (GRAPH_UNIDIR_TILEABLE == graph_type) {
237  use_full_seg_groups = TRUE;
238  }
239  directionality = UNI_DIRECTIONAL;
240  if (GRAPH_BIDIR == graph_type) {
241  directionality = BI_DIRECTIONAL;
242  }
243  if (is_global_graph) {
244  directionality = BI_DIRECTIONAL;
245  }
246 
247  /* Global routing uses a single longwire track */
248  nodes_per_chan = (is_global_graph ? 1 : chan_width);
249  assert(nodes_per_chan > 0);
250 
251  clb_to_clb_directs = NULL;
252  if(num_directs > 0) {
253  clb_to_clb_directs = alloc_and_load_clb_to_clb_directs(directs, num_directs);
254  }
255 
256  /* START SEG_DETAILS */
257  if (is_global_graph) {
258  /* Sets up a single unit length segment type for global routing. */
259  seg_details = alloc_and_load_global_route_seg_details(nodes_per_chan,
260  global_route_switch);
261  } else {
262  /* Setup segments including distrubuting tracks and staggering.
263  * If use_full_seg_groups is specified, nodes_per_chan may be
264  * changed. Warning should be singled to caller if this happens. */
265  seg_details = alloc_and_load_seg_details(&nodes_per_chan,
266  std::max(L_nx, L_ny), num_seg_types, segment_inf,
267  use_full_seg_groups, is_global_graph, directionality);
268  if ((is_global_graph ? 1 : chan_width) != nodes_per_chan) {
270  }
272  dump_seg_details(seg_details, nodes_per_chan,
274  } else
275  ;
276  }
277  /* END SEG_DETAILS */
278 
279  /* START FC */
280  /* Determine the actual value of Fc */
281  if (is_global_graph) {
282  Fc_in = (int **) my_malloc(sizeof(int) * L_num_types);
283  Fc_out = (int **) my_malloc(sizeof(int) * L_num_types);
284  for (i = 0; i < L_num_types; ++i) {
285  for (j = 0; j < types[i].num_pins; ++j) {
286  Fc_in[i][j] = 1;
287  Fc_out[i][j] = 1;
288  }
289  }
290  } else {
291  Fc_clipped = FALSE;
292  Fc_in = alloc_and_load_actual_fc(L_num_types, types, nodes_per_chan,
293  FALSE, directionality, &Fc_clipped, ignore_Fc_0);
294  if (Fc_clipped) {
295  *Warnings |= RR_GRAPH_WARN_FC_CLIPPED;
296  }
297  Fc_clipped = FALSE;
298  Fc_out = alloc_and_load_actual_fc(L_num_types, types, nodes_per_chan,
299  TRUE, directionality, &Fc_clipped, ignore_Fc_0);
300  if (Fc_clipped) {
301  *Warnings |= RR_GRAPH_WARN_FC_CLIPPED;
302  }
303 
304 #ifdef VERBOSE
305  for (i = 1; i < L_num_types; ++i) { /* Skip "<EMPTY>" */
306  for (j = 0; j < type_descriptors[i].num_pins; ++j) {
307  if (type_descriptors[i].is_Fc_full_flex[j]) {
308  vpr_printf(TIO_MESSAGE_INFO, "Fc Actual Values: type = %s, Fc_out = full, Fc_in = %d.\n",
309  type_descriptors[i].name, Fc_in[i][j]);
310  }
311  else {
312  vpr_printf(TIO_MESSAGE_INFO, "Fc Actual Values: type = %s, Fc_out = %d, Fc_in = %d.\n",
313  type_descriptors[i].name, Fc_out[i][j], Fc_in[i][j]);
314  }
315  }
316  }
317 #endif /* VERBOSE */
318  }
319 
320  perturb_ipins = alloc_and_load_perturb_ipins(nodes_per_chan, L_num_types,
321  Fc_in, Fc_out, directionality);
322  /* END FC */
323 
324  /* Alloc node lookups, count nodes, alloc rr nodes */
325  num_rr_nodes = 0;
326  rr_node_indices = alloc_and_load_rr_node_indices(nodes_per_chan, L_nx, L_ny,
327  &num_rr_nodes, seg_details);
329  memset(rr_node, 0, sizeof(t_rr_node) * num_rr_nodes);
330  L_rr_edge_done = (boolean *) my_malloc(sizeof(boolean) * num_rr_nodes);
331  memset(L_rr_edge_done, 0, sizeof(boolean) * num_rr_nodes);
332 
333  /* These are data structures used by the the unidir opin mapping. */
334  if (UNI_DIRECTIONAL == directionality) {
335  Fc_xofs = (int **) alloc_matrix(0, L_ny, 0, L_nx, sizeof(int));
336  Fc_yofs = (int **) alloc_matrix(0, L_nx, 0, L_ny, sizeof(int));
337  for (i = 0; i <= L_nx; ++i) {
338  for (j = 0; j <= L_ny; ++j) {
339  Fc_xofs[j][i] = 0;
340  Fc_yofs[i][j] = 0;
341  }
342  }
343  }
344 
345  /* START SB LOOKUP */
346  /* Alloc and load the switch block lookup */
347  if (is_global_graph) {
348  assert(nodes_per_chan == 1);
349  switch_block_conn = alloc_and_load_switch_block_conn(1, SUBSET, 3);
350  } else if (BI_DIRECTIONAL == directionality) {
351  switch_block_conn = alloc_and_load_switch_block_conn(nodes_per_chan,
352  sb_type, Fs);
353  } else {
354  assert(UNI_DIRECTIONAL == directionality);
355 
356  unidir_sb_pattern = alloc_sblock_pattern_lookup(L_nx, L_ny,
357  nodes_per_chan);
358  for (i = 0; i <= L_nx; i++) {
359  for (j = 0; j <= L_ny; j++) {
360  load_sblock_pattern_lookup(i, j, nodes_per_chan, seg_details,
361  Fs, sb_type, unidir_sb_pattern);
362  }
363  }
364  }
365  /* END SB LOOKUP */
366 
367  /* START IPINP MAP */
368  /* Create ipin map lookups */
369  ipin_to_track_map = (int *****) my_malloc(sizeof(int ****) * L_num_types);
370  track_to_ipin_lookup = (struct s_ivec ****) my_malloc(
371  sizeof(struct s_ivec ***) * L_num_types);
372  for (i = 0; i < L_num_types; ++i) {
373  ipin_to_track_map[i] = alloc_and_load_pin_to_track_map(RECEIVER,
374  nodes_per_chan, Fc_in[i], &types[i], perturb_ipins[i],
375  directionality);
376  track_to_ipin_lookup[i] = alloc_and_load_track_to_pin_lookup(
377  ipin_to_track_map[i], Fc_in[i], types[i].height,
378  types[i].num_pins, nodes_per_chan);
379  }
380  /* END IPINP MAP */
381 
382  /* START OPINP MAP */
383  /* Create opin map lookups */
384  if (BI_DIRECTIONAL == directionality) {
385  opin_to_track_map = (int *****) my_malloc(
386  sizeof(int ****) * L_num_types);
387  for (i = 0; i < L_num_types; ++i) {
388  opin_to_track_map[i] = alloc_and_load_pin_to_track_map(DRIVER,
389  nodes_per_chan, Fc_out[i], &types[i], FALSE, directionality);
390  }
391  }
392  /* END OPINP MAP */
393 
394  /* UDSD Modifications by WMF begin */
395  /* I'm adding 2 new fields to t_rr_node, and I want them initialized to 0. */
396  for (i = 0; i < num_rr_nodes; i++) {
397  rr_node[i].num_wire_drivers = 0;
398  rr_node[i].num_opin_drivers = 0;
399  }
400 
401  alloc_and_load_rr_graph(num_rr_nodes, rr_node, num_seg_types, seg_details,
402  L_rr_edge_done, track_to_ipin_lookup, opin_to_track_map,
403  switch_block_conn, L_grid, L_nx, L_ny, Fs, unidir_sb_pattern,
404  Fc_out, Fc_xofs, Fc_yofs, rr_node_indices, nodes_per_chan, sb_type,
405  delayless_switch, directionality, wire_to_ipin_switch, &Fc_clipped, directs, num_directs, clb_to_clb_directs);
406 
407 #ifdef MUX_SIZE_DIST_DISPLAY
408  if (UNI_DIRECTIONAL == directionality)
409  {
410  view_mux_size_distribution(rr_node_indices, nodes_per_chan,
411  seg_details, seg_details);
412  }
413 #endif
414 
415  /* Update rr_nodes capacities if global routing */
416  if (graph_type == GRAPH_GLOBAL) {
417  for (i = 0; i < num_rr_nodes; i++) {
418  if (rr_node[i].type == CHANX || rr_node[i].type == CHANY) {
419  rr_node[i].capacity = chan_width;
420  }
421  }
422  }
423 
424  rr_graph_externals(timing_inf, segment_inf, num_seg_types, nodes_per_chan,
425  wire_to_ipin_switch, base_cost_type);
428  } else
429  ;
430 
431  check_rr_graph(graph_type, types, L_nx, L_ny, nodes_per_chan, Fs,
432  num_seg_types, num_switches, segment_inf, global_route_switch,
433  delayless_switch, wire_to_ipin_switch, seg_details, Fc_in, Fc_out,
434  opin_to_track_map, ipin_to_track_map, track_to_ipin_lookup,
435  switch_block_conn, perturb_ipins);
436 
437  /* Free all temp structs */
438  if (seg_details) {
439  free_seg_details(seg_details, nodes_per_chan);
440  seg_details = NULL;
441  }
442  if (Fc_in) {
443  free_matrix(Fc_in,0, L_num_types, 0, sizeof(int));
444  Fc_in = NULL;
445  }
446  if (Fc_out) {
447  free_matrix(Fc_out,0, L_num_types, 0, sizeof(int));
448  Fc_out = NULL;
449  }
450  if (perturb_ipins) {
451  free(perturb_ipins);
452  perturb_ipins = NULL;
453  }
454  if (switch_block_conn) {
455  free_switch_block_conn(switch_block_conn, nodes_per_chan);
456  switch_block_conn = NULL;
457  }
458  if (L_rr_edge_done) {
459  free(L_rr_edge_done);
460  L_rr_edge_done = NULL;
461  }
462  if (Fc_xofs) {
463  free_matrix(Fc_xofs, 0, L_ny, 0, sizeof(int));
464  Fc_xofs = NULL;
465  }
466  if (Fc_yofs) {
467  free_matrix(Fc_yofs, 0, L_nx, 0, sizeof(int));
468  Fc_yofs = NULL;
469  }
470  if (unidir_sb_pattern) {
471  free_sblock_pattern_lookup(unidir_sb_pattern);
472  unidir_sb_pattern = NULL;
473  }
474  if (opin_to_track_map) {
475  for (i = 0; i < L_num_types; ++i) {
476  free_matrix4(opin_to_track_map[i], 0, types[i].num_pins - 1, 0,
477  types[i].height - 1, 0, 3, 0, sizeof(int));
478  }
479  free(opin_to_track_map);
480  }
481 
482  free_type_pin_to_track_map(ipin_to_track_map, types);
483  free_type_track_to_ipin_map(track_to_ipin_lookup, types, nodes_per_chan);
484  if(clb_to_clb_directs != NULL) {
485  free(clb_to_clb_directs);
486  }
487 }
void ** alloc_matrix(int nrmin, int nrmax, int ncmin, int ncmax, size_t elsize)
Definition: util.c:551
void free_matrix4(void *vptr, int nrmin, int nrmax, int ncmin, int ncmax, int ndmin, int ndmax, int nemin, size_t elsize)
Definition: util.c:678
t_rr_node * rr_node
Definition: globals.c:70
void free_matrix(void *vptr, int nrmin, int nrmax, int ncmin, size_t elsize)
Definition: util.c:573
static t_seg_details * alloc_and_load_global_route_seg_details(INP int nodes_per_chan, INP int global_route_switch)
Definition: rr_graph.c:540
t_seg_details * alloc_and_load_seg_details(INOUTP int *nodes_per_chan, INP int max_len, INP int num_seg_types, INP t_segment_inf *segment_inf, INP boolean use_full_seg_groups, INP boolean is_global_graph, INP enum e_directionality directionality)
Definition: rr_graph2.c:175
void check_rr_graph(INP t_graph_type graph_type, INP t_type_ptr types, INP int L_nx, INP int L_ny, INP int nodes_per_chan, INP int Fs, INP int num_seg_types, INP int num_switches, INP t_segment_inf *segment_inf, INP int global_route_switch, INP int delayless_switch, INP int wire_to_ipin_switch, t_seg_details *seg_details, int **Fc_in, int **Fc_out, int *****opin_to_track_map, int *****ipin_to_track_map, t_ivec ****track_to_ipin_lookup, t_ivec ***switch_block_conn, boolean *perturb_ipins)
void load_sblock_pattern_lookup(INP int i, INP int j, INP int nodes_per_chan, INP t_seg_details *seg_details, INP int Fs, INP enum e_switch_block_type switch_block_type, INOUTP short *****sblock_pattern)
Definition: rr_graph2.c:1524
struct s_ivec *** alloc_and_load_rr_node_indices(INP int nodes_per_chan, INP int L_nx, INP int L_ny, INOUTP int *index, INP t_seg_details *seg_details)
Definition: rr_graph2.c:707
static void free_type_pin_to_track_map(int *****ipin_to_track_map, t_type_ptr types)
Definition: rr_graph.c:656
static int **** alloc_and_load_pin_to_track_map(INP enum e_pin_type pin_type, INP int nodes_per_chan, INP int *Fc, INP t_type_ptr Type, INP boolean perturb_switch_pattern, INP enum e_directionality directionality)
Definition: rr_graph.c:1358
boolean getEchoEnabled(void)
Definition: ReadOptions.c:67
static void rr_graph_externals(t_timing_inf timing_inf, t_segment_inf *segment_inf, int num_seg_types, int nodes_per_chan, int wire_to_ipin_switch, enum e_base_cost_type base_cost_type)
Definition: rr_graph.c:489
Definition: util.h:12
static void free_type_track_to_ipin_map(struct s_ivec ****track_to_pin_map, t_type_ptr types, int nodes_per_chan)
Definition: rr_graph.c:633
struct s_ivec *** alloc_and_load_switch_block_conn(INP int nodes_per_chan, INP enum e_switch_block_type switch_block_type, INP int Fs)
Definition: rr_graph_sbox.c:36
static int ** alloc_and_load_actual_fc(INP int L_num_types, INP t_type_ptr types, INP int nodes_per_chan, INP boolean is_Fc_out, INP enum e_directionality directionality, OUTP boolean *Fc_clipped, INP boolean ignore_Fc_0)
Definition: rr_graph.c:570
static void * my_malloc(int ibytes)
Definition: graphics.c:499
#define max(a, b)
Definition: graphics.c:171
int num_rr_nodes
Definition: globals.c:69
static t_clb_to_clb_directs * alloc_and_load_clb_to_clb_directs(INP t_direct_inf *directs, INP int num_directs)
Definition: rr_graph.c:2577
void dump_rr_graph(INP const char *file_name)
Definition: rr_graph.c:1788
boolean isEchoFileEnabled(enum e_echo_files echo_option)
Definition: ReadOptions.c:115
short capacity
Definition: vpr_types.h:899
int num_opin_drivers
Definition: vpr_types.h:912
void free_sblock_pattern_lookup(INOUTP short *****sblock_pattern)
Definition: rr_graph2.c:1508
Definition: util.h:47
t_ivec *** rr_node_indices
Definition: globals.c:71
void free_seg_details(t_seg_details *seg_details, int nodes_per_chan)
Definition: rr_graph2.c:358
static void alloc_and_load_rr_graph(INP int num_nodes, INP t_rr_node *L_rr_node, INP int num_seg_types, INP t_seg_details *seg_details, INP boolean *L_rr_edge_done, INP struct s_ivec ****track_to_ipin_lookup, INP int *****opin_to_track_map, INP struct s_ivec ***switch_block_conn, INP struct s_grid_tile **L_grid, INP int L_nx, INP int L_ny, INP int Fs, INP short *****sblock_pattern, INP int **Fc_out, INP int **Fc_xofs, INP int **Fc_yofs, INP t_ivec ***L_rr_node_indices, INP int nodes_per_chan, INP enum e_switch_block_type sb_type, INP int delayless_switch, INP enum e_directionality directionality, INP int wire_to_ipin_switch, OUTP boolean *Fc_clipped, INP t_direct_inf *directs, INP int num_directs, INP t_clb_to_clb_directs *clb_to_clb_directs)
Definition: rr_graph.c:668
static boolean * alloc_and_load_perturb_ipins(INP int nodes_per_chan, INP int L_num_types, INP int **Fc_in, INP int **Fc_out, INP enum e_directionality directionality)
Definition: rr_graph.c:502
short ***** alloc_sblock_pattern_lookup(INP int L_nx, INP int L_ny, INP int nodes_per_chan)
Definition: rr_graph2.c:1444
struct s_type_descriptor * type_descriptors
Definition: globals.c:38
char * getEchoFileName(enum e_echo_files echo_option)
Definition: ReadOptions.c:122
void free_switch_block_conn(struct s_ivec ***switch_block_conn, int nodes_per_chan)
Definition: rr_graph_sbox.c:92
messagelogger vpr_printf
Definition: util.c:17
void dump_seg_details(t_seg_details *seg_details, int nodes_per_chan, const char *fname)
Definition: rr_graph2.c:373
static struct s_ivec *** alloc_and_load_track_to_pin_lookup(INP int ****pin_to_track_map, INP int *Fc, INP int height, INP int num_pins, INP int nodes_per_chan)
Definition: rr_graph.c:1699
Definition: util.h:12
int num_wire_drivers
Definition: vpr_types.h:911
e_directionality

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dump_rr_graph ( INP const char *  file_name)

Definition at line 1788 of file rr_graph.c.

1788  {
1789 
1790  int inode;
1791  FILE *fp;
1792 
1793  fp = my_fopen(file_name, "w", 0);
1794 
1795  for (inode = 0; inode < num_rr_nodes; inode++) {
1796  print_rr_node(fp, rr_node, inode);
1797  fprintf(fp, "\n");
1798  }
1799 
1800 #if 0
1801  fprintf(fp, "\n\n%d rr_indexed_data entries.\n\n", num_rr_indexed_data);
1802 
1803  for (index = 0; index < num_rr_indexed_data; index++)
1804  {
1805  print_rr_indexed_data(fp, index);
1806  fprintf(fp, "\n");
1807  }
1808 #endif
1809 
1810  fclose(fp);
1811 }
void print_rr_indexed_data(FILE *fp, int index)
Definition: rr_graph.c:1868
FILE * my_fopen(const char *fname, const char *flag, int prompt)
Definition: util.c:54
t_rr_node * rr_node
Definition: globals.c:70
int num_rr_indexed_data
Definition: globals.c:73
int num_rr_nodes
Definition: globals.c:69
void print_rr_node(FILE *fp, t_rr_node *L_rr_node, int inode)
Definition: rr_graph.c:1814

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void free_rr_graph ( void  )

Definition at line 798 of file rr_graph.c.

798  {
799  int i;
800 
801  /* Frees all the routing graph data structures, if they have been *
802  * allocated. I use rr_mem_chunk_list_head as a flag to indicate *
803  * whether or not the graph has been allocated -- if it is not NULL, *
804  * a routing graph exists and can be freed. Hence, you can call this *
805  * routine even if you're not sure of whether a rr_graph exists or not. */
806 
807  if (rr_mem_ch.chunk_ptr_head == NULL) /* Nothing to free. */
808  return;
809 
810  free_chunk_memory(&rr_mem_ch); /* Frees ALL "chunked" data */
811 
812  /* Before adding any more free calls here, be sure the data is NOT chunk *
813  * allocated, as ALL the chunk allocated data is already free! */
814 
815  if(net_rr_terminals != NULL) {
816  free(net_rr_terminals);
817  }
818  for (i = 0; i < num_rr_nodes; i++) {
819  if (rr_node[i].edges != NULL) {
820  free(rr_node[i].edges);
821  }
822  if (rr_node[i].switches != NULL) {
823  free(rr_node[i].switches);
824  }
825  }
826 
827  assert(rr_node_indices);
829  free(rr_node);
830  free(rr_indexed_data);
831  for (i = 0; i < num_blocks; i++) {
832  free(rr_blk_source[i]);
833  }
834  free(rr_blk_source);
835  rr_blk_source = NULL;
836  net_rr_terminals = NULL;
837  rr_node = NULL;
838  rr_node_indices = NULL;
839  rr_indexed_data = NULL;
840  num_rr_nodes = 0;
841 }
t_rr_node * rr_node
Definition: globals.c:70
static t_chunk rr_mem_ch
Definition: rr_graph.c:50
t_rr_indexed_data * rr_indexed_data
Definition: globals.c:74
struct s_linked_vptr * chunk_ptr_head
Definition: util.h:58
int num_blocks
Definition: globals.c:30
int num_rr_nodes
Definition: globals.c:69
t_ivec *** rr_node_indices
Definition: globals.c:71
int ** rr_blk_source
Definition: globals.c:87
int ** net_rr_terminals
Definition: globals.c:78
void free_chunk_memory(t_chunk *chunk_info)
Definition: util.c:270
void free_rr_node_indices(INP t_ivec ***L_rr_node_indices)
Definition: rr_graph2.c:797

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void load_net_rr_terminals ( t_ivec ***  L_rr_node_indices)

Definition at line 855 of file rr_graph.c.

855  {
856 
857  /* Allocates and loads the net_rr_terminals data structure. For each net *
858  * it stores the rr_node index of the SOURCE of the net and all the SINKs *
859  * of the net. [0..num_nets-1][0..num_pins-1]. Entry [inet][pnum] stores *
860  * the rr index corresponding to the SOURCE (opin) or SINK (ipin) of pnum. */
861 
862  int inet, ipin, inode, iblk, i, j, node_block_pin, iclass;
863  t_type_ptr type;
864 
865  for (inet = 0; inet < num_nets; inet++) {
866  for (ipin = 0; ipin <= clb_net[inet].num_sinks; ipin++) {
867  iblk = clb_net[inet].node_block[ipin];
868  i = block[iblk].x;
869  j = block[iblk].y;
870  type = block[iblk].type;
871 
872  /* In the routing graph, each (x, y) location has unique pins on it
873  * so when there is capacity, blocks are packed and their pin numbers
874  * are offset to get their actual rr_node */
875  node_block_pin = clb_net[inet].node_block_pin[ipin];
876 
877  iclass = type->pin_class[node_block_pin];
878 
879  inode = get_rr_node_index(i, j, (ipin == 0 ? SOURCE : SINK), /* First pin is driver */
880  iclass, L_rr_node_indices);
881  net_rr_terminals[inet][ipin] = inode;
882  }
883  }
884 }
int * node_block_pin
Definition: vpr_types.h:509
int x
Definition: vpr_types.h:563
int num_nets
Definition: globals.c:27
int * node_block
Definition: vpr_types.h:507
t_type_ptr type
Definition: vpr_types.h:561
int get_rr_node_index(int x, int y, t_rr_type rr_type, int ptc, t_ivec ***L_rr_node_indices)
Definition: rr_graph2.c:846
int y
Definition: vpr_types.h:564
struct s_block * block
Definition: globals.c:31
struct s_net * clb_net
Definition: globals.c:28
int ** net_rr_terminals
Definition: globals.c:78
int num_sinks
Definition: vpr_types.h:506

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void print_rr_indexed_data ( FILE *  fp,
int  index 
)

Definition at line 1868 of file rr_graph.c.

1868  {
1869 
1870  fprintf(fp, "Index: %d\n", index);
1871 
1872  fprintf(fp, "ortho_cost_index: %d ",
1873  rr_indexed_data[index].ortho_cost_index);
1874  fprintf(fp, "base_cost: %g ", rr_indexed_data[index].saved_base_cost);
1875  fprintf(fp, "saved_base_cost: %g\n",
1876  rr_indexed_data[index].saved_base_cost);
1877 
1878  fprintf(fp, "Seg_index: %d ", rr_indexed_data[index].seg_index);
1879  fprintf(fp, "inv_length: %g\n", rr_indexed_data[index].inv_length);
1880 
1881  fprintf(fp, "T_linear: %g ", rr_indexed_data[index].T_linear);
1882  fprintf(fp, "T_quadratic: %g ", rr_indexed_data[index].T_quadratic);
1883  fprintf(fp, "C_load: %g\n", rr_indexed_data[index].C_load);
1884 }
t_rr_indexed_data * rr_indexed_data
Definition: globals.c:74

+ Here is the caller graph for this function:

void print_rr_node ( FILE *  fp,
t_rr_node L_rr_node,
int  inode 
)

Definition at line 1814 of file rr_graph.c.

1814  {
1815 
1816  static const char *name_type[] = { "SOURCE", "SINK", "IPIN", "OPIN",
1817  "CHANX", "CHANY", "INTRA_CLUSTER_EDGE" };
1818  static const char *direction_name[] = { "OPEN", "INC_DIRECTION",
1819  "DEC_DIRECTION", "BI_DIRECTION" };
1820  static const char *drivers_name[] = { "OPEN", "MULTI_BUFFER", "SINGLE" };
1821 
1822  t_rr_type rr_type;
1823  int iconn;
1824 
1825  rr_type = L_rr_node[inode].type;
1826 
1827  /* Make sure we don't overrun const arrays */
1828  assert((int)rr_type < (int)(sizeof(name_type) / sizeof(char *)));
1829  assert(
1830  (L_rr_node[inode].direction + 1) < (int)(sizeof(direction_name) / sizeof(char *)));
1831  assert(
1832  (L_rr_node[inode].drivers + 1) < (int)(sizeof(drivers_name) / sizeof(char *)));
1833 
1834  fprintf(fp, "Node: %d %s ", inode, name_type[rr_type]);
1835  if ((L_rr_node[inode].xlow == L_rr_node[inode].xhigh)
1836  && (L_rr_node[inode].ylow == L_rr_node[inode].yhigh)) {
1837  fprintf(fp, "(%d, %d) ", L_rr_node[inode].xlow, L_rr_node[inode].ylow);
1838  } else {
1839  fprintf(fp, "(%d, %d) to (%d, %d) ", L_rr_node[inode].xlow,
1840  L_rr_node[inode].ylow, L_rr_node[inode].xhigh,
1841  L_rr_node[inode].yhigh);
1842  }
1843  fprintf(fp, "Ptc_num: %d ", L_rr_node[inode].ptc_num);
1844  fprintf(fp, "Direction: %s ",
1845  direction_name[L_rr_node[inode].direction + 1]);
1846  fprintf(fp, "Drivers: %s ", drivers_name[L_rr_node[inode].drivers + 1]);
1847  fprintf(fp, "\n");
1848 
1849  fprintf(fp, "%d edge(s):", L_rr_node[inode].num_edges);
1850  for (iconn = 0; iconn < L_rr_node[inode].num_edges; iconn++)
1851  fprintf(fp, " %d", L_rr_node[inode].edges[iconn]);
1852  fprintf(fp, "\n");
1853 
1854  fprintf(fp, "Switch types:");
1855  for (iconn = 0; iconn < L_rr_node[inode].num_edges; iconn++)
1856  fprintf(fp, " %d", L_rr_node[inode].switches[iconn]);
1857  fprintf(fp, "\n");
1858 
1859  fprintf(fp, "Occ: %d Capacity: %d\n", L_rr_node[inode].occ,
1860  L_rr_node[inode].capacity);
1861  if (rr_type != INTRA_CLUSTER_EDGE) {
1862  fprintf(fp, "R: %g C: %g\n", L_rr_node[inode].R, L_rr_node[inode].C);
1863  }
1864  fprintf(fp, "Cost_index: %d\n", L_rr_node[inode].cost_index);
1865 }
short num_edges
Definition: vpr_types.h:901
static const char * name_type[]
Definition: draw.c:87
enum e_rr_type t_rr_type
t_rr_type type
Definition: vpr_types.h:902

+ Here is the caller graph for this function: