#include <stdio.h>
#include <assert.h>
#include "assertion.h"
#include "db.h"
#include "defines.h"
#include "func_unit.h"
#include "link.h"
#include "obfuscate.h"
#include "ovl.h"
#include "profiler.h"
#include "util.h"
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. | |
| bool | assertion_display_instance_summary (FILE *ofile, const char *name, int hits, int total) |
| bool | assertion_instance_summary (FILE *ofile, const funit_inst *root, const char *parent_inst, int *hits, int *total) |
| bool | assertion_display_funit_summary (FILE *ofile, const char *name, const char *fname, int hits, int total) |
| bool | assertion_funit_summary (FILE *ofile, const funit_link *head, int *hits, int *total) |
| void | assertion_display_verbose (FILE *ofile, const func_unit *funit, rpt_type rtype) |
| void | assertion_instance_verbose (FILE *ofile, funit_inst *root, char *parent_inst) |
| void | assertion_funit_verbose (FILE *ofile, const funit_link *head) |
| 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. | |
Variables | |
| db ** | db_list |
| unsigned int | curr_db |
| bool | report_covered |
| bool | report_instance |
| isuppl | info_suppl |
| bool | report_exclusions |
|
||||||||||||||||||||||||
|
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.
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 }
|
|
||||||||||||||||||||||||
|
00196 { PROFILE(ASSERTION_DISPLAY_FUNIT_SUMMARY);
00197
00198 float percent; /* Percentage of assertions hit */
00199 int miss; /* Number of assertions missed */
00200
00201 calc_miss_percent( hits, total, &miss, &percent );
00202
00203 fprintf( ofile, " %-20.20s %-20.20s %5d/%5d/%5d %3.0f%%\n",
00204 name, fname, hits, miss, total, percent );
00205
00206 PROFILE_END;
00207
00208 return( miss > 0 );
00209
00210 }
|
|
||||||||||||||||||||
|
00104 { PROFILE(ASSERTION_DISPLAY_INSTANCE_SUMMARY);
00105
00106 float percent; /* Percentage of assertions hit */
00107 int miss; /* Number of assertions missed */
00108
00109 calc_miss_percent( hits, total, &miss, &percent );
00110
00111 fprintf( ofile, " %-43.43s %5d/%5d/%5d %3.0f%%\n",
00112 name, hits, miss, total, percent );
00113
00114 PROFILE_END;
00115
00116 return( miss > 0 );
00117
00118 }
|
|
||||||||||||||||
|
Displays the verbose hit/miss assertion information for the given functional unit.
00265 { PROFILE(ASSERTION_DISPLAY_VERBOSE);
00266
00267 switch( rtype ) {
00268 case RPT_TYPE_HIT : fprintf( ofile, " Hit Assertions\n\n" ); break;
00269 case RPT_TYPE_MISS : fprintf( ofile, " Missed Assertions\n\n" ); break;
00270 case RPT_TYPE_EXCL : fprintf( ofile, " Excluded Assertions\n\n" ); break;
00271 }
00272
00273 /* If OVL assertion coverage is needed, output it in the OVL style */
00274 if( info_suppl.part.assert_ovl == 1 ) {
00275 ovl_display_verbose( ofile, funit, rtype );
00276 }
00277
00278 fprintf( ofile, "\n" );
00279
00280 PROFILE_END;
00281
00282 }
|
|
||||||||||||||||||||
|
00224 { PROFILE(ASSERTION_FUNIT_SUMMARY);
00225
00226 bool miss_found = FALSE; /* Set to TRUE if assertion was found to be missed */
00227
00228 while( head != NULL ) {
00229
00230 /* If this is an assertion module, don't output any further */
00231 if( head->funit->stat->show && !funit_is_unnamed( head->funit ) &&
00232 ((info_suppl.part.assert_ovl == 0) || !ovl_is_assertion_module( head->funit )) ) {
00233
00234 /* Get printable version of functional unit name */
00235 /*@only@*/ char* pname = scope_gen_printable( funit_flatten_name( head->funit ) );
00236
00237 miss_found |= assertion_display_funit_summary( ofile, pname, get_basename( obf_file( head->funit->filename ) ),
00238 head->funit->stat->assert_hit, head->funit->stat->assert_total );
00239
00240 /* Update accumulated information */
00241 *hits += head->funit->stat->assert_hit;
00242 *total += head->funit->stat->assert_total;
00243
00244 free_safe( pname, (strlen( pname ) + 1) );
00245
00246 }
00247
00248 head = head->next;
00249
00250 }
00251
00252 PROFILE_END;
00253
00254 return( miss_found );
00255
00256 }
|
|
||||||||||||
|
Outputs the functional unit verbose assertion coverage information for the given functional unit to the given output file.
00364 { PROFILE(ASSERTION_FUNIT_VERBOSE);
00365
00366 char* pname; /* Printable version of functional unit name */
00367
00368 while( head != NULL ) {
00369
00370 if( !funit_is_unnamed( head->funit ) &&
00371 (((head->funit->stat->assert_hit < head->funit->stat->assert_total) && !report_covered) ||
00372 ((head->funit->stat->assert_hit > 0) && report_covered) ||
00373 ((head->funit->stat->assert_excluded > 0) && report_exclusions)) ) {
00374
00375 /* Get printable version of functional unit name */
00376 pname = scope_gen_printable( funit_flatten_name( head->funit ) );
00377
00378 fprintf( ofile, "\n" );
00379 switch( head->funit->type ) {
00380 case FUNIT_MODULE : fprintf( ofile, " Module: " ); break;
00381 case FUNIT_ANAMED_BLOCK :
00382 case FUNIT_NAMED_BLOCK : fprintf( ofile, " Named Block: " ); break;
00383 case FUNIT_AFUNCTION :
00384 case FUNIT_FUNCTION : fprintf( ofile, " Function: " ); break;
00385 case FUNIT_ATASK :
00386 case FUNIT_TASK : fprintf( ofile, " Task: " ); break;
00387 default : fprintf( ofile, " UNKNOWN: " ); break;
00388 }
00389 fprintf( ofile, "%s, File: %s\n", pname, obf_file( head->funit->filename ) );
00390 fprintf( ofile, " -------------------------------------------------------------------------------------------------------------\n" );
00391
00392 free_safe( pname, (strlen( pname ) + 1) );
00393
00394 if( ((head->funit->stat->assert_hit < head->funit->stat->assert_total) && !report_covered) ||
00395 ((head->funit->stat->assert_hit > 0) && report_covered && (!report_exclusions || (head->funit->stat->assert_hit > head->funit->stat->assert_excluded))) ) {
00396 assertion_display_verbose( ofile, head->funit, (report_covered ? RPT_TYPE_HIT : RPT_TYPE_MISS) );
00397 }
00398 if( report_exclusions && (head->funit->stat->assert_excluded > 0) ) {
00399 assertion_display_verbose( ofile, head->funit, RPT_TYPE_EXCL );
00400 }
00401
00402 }
00403
00404 head = head->next;
00405
00406 }
00407
00408 PROFILE_END;
00409
00410 }
|
|
||||||||||||||||||||||||
|
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.
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 }
|
|
||||||||||||||||||||
|
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.
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 }
|
|
||||||||||||||||||||
|
Gather statistics for assertion coverage. Gets total and hit assertion coverage statistics for the given 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 }
|
|
||||||||||||||||||||||||
|
00133 { PROFILE(ASSERTION_INSTANCE_SUMMARY);
00134
00135 funit_inst* curr; /* Pointer to current child functional unit instance of this node */
00136 char tmpname[4096]; /* Temporary holder of instance name */
00137 char* pname; /* Printable version of instance name */
00138 bool miss_found = FALSE; /* Set to TRUE if assertion was missed */
00139
00140 assert( root != NULL );
00141 assert( root->stat != NULL );
00142
00143 /* Get printable version of the instance name */
00144 pname = scope_gen_printable( root->name );
00145
00146 /* Calculate instance name */
00147 if( db_is_unnamed_scope( pname ) || root->suppl.name_diff ) {
00148 strcpy( tmpname, parent_inst );
00149 } else if( strcmp( parent_inst, "*" ) == 0 ) {
00150 strcpy( tmpname, pname );
00151 } else {
00152 /*@-retvalint@*/snprintf( tmpname, 4096, "%s.%s", parent_inst, pname );
00153 }
00154
00155 free_safe( pname, (strlen( pname ) + 1) );
00156
00157 if( (root->funit != NULL) && root->stat->show && !funit_is_unnamed( root->funit ) &&
00158 ((info_suppl.part.assert_ovl == 0) || !ovl_is_assertion_module( root->funit )) ) {
00159
00160 miss_found |= assertion_display_instance_summary( ofile, tmpname, root->stat->assert_hit, root->stat->assert_total );
00161
00162 /* Update accumulated information */
00163 *hits += root->stat->assert_hit;
00164 *total += root->stat->assert_total;
00165
00166 }
00167
00168 /* If this is an assertion module, don't output any further */
00169 if( (info_suppl.part.assert_ovl == 0) || !ovl_is_assertion_module( root->funit ) ) {
00170
00171 curr = root->child_head;
00172 while( curr != NULL ) {
00173 miss_found |= assertion_instance_summary( ofile, curr, tmpname, hits, total );
00174 curr = curr->next;
00175 }
00176
00177 }
00178
00179 PROFILE_END;
00180
00181 return( miss_found );
00182
00183 }
|
|
||||||||||||||||
|
Outputs the instance verbose assertion coverage information for the given functional unit instance to the given output file.
00292 { PROFILE(ASSERTION_INSTANCE_VERBOSE);
00293
00294 funit_inst* curr_inst; /* Pointer to current instance being evaluated */
00295 char tmpname[4096]; /* Temporary name holder for instance */
00296 char* pname; /* Printable version of functional unit name */
00297
00298 assert( root != NULL );
00299
00300 /* Get printable version of instance name */
00301 pname = scope_gen_printable( root->name );
00302
00303 if( db_is_unnamed_scope( pname ) || root->suppl.name_diff ) {
00304 strcpy( tmpname, parent_inst );
00305 } else if( strcmp( parent_inst, "*" ) == 0 ) {
00306 strcpy( tmpname, pname );
00307 } else {
00308 snprintf( tmpname, 4096, "%s.%s", parent_inst, pname );
00309 }
00310
00311 free_safe( pname, (strlen( pname ) + 1) );
00312
00313 if( !funit_is_unnamed( root->funit ) &&
00314 (((root->stat->assert_hit < root->stat->assert_total) && !report_covered) ||
00315 ((root->stat->assert_hit > 0) && report_covered) ||
00316 ((root->stat->assert_excluded > 0) && report_exclusions)) ) {
00317
00318 /* Get printable version of functional unit name */
00319 pname = scope_gen_printable( funit_flatten_name( root->funit ) );
00320
00321 fprintf( ofile, "\n" );
00322 switch( root->funit->type ) {
00323 case FUNIT_MODULE : fprintf( ofile, " Module: " ); break;
00324 case FUNIT_ANAMED_BLOCK :
00325 case FUNIT_NAMED_BLOCK : fprintf( ofile, " Named Block: " ); break;
00326 case FUNIT_AFUNCTION :
00327 case FUNIT_FUNCTION : fprintf( ofile, " Function: " ); break;
00328 case FUNIT_ATASK :
00329 case FUNIT_TASK : fprintf( ofile, " Task: " ); break;
00330 default : fprintf( ofile, " UNKNOWN: " ); break;
00331 }
00332 fprintf( ofile, "%s, File: %s, Instance: %s\n", pname, obf_file( root->funit->filename ), tmpname );
00333 fprintf( ofile, " -------------------------------------------------------------------------------------------------------------\n" );
00334
00335 free_safe( pname, (strlen( pname ) + 1) );
00336
00337 if( ((root->stat->assert_hit < root->stat->assert_total) && !report_covered) ||
00338 ((root->stat->assert_hit > 0) && report_covered && (!report_exclusions || (root->stat->assert_hit > root->stat->assert_excluded))) ) {
00339 assertion_display_verbose( ofile, root->funit, (report_covered ? RPT_TYPE_HIT : RPT_TYPE_MISS) );
00340 }
00341 if( report_exclusions && (root->stat->assert_excluded > 0) ) {
00342 assertion_display_verbose( ofile, root->funit, RPT_TYPE_EXCL );
00343 }
00344
00345 }
00346
00347 curr_inst = root->child_head;
00348 while( curr_inst != NULL ) {
00349 assertion_instance_verbose( ofile, curr_inst, tmpname );
00350 curr_inst = curr_inst->next;
00351 }
00352
00353 PROFILE_END;
00354
00355 }
|
|
|
Parses -A command-line option to score command.
00050 { PROFILE(ASSERTION_PARSE);
00051
00052 PROFILE_END;
00053
00054 }
|
|
||||||||||||||||
|
Parses an in-line attribute for assertion coverage information. Parses the specified assertion attribute for assertion coverage details.
00063 { PROFILE(ASSERTION_PARSE_ATTR);
00064
00065 PROFILE_END;
00066 }
|
|
||||||||||||
|
Generates report output for assertion coverage. Outputs assertion coverage report information to the given file handle.
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 }
|
|
|
Index of current database in db_list array that is being handled. |
|
|
Array of database pointers storing all currently loaded databases. |
|
|
Informational line for the CDD file. |
|
|
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. |
|
|
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. |
|
|
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. |
1.3.4