Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

/Users/trevorw/projects/release/covered-0.7.4/src/line.c File Reference


Detailed Description

Author:
Trevor Williams (phase1geo@gmail.com)
Date:
3/31/2002

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "codegen.h"
#include "db.h"
#include "defines.h"
#include "exclude.h"
#include "expr.h"
#include "func_iter.h"
#include "func_unit.h"
#include "instance.h"
#include "iter.h"
#include "line.h"
#include "link.h"
#include "obfuscate.h"
#include "ovl.h"
#include "report.h"
#include "util.h"

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.

bool line_display_instance_summary (FILE *ofile, const char *name, int hits, int total)
bool line_instance_summary (FILE *ofile, funit_inst *root, char *parent_inst, int *hits, int *total)
bool line_display_funit_summary (FILE *ofile, const char *name, const char *fname, int hits, int total)
bool line_funit_summary (FILE *ofile, funit_link *head, int *hits, int *total)
void line_display_verbose (FILE *ofile, func_unit *funit, rpt_type rtype)
void line_instance_verbose (FILE *ofile, funit_inst *root, char *parent_inst)
void line_funit_verbose (FILE *ofile, funit_link *head)
void line_report (FILE *ofile, bool verbose)
 Generates report output for line coverage.


Variables

db ** db_list
unsigned int curr_db
bool report_covered
unsigned int report_comb_depth
bool report_instance
isuppl info_suppl
bool flag_suppress_empty_funits
bool flag_output_exclusion_ids
bool report_exclusions


Function Documentation

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.

Allocates and populates the lines and exludes array with the line numbers and exclusion values (respectively) that were not hit during simulation.

Parameters:
funit  Pointer to functional unit
cov  If set to 1, gets covered lines, if 0 retrieves uncovered lines; otherwise, gets all lines
lines  Pointer to array of integers that will contain the line numbers
excludes  Pointer to array of integers that will contain the exclude values
reasons  Pointer to array of strings that may contain exclusion reasons
line_cnt  Pointer to size of lines and excludes arrays
line_size  Pointer to the total number of lines/excludes integers allocated

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 }

bool line_display_funit_summary FILE *  ofile,
const char *  name,
const char *  fname,
int  hits,
int  total
[static]
 

Returns:
Returns TRUE if at least one line was found to be missed; otherwise, returns FALSE.
Calculates the percentage and miss information for the given hit and total coverage info and outputs this information in human-readable format to the given output file.
Parameters:
ofile  Pointer to file to output functional unit line summary information to
name  Name of functional unit being displayed
fname  Filename containing function unit being displayed
hits  Number of hits in this functional unit
total  Number of total lines in this functional unit

00340   { PROFILE(LINE_DISPLAY_FUNIT_SUMMARY);
00341 
00342   float percent;  /* Percentage of lines hits */
00343   int   miss;     /* Number of lines missed */
00344 
00345   calc_miss_percent( hits, total, &miss, &percent );
00346 
00347   fprintf( ofile, "  %-20.20s    %-20.20s   %5d/%5d/%5d      %3.0f%%\n", 
00348            name, fname, hits, miss, total, percent );
00349 
00350   PROFILE_END;
00351 
00352   return (miss > 0);
00353 
00354 }

bool line_display_instance_summary FILE *  ofile,
const char *  name,
int  hits,
int  total
[static]
 

Returns:
Returns TRUE if any missed lines were found.
Outputs the instance summary information to the given output file.
Parameters:
ofile  Pointer to output file to display information to
name  Name of instance to display
hits  Number of lines hit in the given instance
total  Total number of lines in the given instance

00246   { PROFILE(LINE_DISPLAY_INSTANCE_SUMMARY);
00247 
00248   float percent;  /* Percentage of lines hits */
00249   int   miss;     /* Number of lines missed */
00250 
00251   calc_miss_percent( hits, total, &miss, &percent );
00252 
00253   fprintf( ofile, "  %-43.43s    %5d/%5d/%5d      %3.0f%%\n",
00254            name, hits, miss, total, percent );
00255 
00256   PROFILE_END;
00257 
00258   return( miss > 0 );
00259 
00260 }

void line_display_verbose FILE *  ofile,
func_unit funit,
rpt_type  rtype
[static]
 

Displays the lines missed during simulation to standard output from the specified expression list.

Parameters:
ofile  Pointer to file to output results to
funit  Pointer to functional unit containing lines to display in verbose format
rtype  Specifies the type of lines to output

