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

/Users/trevorw/projects/release/covered-0.7.4/src/assertion.h File Reference


Detailed Description

Contains functions for handling assertion coverage.

Author:
Trevor Williams (phase1geo@gmail.com)
Date:
4/4/2006

#include <stdio.h>
#include "defines.h"

Go to the source code of this file.

Functions

void assertion_parse (const char *arg)
 Parses -A command-line option to score command.

void assertion_parse_attr (attr_param *ap, const func_unit *funit, bool exclude)
 Parses an in-line attribute for assertion coverage information.

void assertion_get_stats (const func_unit *funit, unsigned int *hit, unsigned int *excluded, unsigned int *total)
 Gather statistics for assertion coverage.

void assertion_report (FILE *ofile, bool verbose)
 Generates report output for assertion coverage.

void assertion_get_funit_summary (func_unit *funit, unsigned int *hit, unsigned int *excluded, unsigned int *total)
 Retrieves the total and hit counts of assertions for the specified functional unit.

void assertion_collect (func_unit *funit, int cov, char ***inst_names, int **excludes, unsigned int *inst_size)
 Collects uncovered and covered assertion instance names for the given module.

void assertion_get_coverage (const func_unit *funit, const char *inst_name, char **assert_mod, str_link **cp_head, str_link **cp_tail)
 Gets missed coverage point descriptions for the given assertion module.


Function Documentation

void assertion_collect func_unit funit,
int  cov,
char ***  inst_names,
int **  excludes,
unsigned int *  inst_size
 

Collects uncovered and covered assertion instance names for the given module.

Searches the specified functional unit, collecting all uncovered or covered assertion module instance names.

Parameters:
funit  Pointer to functional unit
cov  Specifies if uncovered (0) or covered (1) assertions should be looked for
inst_names  Pointer to array of uncovered instance names found within the specified functional unit
excludes  Pointer to array of integers that contain the exclude information for the given instance names
inst_size  Number of valid elements in the uncov_inst_names array

00506   { PROFILE(ASSERTION_COLLECT);
00507   
00508   /* Initialize outputs */
00509   *inst_names = NULL;
00510   *excludes   = NULL;
00511   *inst_size  = 0;
00512     
00513   /* If OVL assertion coverage is needed, get this information */
00514   if( info_suppl.part.assert_ovl == 1 ) {
00515     ovl_collect( funit, cov, inst_names, excludes, inst_size );
00516   }
00517     
00518   PROFILE_END;
00519 
00520 }

void assertion_get_coverage const func_unit funit,
const char *  inst_name,
char **  assert_mod,
str_link **  cp_head,
str_link **  cp_tail
 

Gets missed coverage point descriptions for the given assertion module.

Finds all of the coverage points for the given assertion instance and stores their string descriptions and execution counts in the cp list.

Parameters:
funit  Pointer to functional unit
inst_name  Name of assertion module instance to retrieve
assert_mod  Pointer to assertion module name and filename being retrieved
cp_head  Pointer to head of list of strings/integers containing coverage point information
cp_tail  Pointer to tail of list of strings/integers containing coverage point information

00532   { PROFILE(ASSERTION_GET_COVERAGE);
00533 
00534   /* Find functional unit */
00535   *cp_head = *cp_tail = NULL;
00536 
00537   /* If OVL assertion coverage is needed, get this information */
00538   if( info_suppl.part.assert_ovl == 1 ) {
00539     ovl_get_coverage( funit, inst_name, assert_mod, cp_head, cp_tail );
00540   }
00541 
00542   PROFILE_END;
00543  
00544 }

void assertion_get_funit_summary func_unit funit,
unsigned int *  hit,
unsigned int *  excluded,
unsigned int *  total
 

Retrieves the total and hit counts of assertions for the specified functional unit.

Counts the total number and number of hit assertions for the specified functional unit.

Parameters:
funit  Pointer to functional unit
hit  Pointer to the number of hit assertions in the specified functional unit
excluded  Pointer to the number of excluded assertions
total  Pointer to the total number of assertions in the specified functional unit

00482   { PROFILE(ASSERTION_GET_FUNIT_SUMMARY);
00483         
00484   /* Initialize total and hit counts */
00485   *hit      = 0;
00486   *excluded = 0;
00487   *total    = 0;
00488   
00489   if( info_suppl.part.assert_ovl == 1 ) {
00490     ovl_get_funit_stats( funit, hit, excluded, total );
00491   }
00492     
00493   PROFILE_END;
00494   
00495 }

