VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
segment_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 get_segment_usage_stats (int num_segment, t_segment_inf *segment_inf)
 

Function Documentation

void get_segment_usage_stats ( int  num_segment,
t_segment_inf segment_inf 
)

Definition at line 13 of file segment_stats.c.

13  {
14 
15  /* Computes statistics on the fractional utilization of segments by type *
16  * (index) and by length. This routine needs a valid rr_graph, and a *
17  * completed routing. Note that segments cut off by the end of the array *
18  * are counted as full-length segments (e.g. length 4 even if the last 2 *
19  * units of wire were chopped off by the chip edge). */
20 
21  int inode, length, seg_type, max_segment_length, cost_index;
22  int *seg_occ_by_length, *seg_cap_by_length; /* [0..max_segment_length] */
23  int *seg_occ_by_type, *seg_cap_by_type; /* [0..num_segment-1] */
24  float utilization;
25 
26  max_segment_length = 0;
27  for (seg_type = 0; seg_type < num_segment; seg_type++) {
28  if (segment_inf[seg_type].longline == FALSE)
29  max_segment_length = std::max(max_segment_length,
30  segment_inf[seg_type].length);
31  }
32 
33  seg_occ_by_length = (int *) my_calloc((max_segment_length + 1),
34  sizeof(int));
35  seg_cap_by_length = (int *) my_calloc((max_segment_length + 1),
36  sizeof(int));
37 
38  seg_occ_by_type = (int *) my_calloc(num_segment, sizeof(int));
39  seg_cap_by_type = (int *) my_calloc(num_segment, sizeof(int));
40 
41  for (inode = 0; inode < num_rr_nodes; inode++) {
42  if (rr_node[inode].type == CHANX || rr_node[inode].type == CHANY) {
43  cost_index = rr_node[inode].cost_index;
44  seg_type = rr_indexed_data[cost_index].seg_index;
45 
46  if (!segment_inf[seg_type].longline)
47  length = segment_inf[seg_type].length;
48  else
49  length = LONGLINE;
50 
51  seg_occ_by_length[length] += rr_node[inode].occ;
52  seg_cap_by_length[length] += rr_node[inode].capacity;
53  seg_occ_by_type[seg_type] += rr_node[inode].occ;
54  seg_cap_by_type[seg_type] += rr_node[inode].capacity;
55 
56  }
57  }
58 
59  vpr_printf(TIO_MESSAGE_INFO, "\n");
60  vpr_printf(TIO_MESSAGE_INFO, "Segment usage by type (index):\n");
61  vpr_printf(TIO_MESSAGE_INFO, "Segment type Fractional utilization\n");
62  vpr_printf(TIO_MESSAGE_INFO, "------------ ----------------------\n");
63 
64  for (seg_type = 0; seg_type < num_segment; seg_type++) {
65  if (seg_cap_by_type[seg_type] != 0) {
66  utilization = (float) seg_occ_by_type[seg_type] / (float) seg_cap_by_type[seg_type];
67  vpr_printf(TIO_MESSAGE_INFO, "%8d %5.3g\n", seg_type, utilization);
68  }
69  }
70 
71  vpr_printf(TIO_MESSAGE_INFO, "\n");
72  vpr_printf(TIO_MESSAGE_INFO, "Segment usage by length:\n");
73  vpr_printf(TIO_MESSAGE_INFO, "Segment length Fractional utilization\n");
74  vpr_printf(TIO_MESSAGE_INFO, "-------------- ----------------------\n");
75 
76  for (length = 1; length <= max_segment_length; length++) {
77  if (seg_cap_by_length[length] != 0) {
78  utilization = (float) seg_occ_by_length[length] / (float) seg_cap_by_length[length];
79  vpr_printf(TIO_MESSAGE_INFO, "%9d %5.3g\n", length, utilization);
80  }
81  }
82  vpr_printf(TIO_MESSAGE_INFO, "\n");
83 
84  if (seg_cap_by_length[LONGLINE] != 0) {
85  utilization = (float) seg_occ_by_length[LONGLINE] / (float) seg_cap_by_length[LONGLINE];
86  vpr_printf(TIO_MESSAGE_INFO, " longline %5.3g\n", utilization);
87  }
88 
89  free(seg_occ_by_length);
90  free(seg_cap_by_length);
91  free(seg_occ_by_type);
92  free(seg_cap_by_type);
93 }
short cost_index
Definition: vpr_types.h:897
t_rr_node * rr_node
Definition: globals.c:70
t_rr_indexed_data * rr_indexed_data
Definition: globals.c:74
#define LONGLINE
Definition: segment_stats.c:9
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
Definition: util.h:12
#define max(a, b)
Definition: graphics.c:171
int num_rr_nodes
Definition: globals.c:69
short capacity
Definition: vpr_types.h:899
messagelogger vpr_printf
Definition: util.c:17
short occ
Definition: vpr_types.h:898

+ Here is the call graph for this function:

+ Here is the caller graph for this function: