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

Go to the source code of this file.

Functions

void routing_stats (boolean full_stats, enum e_route_type route_type, int num_switch, t_segment_inf *segment_inf, int num_segment, float R_minW_nmos, float R_minW_pmos, enum e_directionality directionality, boolean timing_analysis_enabled, float **net_delay, t_slack *slacks)
 
void print_wirelen_prob_dist (void)
 
void print_lambda (void)
 
void get_num_bends_and_length (int inet, int *bends, int *length, int *segments)
 
int count_netlist_clocks (void)
 

Function Documentation

int count_netlist_clocks ( void  )

Definition at line 449 of file stats.c.

449  {
450 
451  /* Count how many clocks are in the netlist. */
452 
453  int iblock, i, clock_net;
454  char * name;
455  boolean found;
456  int num_clocks = 0;
457  char ** clock_names = NULL;
458 
459  for (iblock = 0; iblock < num_logical_blocks; iblock++) {
460  if (logical_block[iblock].clock_net != OPEN) {
461  clock_net = logical_block[iblock].clock_net;
462  assert(clock_net != OPEN);
463  name = logical_block[clock_net].name;
464  /* Now that we've found a clock, let's see if we've counted it already */
465  found = FALSE;
466  for (i = 0; !found && i < num_clocks; i++) {
467  if (strcmp(clock_names[i], name) == 0) {
468  found = TRUE;
469  }
470  }
471  if (!found) {
472  /* If we get here, the clock is new and so we dynamically grow the array netlist_clocks by one. */
473  clock_names = (char **) my_realloc (clock_names, ++num_clocks * sizeof(char *));
474  clock_names[num_clocks - 1] = name;
475  }
476  }
477  }
478  free (clock_names);
479  return num_clocks;
480 }
Definition: util.h:12
int iblock
Definition: vpr_types.h:868
static void * my_realloc(void *memblk, int ibytes)
Definition: graphics.c:512
int num_logical_blocks
Definition: globals.c:17
Definition: slre.c:50
struct s_logical_block * logical_block
Definition: globals.c:20
Definition: util.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void get_num_bends_and_length ( int  inet,
int *  bends,
int *  length,
int *  segments 
)

Definition at line 276 of file stats.c.

277  {
278 
279  /* Counts and returns the number of bends, wirelength, and number of routing *
280  * resource segments in net inet's routing. */
281 
282  struct s_trace *tptr, *prevptr;
283  int inode;
284  t_rr_type curr_type, prev_type;
285  int bends, length, segments;
286 
287  bends = 0;
288  length = 0;
289  segments = 0;
290 
291  prevptr = trace_head[inet]; /* Should always be SOURCE. */
292  if (prevptr == NULL) {
293  vpr_printf(TIO_MESSAGE_ERROR, "in get_num_bends_and_length: net #%d has no traceback.\n", inet);
294  exit(1);
295  }
296  inode = prevptr->index;
297  prev_type = rr_node[inode].type;
298 
299  tptr = prevptr->next;
300 
301  while (tptr != NULL) {
302  inode = tptr->index;
303  curr_type = rr_node[inode].type;
304 
305  if (curr_type == SINK) { /* Starting a new segment */
306  tptr = tptr->next; /* Link to existing path - don't add to len. */
307  if (tptr == NULL)
308  break;
309 
310  curr_type = rr_node[tptr->index].type;
311  }
312 
313  else if (curr_type == CHANX || curr_type == CHANY) {
314  segments++;
315  length += 1 + rr_node[inode].xhigh - rr_node[inode].xlow
316  + rr_node[inode].yhigh - rr_node[inode].ylow;
317 
318  if (curr_type != prev_type
319  && (prev_type == CHANX || prev_type == CHANY))
320  bends++;
321  }
322 
323  prev_type = curr_type;
324  tptr = tptr->next;
325  }
326 
327  *bends_ptr = bends;
328  *len_ptr = length;
329  *segments_ptr = segments;
330 }
short xhigh
Definition: vpr_types.h:891
int index
Definition: vpr_types.h:866
t_rr_node * rr_node
Definition: globals.c:70
short ylow
Definition: vpr_types.h:892
struct s_trace * next
Definition: vpr_types.h:870
struct s_trace ** trace_head
Definition: globals.c:64
short yhigh
Definition: vpr_types.h:893
enum e_rr_type t_rr_type
short xlow
Definition: vpr_types.h:890
messagelogger vpr_printf
Definition: util.c:17
t_rr_type type
Definition: vpr_types.h:902

