#include <stdio.h>
#include "defines.h"
Go to the source code of this file.
Functions | |
| void | line_get_stats (func_unit *funit, unsigned int *hit, unsigned int *excluded, unsigned int *total) |
| Calculates line coverage numbers for the specified expression list. | |
| void | line_collect (func_unit *funit, int cov, int **lines, int **excludes, char ***reasons, int *line_cnt, int *line_size) |
| Gathers line numbers from specified functional unit that were not hit during simulation. | |
| void | line_get_funit_summary (func_unit *funit, unsigned int *hit, unsigned int *excluded, unsigned int *total) |
| Returns hit and total information for specified functional unit. | |
| void | line_get_inst_summary (funit_inst *inst, unsigned int *hit, unsigned int *excluded, unsigned int *total) |
| Returns hit and total information for specified functional unit instance. | |
| void | line_report (FILE *ofile, bool verbose) |
| Generates report output for line coverage. | |
|
||||||||||||||||||||||||||||||||
|
Gathers line numbers from specified functional unit that were not hit during simulation. Allocates and populates the lines and exludes array with the line numbers and exclusion values (respectively) that were not hit during simulation.
00130 { PROFILE(LINE_COLLECT);
00131
00132 int i; /* Loop iterator */
00133 int last_line; /* Specifies the last line of the current expression */
00134 statement* stmt; /* Pointer to current statement */
00135 func_iter fi; /* Functional unit iterator */
00136
00137 /* Create an array that will hold the number of uncovered lines */
00138 *line_size = 20;
00139 *line_cnt = 0;
00140 *lines = (int*)malloc_safe( sizeof( int ) * (*line_size) );
00141 *excludes = (int*)malloc_safe( sizeof( int ) * (*line_size) );
00142 *reasons = (char**)malloc_safe( sizeof( char* ) * (*line_size) );
00143
00144 /* Initialize the functional unit iterator */
00145 func_iter_init( &fi, funit, TRUE, FALSE );
00146
00147 stmt = func_iter_get_next_statement( &fi );
00148 while( stmt != NULL ) {
00149
00150 if( (stmt->exp->op != EXP_OP_DELAY) &&
00151 (stmt->exp->op != EXP_OP_CASE) &&
00152 (stmt->exp->op != EXP_OP_CASEX) &&
00153 (stmt->exp->op != EXP_OP_CASEZ) &&
00154 (stmt->exp->op != EXP_OP_DEFAULT) &&
00155 (stmt->exp->op != EXP_OP_NB_CALL) &&
00156 (stmt->exp->op != EXP_OP_FORK) &&
00157 (stmt->exp->op != EXP_OP_JOIN) &&
00158 (stmt->exp->op != EXP_OP_NOOP) &&
00159 (stmt->exp->op != EXP_OP_FOREVER) &&
00160 (stmt->exp->op != EXP_OP_RASSIGN) &&
00161 (stmt->exp->line != 0) ) {
00162
00163 if( ((stmt->exp->exec_num > 0) ? 1 : 0) == cov ) {
00164
00165 last_line = expression_get_last_line_expr( stmt->exp )->line;
00166 for( i=stmt->exp->line; i<=last_line; i++ ) {
00167 exclude_reason* er;
00168 if( *line_cnt == *line_size ) {
00169 *line_size += 20;
00170 *lines = (int*)realloc_safe( *lines, (sizeof( int ) * (*line_size - 20)), (sizeof( int ) * (*line_size)) );
00171 *excludes = (int*)realloc_safe( *excludes, (sizeof( int ) * (*line_size - 20)), (sizeof( int ) * (*line_size)) );
00172 *reasons = (char**)realloc_safe( *reasons, (sizeof( char* ) * (*line_size - 20)), (sizeof( char* ) * (*line_size)) );
00173 }
00174 (*lines)[(*line_cnt)] = i;
00175 (*excludes)[(*line_cnt)] = ESUPPL_EXCLUDED( stmt->exp->suppl );
00176
00177 /* If the toggle is currently excluded, check to see if there's a reason associated with it */
00178 if( (ESUPPL_EXCLUDED( stmt->exp->suppl ) == 1) && ((er = exclude_find_exclude_reason( 'L', stmt->exp->id, funit )) != NULL) ) {
00179 (*reasons)[(*line_cnt)] = strdup_safe( er->reason );
00180 } else {
00181 (*reasons)[(*line_cnt)] = NULL;
00182 }
00183 (*line_cnt)++;
00184 }
00185
00186 }
00187
00188 }
00189
00190 stmt = func_iter_get_next_statement( &fi );
00191
00192 }
00193
00194 func_iter_dealloc( &fi );
00195
00196 PROFILE_END;
00197
00198 }
|
|
||||||||||||||||||||
|
Returns hit and total information for specified functional unit. Looks up summary information for specified functional unit.
00208 { PROFILE(LINE_GET_FUNIT_SUMMARY);
00209
00210 *hit = funit->stat->line_hit;
00211 *excluded = funit->stat->line_excluded;
00212 *total = funit->stat->line_total;
00213
00214 PROFILE_END;
00215
00216 }
|
|
||||||||||||||||||||
|
Returns hit and total information for specified functional unit instance. Looks up summary information for specified functional unit instance.
00226 { PROFILE(LINE_GET_INST_SUMMARY);
00227
00228 *hit = inst->stat->line_hit;
00229 *excluded = inst->stat->line_excluded;
00230 *total = inst->stat->line_total;
00231
00232 PROFILE_END;
00233
00234 }
|
|
||||||||||||||||||||
|
Calculates line coverage numbers for the specified expression list. Iterates through given statement list, gathering information about which lines exist in the list, which lines were hit during simulation and which lines were missed during simulation. This information is used to report summary information about line coverage.
00072 { PROFILE(LINE_GET_STATS);
00073
00074 statement* stmt; /* Pointer to current statement */
00075 func_iter fi; /* Functional unit iterator */
00076
00077 if( !funit_is_unnamed( funit ) ) {
00078
00079 /* Initialize the functional unit iterator */
00080 func_iter_init( &fi, funit, TRUE, FALSE );
00081
00082 stmt = func_iter_get_next_statement( &fi );
00083 while( stmt != NULL ) {
00084
00085 if( (stmt->exp->op != EXP_OP_DELAY) &&
00086 (stmt->exp->op != EXP_OP_CASE) &&
00087 (stmt->exp->op != EXP_OP_CASEX) &&
00088 (stmt->exp->op != EXP_OP_CASEZ) &&
00089 (stmt->exp->op != EXP_OP_DEFAULT) &&
00090 (stmt->exp->op != EXP_OP_NB_CALL) &&
00091 (stmt->exp->op != EXP_OP_FORK) &&
00092 (stmt->exp->op != EXP_OP_JOIN) &&
00093 (stmt->exp->op != EXP_OP_NOOP) &&
00094 (stmt->exp->op != EXP_OP_FOREVER) &&
00095 (stmt->exp->op != EXP_OP_RASSIGN) &&
00096 (stmt->exp->line != 0) ) {
00097 *total = *total + 1;
00098 if( (stmt->exp->exec_num > 0) || (stmt->suppl.part.excluded == 1) ) {
00099 (*hit)++;
00100 if( stmt->suppl.part.excluded == 1 ) {
00101 (*excluded)++;
00102 }
00103 }
00104 }
00105
00106 stmt = func_iter_get_next_statement( &fi );
00107
00108 }
00109
00110 func_iter_dealloc( &fi );
00111
00112 }
00113
00114 PROFILE_END;
00115
00116 }
|
|
||||||||||||
|
Generates report output for line coverage. After the design is read into the functional unit hierarchy, parses the hierarchy by functional unit, reporting the line coverage for each functional unit encountered. The parent functional unit will specify its own line coverage along with a total line coverage including its children.
00625 { PROFILE(LINE_REPORT);
00626
00627 bool missed_found = FALSE; /* If set to TRUE, lines were found to be missed */
00628 inst_link* instl; /* Pointer to current instance link */
00629 int acc_hits = 0; /* Accumulated line hits for entire design */
00630 int acc_total = 0; /* Accumulated line total for entire design */
00631
00632 fprintf( ofile, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
00633 fprintf( ofile, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LINE COVERAGE RESULTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
00634 fprintf( ofile, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
00635
00636 if( report_instance ) {
00637
00638 fprintf( ofile, "Instance Hit/ Miss/Total Percent hit\n" );
00639 fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00640
00641 instl = db_list[curr_db]->inst_head;
00642 while( instl != NULL ) {
00643 missed_found |= line_instance_summary( ofile, instl->inst, (instl->inst->suppl.name_diff ? "<NA>" : "*"), &acc_hits, &acc_total );
00644 instl = instl->next;
00645 }
00646 fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00647 (void)line_display_instance_summary( ofile, "Accumulated", acc_hits, acc_total );
00648
00649 if( verbose && (missed_found || report_covered || report_exclusions) ) {
00650 fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00651 instl = db_list[curr_db]->inst_head;
00652 while( instl != NULL ) {
00653 line_instance_verbose( ofile, instl->inst, (instl->inst->suppl.name_diff ? "<NA>" : "*") );
00654 instl = instl->next;
00655 }
00656 }
00657
00658 } else {
00659
00660 fprintf( ofile, "Module/Task/Function Filename Hit/ Miss/Total Percent hit\n" );
00661 fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00662
00663 missed_found = line_funit_summary( ofile, db_list[curr_db]->funit_head, &acc_hits, &acc_total );
00664 fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00665 (void)line_display_funit_summary( ofile, "Accumulated", "", acc_hits, acc_total );
00666
00667 if( verbose && (missed_found || report_covered || report_exclusions) ) {
00668 fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00669 line_funit_verbose( ofile, db_list[curr_db]->funit_head );
00670 }
00671
00672 }
00673
00674 fprintf( ofile, "\n\n" );
00675
00676 PROFILE_END;
00677
00678 }
|
1.3.4