#include <stdio.h>
#include "util.h"
#include "vpr_types.h"
#include "globals.h"
#include "segment_stats.h"
Go to the source code of this file.
Defines | |
#define | LONGLINE 0 |
Functions | |
void | get_segment_usage_stats (int num_segment, t_segment_inf *segment_inf) |
#define LONGLINE 0 |
Definition at line 10 of file segment_stats.c.
void get_segment_usage_stats | ( | int | num_segment, | |
t_segment_inf * | segment_inf | |||
) |
Definition at line 18 of file segment_stats.c.
00020 { 00021 00022 /* Computes statistics on the fractional utilization of segments by type * 00023 * (index) and by length. This routine needs a valid rr_graph, and a * 00024 * completed routing. Note that segments cut off by the end of the array * 00025 * are counted as full-length segments (e.g. length 4 even if the last 2 * 00026 * units of wire were chopped off by the chip edge). */ 00027 00028 int inode, length, seg_type, max_segment_length, cost_index; 00029 int *seg_occ_by_length, *seg_cap_by_length; /* [0..max_segment_length] */ 00030 int *seg_occ_by_type, *seg_cap_by_type; /* [0..num_segment-1] */ 00031 float utilization; 00032 00033 00034 max_segment_length = 0; 00035 for(seg_type = 0; seg_type < num_segment; seg_type++) 00036 { 00037 if(segment_inf[seg_type].longline == FALSE) 00038 max_segment_length = max(max_segment_length, 00039 segment_inf[seg_type].length); 00040 } 00041 00042 seg_occ_by_length = (int *)my_calloc((max_segment_length + 1), 00043 sizeof(int)); 00044 seg_cap_by_length = (int *)my_calloc((max_segment_length + 1), 00045 sizeof(int)); 00046 00047 seg_occ_by_type = (int *)my_calloc(num_segment, sizeof(int)); 00048 seg_cap_by_type = (int *)my_calloc(num_segment, sizeof(int)); 00049 00050 00051 for(inode = 0; inode < num_rr_nodes; inode++) 00052 { 00053 if(rr_node[inode].type == CHANX || rr_node[inode].type == CHANY) 00054 { 00055 cost_index = rr_node[inode].cost_index; 00056 seg_type = rr_indexed_data[cost_index].seg_index; 00057 00058 if(!segment_inf[seg_type].longline) 00059 length = segment_inf[seg_type].length; 00060 else 00061 length = LONGLINE; 00062 00063 seg_occ_by_length[length] += rr_node[inode].occ; 00064 seg_cap_by_length[length] += rr_node[inode].capacity; 00065 seg_occ_by_type[seg_type] += rr_node[inode].occ; 00066 seg_cap_by_type[seg_type] += rr_node[inode].capacity; 00067 00068 } 00069 } 00070 00071 printf("\nSegment usage by type (index):\n"); 00072 printf("Segment type Fractional utilization\n"); 00073 printf("------------ ----------------------\n"); 00074 00075 for(seg_type = 0; seg_type < num_segment; seg_type++) 00076 { 00077 if(seg_cap_by_type[seg_type] != 0) 00078 { 00079 utilization = (float)seg_occ_by_type[seg_type] / 00080 (float)seg_cap_by_type[seg_type]; 00081 printf("%8d %5.3g\n", seg_type, 00082 utilization); 00083 } 00084 } 00085 00086 00087 printf("\nSegment usage by length:\n"); 00088 printf("Segment length Fractional utilization\n"); 00089 printf("-------------- ----------------------\n"); 00090 00091 00092 for(length = 1; length <= max_segment_length; length++) 00093 { 00094 if(seg_cap_by_length[length] != 0) 00095 { 00096 utilization = (float)seg_occ_by_length[length] / 00097 (float)seg_cap_by_length[length]; 00098 printf("%9d %5.3g\n", length, 00099 utilization); 00100 } 00101 } 00102 00103 if(seg_cap_by_length[LONGLINE] != 0) 00104 { 00105 utilization = (float)seg_occ_by_length[LONGLINE] / 00106 (float)seg_cap_by_length[LONGLINE]; 00107 printf(" longline %5.3g\n", utilization); 00108 } 00109 00110 00111 free(seg_occ_by_length); 00112 free(seg_cap_by_length); 00113 free(seg_occ_by_type); 00114 free(seg_cap_by_type); 00115 }