00410   { PROFILE(LINE_DISPLAY_VERBOSE);
00411 
00412   statement*   stmt;        /* Pointer to current statement */
00413   expression*  unexec_exp;  /* Pointer to current unexecuted expression */
00414   char**       code;        /* Pointer to code string from code generator */
00415   unsigned int code_depth;  /* Depth of code array */
00416   unsigned int i;           /* Loop iterator */
00417   func_iter    fi;          /* Functional unit iterator */
00418 
00419   switch( rtype ) {
00420     case RPT_TYPE_HIT  :  fprintf( ofile, "    Hit Lines\n\n" );       break;
00421     case RPT_TYPE_MISS :  fprintf( ofile, "    Missed Lines\n\n" );    break;
00422     case RPT_TYPE_EXCL :  fprintf( ofile, "    Excluded Lines\n\n" );  break;
00423   }
00424 
00425   /* Initialize functional unit iterator */
00426   func_iter_init( &fi, funit, TRUE, FALSE );
00427 
00428   /* Display current instance missed lines */
00429   while( (stmt = func_iter_get_next_statement( &fi )) != NULL ) {
00430 
00431     if( (stmt->exp->op != EXP_OP_DELAY)   &&
00432         (stmt->exp->op != EXP_OP_CASE)    &&
00433         (stmt->exp->op != EXP_OP_CASEX)   &&
00434         (stmt->exp->op != EXP_OP_CASEZ)   &&
00435         (stmt->exp->op != EXP_OP_DEFAULT) &&
00436         (stmt->exp->op != EXP_OP_NB_CALL) &&
00437         (stmt->exp->op != EXP_OP_FORK)    &&
00438         (stmt->exp->op != EXP_OP_JOIN)    &&
00439         (stmt->exp->op != EXP_OP_NOOP)    &&
00440         (stmt->exp->op != EXP_OP_FOREVER) &&
00441         (stmt->exp->op != EXP_OP_RASSIGN) &&
00442         (stmt->exp->line != 0) ) {
00443 
00444       if( ((((stmt->exp->exec_num > 0) ? 1 : 0) == report_covered) && (stmt->suppl.part.excluded == 0) && (rtype != RPT_TYPE_EXCL)) ||
00445           ((stmt->suppl.part.excluded == 1) && (rtype == RPT_TYPE_EXCL)) ) {
00446 
00447         unexec_exp = stmt->exp;
00448 
00449         codegen_gen_expr( unexec_exp, unexec_exp->op, &code, &code_depth, funit );
00450         if( flag_output_exclusion_ids && (rtype != RPT_TYPE_HIT) ) {
00451           exclude_reason* er;
00452           fprintf( ofile, "      (%s)  %7d:    %s%s\n",
00453                    db_gen_exclusion_id( 'L', unexec_exp->id ), unexec_exp->line, code[0], ((code_depth == 1) ? "" : "...") );
00454           if( (rtype == RPT_TYPE_EXCL) && ((er = exclude_find_exclude_reason( 'L', unexec_exp->id, funit )) != NULL) ) {
00455             report_output_exclusion_reason( ofile, (22 + (db_get_exclusion_id_size() - 1)), er->reason, TRUE );
00456           }
00457         } else {
00458           exclude_reason* er;
00459           fprintf( ofile, "      %7d:    %s%s\n", unexec_exp->line, code[0], ((code_depth == 1) ? "" : "...") );
00460           if( (rtype == RPT_TYPE_EXCL) && ((er = exclude_find_exclude_reason( 'L', unexec_exp->id, funit )) != NULL) ) {
00461             report_output_exclusion_reason( ofile, 18, er->reason, TRUE );
00462           }
00463         }
00464         for( i=0; i<code_depth; i++ ) {
00465           free_safe( code[i], (strlen( code[i] ) + 1) );
00466         }
00467         free_safe( code, (sizeof( char* ) * code_depth) );
00468 
00469       }
00470 
00471     }
00472 
00473   }
00474 
00475   func_iter_dealloc( &fi );
00476 
00477   fprintf( ofile, "\n" );
00478 
00479   PROFILE_END;
00480 
00481 }

bool line_funit_summary FILE *  ofile,
funit_link head,
int *  hits,
int *  total
[static]
 