void assertion_get_stats const func_unit funit,
unsigned int *  hit,
unsigned int *  excluded,
unsigned int *  total
 

Gather statistics for assertion coverage.

Gets total and hit assertion coverage statistics for the given functional unit.

Parameters:
funit  Pointer to current functional unit
hit  Pointer to the total number of hit assertions in this functional unit
excluded  Pointer to the number of excluded assertions
total  Pointer to the total number of assertions found in this functional unit

00076   { PROFILE(ASSERTION_GET_STATS);
00077 
00078   assert( funit != NULL );
00079 
00080   /* Initialize total and hit values */
00081   *hit      = 0;
00082   *excluded = 0;
00083   *total    = 0;
00084 
00085   /* If OVL assertion coverage is needed, check this functional unit */
00086   if( info_suppl.part.assert_ovl == 1 ) {
00087     ovl_get_funit_stats( funit, hit, excluded, total );
00088   }
00089 
00090   PROFILE_END;
00091 
00092 }

void assertion_parse const char *  arg  ) 
 

Parses -A command-line option to score command.

Parameters:
arg Command-line argument specified in -A option to score command to parse
Parses the specified command-line argument as an assertion to consider for coverage.

00050                                                     { PROFILE(ASSERTION_PARSE);
00051 
00052   PROFILE_END;
00053 
00054 }

void assertion_parse_attr attr_param ap,
const func_unit funit,
bool  exclude
 

Parses an in-line attribute for assertion coverage information.

Parses the specified assertion attribute for assertion coverage details.

Parameters:
ap  Pointer to attribute to parse
funit  Pointer to current functional unit containing this attribute
exclude  If TRUE, excludes this assertion from coverage consideration

00063   { PROFILE(ASSERTION_PARSE_ATTR);
00064 
00065   PROFILE_END;
00066 }

void assertion_report FILE *  ofile,
bool  verbose
 

Generates report output for assertion coverage.

Outputs assertion coverage report information to the given file handle.

Parameters:
ofile  File to output report contents to
verbose  Specifies if verbose report output needs to be generated

00418   { PROFILE(ASSERTION_REPORT);
00419 
00420   bool       missed_found = FALSE;  /* If set to TRUE, lines were found to be missed */
00421   inst_link* instl;                 /* Pointer to current instance link */
00422   int        acc_hits     = 0;      /* Total number of assertions hit */
00423   int        acc_total    = 0;      /* Total number of assertions in design */
00424 
00425   fprintf( ofile, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
00426   fprintf( ofile, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ASSERTION COVERAGE RESULTS   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
00427   fprintf( ofile, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
00428 
00429   if( report_instance ) {
00430 
00431     fprintf( ofile, "Instance                                           Hit/ Miss/Total    Percent hit\n" );
00432     fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00433 
00434     instl = db_list[curr_db]->inst_head;
00435     while( instl != NULL ) {
00436       missed_found |= assertion_instance_summary( ofile, instl->inst, (instl->inst->suppl.name_diff ? "<NA>" : "*"), &acc_hits, &acc_total );
00437       instl = instl->next;
00438     }
00439     fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00440     (void)assertion_display_instance_summary( ofile, "Accumulated", acc_hits, acc_total );
00441 
00442     if( verbose && (missed_found || report_covered) ) {
00443       fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00444       instl = db_list[curr_db]->inst_head;
00445       while( instl != NULL ) {
00446         assertion_instance_verbose( ofile, instl->inst, (instl->inst->suppl.name_diff ? "<NA>" : "*") );
00447         instl = instl->next;
00448       }
00449 
00450     }
00451 
00452   } else {
00453 
00454     fprintf( ofile, "Module/Task/Function      Filename                 Hit/ Miss/Total    Percent hit\n" );
00455     fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00456 
00457     missed_found = assertion_funit_summary( ofile, db_list[curr_db]->funit_head, &acc_hits, &acc_total );
00458     fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00459     (void)assertion_display_funit_summary( ofile, "Accumulated", "", acc_hits, acc_total );
00460 
00461     if( verbose && (missed_found || report_covered) ) {
00462       fprintf( ofile, "---------------------------------------------------------------------------------------------------------------------\n" );
00463       assertion_funit_verbose( ofile, db_list[curr_db]->funit_head );
00464     }
00465 
00466   }
00467 
00468   fprintf( ofile, "\n\n" );
00469 
00470   PROFILE_END;
00471 
00472 }


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