+ Here is the caller graph for this function:

void print_lambda ( void  )

Definition at line 417 of file stats.c.

417  {
418 
419  /* Finds the average number of input pins used per clb. Does not *
420  * count inputs which are hooked to global nets (i.e. the clock *
421  * when it is marked global). */
422 
423  int bnum, ipin;
424  int num_inputs_used = 0;
425  int iclass, inet;
426  float lambda;
427  t_type_ptr type;
428 
429  for (bnum = 0; bnum < num_blocks; bnum++) {
430  type = block[bnum].type;
431  assert(type != NULL);
432  if (type != IO_TYPE) {
433  for (ipin = 0; ipin < type->num_pins; ipin++) {
434  iclass = type->pin_class[ipin];
435  if (type->class_inf[iclass].type == RECEIVER) {
436  inet = block[bnum].nets[ipin];
437  if (inet != OPEN) /* Pin is connected? */
438  if (clb_net[inet].is_global == FALSE) /* Not a global clock */
439  num_inputs_used++;
440  }
441  }
442  }
443  }
444 
445  lambda = (float) num_inputs_used / (float) num_blocks;
446  vpr_printf(TIO_MESSAGE_INFO, "Average lambda (input pins used per clb) is: %g\n", lambda);
447 }
struct s_class * class_inf
t_type_ptr type
Definition: vpr_types.h:561
int num_blocks
Definition: globals.c:30
Definition: util.h:12
boolean * is_global
struct s_block * block
Definition: globals.c:31
struct s_net * clb_net
Definition: globals.c:28
t_type_ptr IO_TYPE
Definition: globals.c:40
Definition: slre.c:50
int * nets
Definition: vpr_types.h:562
enum e_pin_type type
messagelogger vpr_printf
Definition: util.c:17
void print_wirelen_prob_dist ( void  )

Definition at line 332 of file stats.c.