Returns:
Returns TRUE if there where lines that were found to be missed; otherwise, returns FALSE.
Iterates through the functional unit list, displaying the line coverage results (summary format) for each functional unit.
Parameters:
ofile  Pointer to file to output results to
head  Pointer to head of functional unit list to explore
hits  Pointer to accumulated hit information
total  Pointer to accumulated total information

00368   { PROFILE(LINE_FUNIT_SUMMARY);
00369 
00370   bool  miss_found = FALSE;  /* Set to TRUE if line was found to be missed */
00371   char* pname;               /* Printable version of functional unit name */
00372 
00373   while( head != NULL ) {
00374 
00375     /* If this is an assertion module, don't output any further */
00376     if( head->funit->stat->show && !funit_is_unnamed( head->funit ) &&
00377         ((info_suppl.part.assert_ovl == 0) || !ovl_is_assertion_module( head->funit )) ) {
00378 
00379       /* Get printable version of functional unit name */
00380       pname = scope_gen_printable( funit_flatten_name( head->funit ) );
00381 
00382       miss_found |= line_display_funit_summary( ofile, pname, get_basename( obf_file( head->funit->filename ) ), head->funit->stat->line_hit, head->funit->stat->line_total );
00383 
00384       /* Update accumulated information */
00385       *hits  += head->funit->stat->line_hit;
00386       *total += head->funit->stat->line_total;
00387 
00388       free_safe( pname, (strlen( pname ) + 1) );
00389 
00390     }
00391 
00392     head = head->next;
00393 
00394   }
00395 
00396   PROFILE_END;
00397 
00398   return( miss_found );
00399 
00400 }

void line_funit_verbose FILE *  ofile,
funit_link head
[static]
 

Displays the verbose line coverage results to the specified output stream on a functional unit basis (combining functional units that are instantiated multiple times). The verbose line coverage includes the line numbers (and associated verilog code) and file/functional unit name of the lines that were not hit during simulation.

Parameters:
ofile  Pointer to file to output results to
head  Pointer to head of functional unit list to search through

00568   { PROFILE(LINE_FUNIT_VERBOSE);
00569 
00570   char* pname;  /* Printable version of functional unit name */
00571 
00572   while( head != NULL ) {
00573 
00574     if( !funit_is_unnamed( head->funit ) &&
00575         (((head->funit->stat->line_hit < head->funit->stat->line_total) && !report_covered) ||
00576          ((head->funit->stat->line_hit > 0) && report_covered) ||
00577          ((head->funit->stat->line_excluded > 0) && report_exclusions)) ) {
00578 
00579       /* Get printable version of functional unit name */
00580       pname = scope_gen_printable( funit_flatten_name( head->funit ) );
00581 
00582       fprintf( ofile, "\n" );
00583       switch( head->funit->type ) {
00584         case FUNIT_MODULE       :  fprintf( ofile, "    Module: " );       break;
00585         case FUNIT_ANAMED_BLOCK :
00586         case FUNIT_NAMED_BLOCK  :  fprintf( ofile, "    Named Block: " );  break;
00587         case FUNIT_AFUNCTION    :
00588         case FUNIT_FUNCTION     :  fprintf( ofile, "    Function: " );     break;
00589         case FUNIT_ATASK        :
00590         case FUNIT_TASK         :  fprintf( ofile, "    Task: " );         break;
00591         default                 :  fprintf( ofile, "    UNKNOWN: " );      break;
00592       }
00593       fprintf( ofile, "%s, File: %s\n", pname, obf_file( head->funit->filename ) );
00594       fprintf( ofile, "    -------------------------------------------------------------------------------------------------------------\n" );
00595 
00596       free_safe( pname, (strlen( pname ) + 1) );
00597 
00598       if( ((head->funit->stat->line_hit < head->funit->stat->line_total) && !report_covered) ||
00599           ((head->funit->stat->line_hit > 0) && report_covered && (!report_exclusions || (head->funit->stat->line_hit > head->funit->stat->line_excluded))) ) {
00600         line_display_verbose( ofile, head->funit, (report_covered ? RPT_TYPE_HIT : RPT_TYPE_MISS) );
00601       }
00602       if( (head->funit->stat->line_excluded > 0) && report_exclusions ) {
00603         line_display_verbose( ofile, head->funit, RPT_TYPE_EXCL );
00604       }
00605   
00606     }
00607 
00608     head = head->next;
00609  
00610   }
00611 
00612   PROFILE_END;
00613 
00614 }

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.

Looks up summary information for specified functional unit.

Parameters:
funit  Pointer to functional unit
hit  Pointer to number of lines hit in this functional unit
excluded  Pointer to number of lines excluded in this functional unit
total  Pointer to total number of lines in this 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 }

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.

Looks up summary information for specified functional unit instance.

Parameters:
inst  Pointer to functional unit instance
hit  Pointer to number of lines hit in this functional unit
excluded  Pointer to number of lines excluded in this functional unit
total  Pointer to total number of lines in this functional unit

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 }

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.

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.

Parameters:
funit  Pointer to current functional unit to explore
hit  Holds total number of lines hit
excluded  Pointer to the number of excluded lines
total  Holds total number of lines parsed

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 }

bool line_instance_summary FILE *  ofile,
funit_inst root,
char *  parent_inst,
int *  hits,
int *  total
[static]
 

Returns:
Returns TRUE if lines were found to be missed; otherwise, returns FALSE.
Recursively iterates through the instance tree gathering the total number of lines parsed vs. the total number of lines executed during the course of simulation. The parent node will display its information before calling its children.
Parameters:
ofile  Pointer to file to output results to
root  Current node in instance tree
parent_inst  Name of parent instance
hits  Pointer to accumulated hit information
total  Pointer to accumulated total information

00276   { PROFILE(LINE_INSTANCE_SUMMARY);
00277 
00278   funit_inst* curr;                /* Pointer to current child functional unit instance of this node */
00279   char        tmpname[4096];       /* Temporary holder of instance name */
00280   char*       pname;               /* Printable version of instance name */
00281   bool        miss_found = FALSE;  /* Set to TRUE if a line was found to be missed */
00282 
00283   assert( root != NULL );
00284   assert( root->stat != NULL );
00285 
00286   /* Get printable version of the instance name */
00287   pname = scope_gen_printable( root->name );
00288   
00289   /* Calculate instance name */
00290   if( db_is_unnamed_scope( pname ) || root->suppl.name_diff ) {
00291     strcpy( tmpname, parent_inst );
00292   } else if( strcmp( parent_inst, "*" ) == 0 ) {
00293     strcpy( tmpname, pname );
00294   } else {
00295     unsigned int rv = snprintf( tmpname, 4096, "%s.%s", parent_inst, pname );
00296     assert( rv < 4096 );
00297   }
00298 
00299   free_safe( pname, (strlen( pname ) + 1) );
00300 
00301   if( (root->funit != NULL) && root->stat->show && !funit_is_unnamed( root->funit ) &&
00302       ((info_suppl.part.assert_ovl == 0) || !ovl_is_assertion_module( root->funit )) ) {
00303 
00304     miss_found = line_display_instance_summary( ofile, tmpname, root->stat->line_hit, root->stat->line_total );
00305 
00306     /* Update accumulated information */
00307     *hits  += root->stat->line_hit;
00308     *total += root->stat->line_total;
00309 
00310   }
00311 
00312   if( (info_suppl.part.assert_ovl == 0) || !ovl_is_assertion_module( root->funit ) ) {
00313 
00314     curr = root->child_head;
00315     while( curr != NULL ) {
00316       miss_found |= line_instance_summary( ofile, curr, tmpname, hits, total );
00317       curr = curr->next;
00318     }
00319 
00320   }
00321 
00322   PROFILE_END;
00323 
00324   return( miss_found );
00325            
00326 }

void line_instance_verbose FILE *  ofile,
funit_inst root,
char *  parent_inst
[static]
 

Displays the verbose line coverage results to the specified output stream on an instance basis. The verbose line coverage includes the line numbers (and associated verilog code) and file/functional unit name of the lines that were not hit during simulation.

Parameters:
ofile  Pointer to file to output results to
root  Pointer to root node of instance tree to search through
parent_inst  Hierarchical path of parent instance

00493   { PROFILE(LINE_INSTANCE_VERBOSE);
00494 
00495   funit_inst* curr_inst;      /* Pointer to current instance being evaluated */
00496   char        tmpname[4096];  /* Temporary name holder for instance */
00497   char*       pname;          /* Printable version of functional unit name */
00498 
00499   assert( root != NULL );
00500 
00501   /* Get printable version of instance name */
00502   pname = scope_gen_printable( root->name );
00503 
00504   if( db_is_unnamed_scope( pname ) || root->suppl.name_diff ) {
00505     strcpy( tmpname, parent_inst );
00506   } else if( strcmp( parent_inst, "*" ) == 0 ) {
00507     strcpy( tmpname, pname );
00508   } else {
00509     unsigned int rv = snprintf( tmpname, 4096, "%s.%s", parent_inst, pname );
00510     assert( rv < 4096 );
00511   }
00512 
00513   free_safe( pname, (strlen( pname ) + 1) );
00514 
00515   if( (root->funit != NULL) && !funit_is_unnamed( root->funit ) &&
00516       (((root->stat->line_hit < root->stat->line_total) && !report_covered) ||
00517        ((root->stat->line_hit > 0) && report_covered) ||
00518        ((root->stat->line_excluded > 0) && report_exclusions)) ) {
00519 
00520     /* Get printable version of functional unit name */
00521     pname = scope_gen_printable( funit_flatten_name( root->funit ) );
00522 
00523     fprintf( ofile, "\n" );
00524     switch( root->funit->type ) {
00525       case FUNIT_MODULE       :  fprintf( ofile, "    Module: " );       break;
00526       case FUNIT_ANAMED_BLOCK :
00527       case FUNIT_NAMED_BLOCK  :  fprintf( ofile, "    Named Block: " );  break;
00528       case FUNIT_AFUNCTION    :
00529       case FUNIT_FUNCTION     :  fprintf( ofile, "    Function: " );     break;
00530       case FUNIT_ATASK        :
00531       case FUNIT_TASK         :  fprintf( ofile, "    Task: " );         break;
00532       default                 :  fprintf( ofile, "    UNKNOWN: " );      break;
00533     }
00534     fprintf( ofile, "%s, File: %s, Instance: %s\n", pname, obf_file( root->funit->filename ), tmpname );
00535     fprintf( ofile, "    -------------------------------------------------------------------------------------------------------------\n" );
00536 
00537     free_safe( pname, (strlen( pname ) + 1) );
00538 
00539     if( ((root->stat->line_hit < root->stat->line_total) && !report_covered) ||
00540         ((root->stat->line_hit > 0) && report_covered && (!report_exclusions || (root->stat->line_hit > root->stat->line_excluded))) ) {
00541       line_display_verbose( ofile, root->funit, (report_covered ? RPT_TYPE_HIT : RPT_TYPE_MISS) );
00542     }
00543     if( (root->stat->line_excluded > 0) && report_exclusions ) {
00544       line_display_verbose( ofile, root->funit, RPT_TYPE_EXCL );
00545     }
00546 
00547   }
00548 
00549   curr_inst = root->child_head;
00550   while( curr_inst != NULL ) {
00551     line_instance_verbose( ofile, curr_inst, tmpname );
00552     curr_inst = curr_inst->next;
00553   }
00554 
00555   PROFILE_END;
00556  
00557 }

void line_report FILE *  ofile,
bool  verbose
 

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.

Parameters:
ofile  Pointer to file to output results to
verbose  Specifies whether to generate summary or verbose output

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 }


Variable Documentation

unsigned int curr_db
 

Index of current database in db_list array that is being handled.

db** db_list
 

Array of database pointers storing all currently loaded databases.

bool flag_output_exclusion_ids
 

Outputs the exclusion ID for an output coverage point. The exclusion ID can be used by the exclude command for excluding/including coverage points.

bool flag_suppress_empty_funits
 

Suppresses functional units that do not contain any coverage information from being output to the report file.

isuppl info_suppl
 

Informational line for the CDD file.

unsigned int report_comb_depth
 

If set to a non-zero value, causes Covered to only generate combinational logic report information for depths up to the number specified.

bool report_covered
 

If set to a boolean value of TRUE, displays covered logic for a particular CDD file. By default, Covered will display uncovered logic. Must be used in conjunction with the -d v|d (verbose output) option.

bool report_exclusions
 

If set to a boolean value of TRUE, displays excluded coverage points for a particular CDD file. By default, Covered will not display excluded coverage points. This can be useful when used in conjunction with the -x option for including excluded coverage points. Must be used in conjunction with the -d v|d (verbose output) option.

bool report_instance
 

If set to a boolean value of TRUE, provides a coverage information for individual functional unit instances. If set to a value of FALSE, reports coverage information on a functional unit basis, merging results from all instances of same functional unit.


Generated on Wed Jun 17 22:19:22 2009 for Covered by doxygen 1.3.4