332  {
333 
334  /* Prints out the probability distribution of the wirelength / number *
335  * input pins on a net -- i.e. simulates 2-point net length probability *
336  * distribution. */
337 
338  float *prob_dist;
339  float norm_fac, two_point_length;
340  int inet, bends, length, segments, index;
341  float av_length;
342  int prob_dist_size, i, incr;
343 
344  prob_dist_size = nx + ny + 10;
345  prob_dist = (float *) my_calloc(prob_dist_size, sizeof(float));
346  norm_fac = 0.;
347 
348  for (inet = 0; inet < num_nets; inet++) {
349  if (clb_net[inet].is_global == FALSE && clb_net[inet].num_sinks != 0) {
350  get_num_bends_and_length(inet, &bends, &length, &segments);
351 
352  /* Assign probability to two integer lengths proportionately -- i.e. *
353  * if two_point_length = 1.9, add 0.9 of the pins to prob_dist[2] and *
354  * only 0.1 to prob_dist[1]. */
355 
356  two_point_length = (float) length
357  / (float) (clb_net[inet].num_sinks);
358  index = (int) two_point_length;
359  if (index >= prob_dist_size) {
360 
361  vpr_printf(TIO_MESSAGE_WARNING, "index (%d) to prob_dist exceeds its allocated size (%d).\n",
362  index, prob_dist_size);
363  vpr_printf(TIO_MESSAGE_INFO, "Realloc'ing to increase 2-pin wirelen prob distribution array.\n");
364  incr = index - prob_dist_size + 2;
365  prob_dist_size += incr;
366  prob_dist = (float *)my_realloc(prob_dist,
367  prob_dist_size * sizeof(float));
368  for (i = prob_dist_size - incr; i < prob_dist_size; i++)
369  prob_dist[i] = 0.0;
370  }
371  prob_dist[index] += (clb_net[inet].num_sinks)
372  * (1 - two_point_length + index);
373 
374  index++;
375  if (index >= prob_dist_size) {
376 
377  vpr_printf(TIO_MESSAGE_WARNING, "Warning: index (%d) to prob_dist exceeds its allocated size (%d).\n",
378  index, prob_dist_size);
379  vpr_printf(TIO_MESSAGE_INFO, "Realloc'ing to increase 2-pin wirelen prob distribution array.\n");
380  incr = index - prob_dist_size + 2;
381  prob_dist_size += incr;
382  prob_dist = (float *)my_realloc(prob_dist,
383  prob_dist_size * sizeof(float));
384  for (i = prob_dist_size - incr; i < prob_dist_size; i++)
385  prob_dist[i] = 0.0;
386  }
387  prob_dist[index] += (clb_net[inet].num_sinks)
388  * (1 - index + two_point_length);
389 
390  norm_fac += clb_net[inet].num_sinks;
391  }
392  }
393 
394  /* Normalize so total probability is 1 and print out. */
395 
396  vpr_printf(TIO_MESSAGE_INFO, "\n");
397  vpr_printf(TIO_MESSAGE_INFO, "Probability distribution of 2-pin net lengths:\n");
398  vpr_printf(TIO_MESSAGE_INFO, "\n");
399  vpr_printf(TIO_MESSAGE_INFO, "Length p(Lenth)\n");
400 
401  av_length = 0;
402 
403  for (index = 0; index < prob_dist_size; index++) {
404  prob_dist[index] /= norm_fac;
405  vpr_printf(TIO_MESSAGE_INFO, "%6d %10.6f\n", index, prob_dist[index]);
406  av_length += prob_dist[index] * index;
407  }
408 
409  vpr_printf(TIO_MESSAGE_INFO, "\n");
410  vpr_printf(TIO_MESSAGE_INFO, "Number of 2-pin nets: ;%g;\n", norm_fac);
411  vpr_printf(TIO_MESSAGE_INFO, "Expected value of 2-pin net length (R): ;%g;\n", av_length);
412  vpr_printf(TIO_MESSAGE_INFO, "Total wire length: ;%g;\n", norm_fac * av_length);
413 
414  free(prob_dist);
415 }
int index
Definition: vpr_types.h:866
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
int num_nets
Definition: globals.c:27
Definition: util.h:12
void get_num_bends_and_length(int inet, int *bends_ptr, int *len_ptr, int *segments_ptr)
Definition: stats.c:276
boolean * is_global
struct s_net * clb_net
Definition: globals.c:28
int nx
Definition: globals.c:46
static void * my_realloc(void *memblk, int ibytes)
Definition: graphics.c:512
int ny
Definition: globals.c:47
messagelogger vpr_printf
Definition: util.c:17
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 routing_stats ( boolean  full_stats,
enum e_route_type  route_type,
int  num_switch,
t_segment_inf segment_inf,
int  num_segment,
float  R_minW_nmos,
float  R_minW_pmos,
enum e_directionality  directionality,
boolean  timing_analysis_enabled,
float **  net_delay,
t_slack slacks 
)

Definition at line 27 of file stats.c.

31  {
32 
33  /* Prints out various statistics about the current routing. Both a routing *
34  * and an rr_graph must exist when you call this routine. */
35 
36  float area, used_area;
37  int i, j;
38 
41 
42  vpr_printf(TIO_MESSAGE_INFO, "Logic area (in minimum width transistor areas, excludes I/Os and empty grid tiles)...\n");
43 
44  area = 0;
45  for (i = 1; i <= nx; i++) {
46  for (j = 1; j <= ny; j++) {
47  if (grid[i][j].offset == 0) {
48  if (grid[i][j].type->area == UNDEFINED) {
49  area += grid_logic_tile_area * grid[i][j].type->height;
50  } else {
51  area += grid[i][j].type->area;
52  }
53  }
54  }
55  }
56  /* Todo: need to add pitch of routing to blocks with height > 3 */
57  vpr_printf(TIO_MESSAGE_INFO, "\tTotal logic block area (Warning, need to add pitch of routing to blocks with height > 3): %g\n", area);
58 
59  used_area = 0;
60  for (i = 0; i < num_blocks; i++) {
61  if (block[i].type != IO_TYPE) {
62  if (block[i].type->area == UNDEFINED) {
63  used_area += grid_logic_tile_area * block[i].type->height;
64  } else {
65  used_area += block[i].type->area;
66  }
67  }
68  }
69  vpr_printf(TIO_MESSAGE_INFO, "\tTotal used logic block area: %g\n", used_area);
70 
71  if (route_type == DETAILED) {
72  count_routing_transistors(directionality, num_switch, segment_inf,
73  R_minW_nmos, R_minW_pmos);
74  get_segment_usage_stats(num_segment, segment_inf);
75 
76  if (timing_analysis_enabled) {
78 
80 
81 #ifdef HACK_LUT_PIN_SWAPPING
82  do_timing_analysis(slacks, FALSE, TRUE, TRUE);
83 #else
85 #endif
86  if (getEchoEnabled()) {
93  }
94 
98 
100  }
101  }
102 
103  if (full_stats == TRUE)
105 }
t_type_ptr type
Definition: vpr_types.h:522
void print_timing_stats(void)
Definition: path_delay.c:3081
void load_net_delay_from_routing(float **net_delay, struct s_net *nets, int n_nets)
Definition: net_delay.c:136
static float ** net_delay
void get_segment_usage_stats(int num_segment, t_segment_inf *segment_inf)
Definition: segment_stats.c:13
void print_wirelen_prob_dist(void)
Definition: stats.c:332
int num_nets
Definition: globals.c:27
void print_critical_path(const char *fname)
Definition: path_delay.c:2458
void do_timing_analysis(t_slack *slacks, boolean is_prepacked, boolean do_lut_input_balancing, boolean is_final_analysis)
Definition: path_delay.c:1613
float ** slack
Definition: vpr_types.h:405
t_type_ptr type
Definition: vpr_types.h:561
int num_blocks
Definition: globals.c:30
#define UNDEFINED
Definition: vpr_types.h:103
boolean getEchoEnabled(void)
Definition: ReadOptions.c:67
Definition: util.h:12
void print_lut_remapping(const char *fname)
Definition: path_delay.c:2430
struct s_block * block
Definition: globals.c:31
struct s_net * clb_net
Definition: globals.c:28
int nx
Definition: globals.c:46
boolean isEchoFileEnabled(enum e_echo_files echo_option)
Definition: ReadOptions.c:115
static void get_channel_occupancy_stats(void)
Definition: stats.c:165
struct s_grid_tile ** grid
Definition: globals.c:59
void print_criticality(t_slack *slacks, boolean criticality_is_normalized, const char *fname)
Definition: path_delay.c:559
static void get_length_and_bends_stats(void)
Definition: stats.c:107
char * getOutputFileName(enum e_output_files ename)
Definition: ReadOptions.c:196
t_type_ptr IO_TYPE
Definition: globals.c:40
void print_slack(float **slack, boolean slack_is_normalized, const char *fname)
Definition: path_delay.c:441
void print_timing_graph(const char *fname)
Definition: path_delay.c:1388
float grid_logic_tile_area
Definition: globals.c:13
char * getEchoFileName(enum e_echo_files echo_option)
Definition: ReadOptions.c:122
int ny
Definition: globals.c:47
messagelogger vpr_printf
Definition: util.c:17
void print_net_delay(float **net_delay, const char *fname)
Definition: path_delay.c:670
void load_timing_graph_net_delays(float **net_delay)
Definition: path_delay.c:368
void count_routing_transistors(enum e_directionality directionality, int num_switch, t_segment_inf *segment_inf, float R_minW_nmos, float R_minW_pmos)
Definition: rr_graph_area.c:36
Definition: util.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function: