report.h File Reference

Contains functions for report command. More...

Go to the source code of this file.

Functions

void command_report (int argc, int last_arg, const char **argv)
 Parses command-line for report command and performs report functionality.
void report_gather_instance_stats (funit_inst *root)
 Recursively gathers instance statistics in each instance structure.
void report_print_header (FILE *ofile)
 Prints header of report.
bool report_parse_args (int argc, int last_arg, const char **argv)
 Parses arguments on report command command-line.
void report_read_cdd_and_ready (const char *ifile)
 Reads the CDD and readies the design for reporting.
void report_close_cdd ()
 Closes the currently loaded CDD.
void report_save_cdd (const char *filename)
 Saves the currently loaded CDD as the specified filename.
void report_output_exclusion_reason (FILE *ofile, int leading_spaces, const char *msg, bool header)
 Outputs the given exclusion reason to the given output stream.

Detailed Description

Contains functions for report command.

Author:
Trevor Williams (phase1geo@gmail.com)
Date:
11/29/2001

Function Documentation

void command_report ( int  argc,
int  last_arg,
const char **  argv 
)

Parses command-line for report command and performs report functionality.

Performs report command functionality.

Parameters:
argc Number of arguments in report command-line
last_arg Index of last parsed argument from list
argv Arguments passed to report command to parse

References bind_perform(), Catch_anonymous, COVERED_HEADER, db_close(), db_read(), FALSE, FATAL, free_safe, HEADER, input_db, interp, malloc_safe, output_file, print_output(), PROFILE, PROFILE_END, READ_MODE_REPORT_MOD_MERGE, READ_MODE_REPORT_NO_MERGE, report_generate(), report_gui, report_instance, report_parse_args(), strdup_safe, Throw, TRUE, Try, user_msg, and USER_MSG_LENGTH.

Referenced by main().

01081   { PROFILE(COMMAND_REPORT);
01082 
01083   FILE*        ofile           = NULL;  /* Pointer to output stream */
01084 #ifdef HAVE_TCLTK
01085   char*        covered_home    = NULL;  /* Pathname to Covered's home installation directory */
01086   char*        covered_browser = NULL;  /* Name of browser to use for GUI help pages */
01087   char*        covered_version = NULL;  /* String version of current Covered version */
01088   char*        main_file       = NULL;  /* Name of main TCL file to interpret */ 
01089   char*        user_home;               /* HOME environment variable */
01090 #endif
01091   unsigned int rv;                      /* Return value from snprintf calls */
01092   bool         error           = FALSE;
01093   bool         help_found      = FALSE;
01094 
01095   /* Output header information */
01096   rv = snprintf( user_msg, USER_MSG_LENGTH, COVERED_HEADER );
01097   assert( rv < USER_MSG_LENGTH );
01098   print_output( user_msg, HEADER, __FILE__, __LINE__ );
01099 
01100   Try {
01101 
01102     /* Parse score command-line */
01103     if( !report_parse_args( argc, last_arg, argv ) ) {
01104 
01105       if( !report_gui ) {
01106 
01107         /* Open database file for reading */
01108         if( input_db == NULL ) {
01109 
01110           unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Database file not specified in command line" );
01111           assert( rv < USER_MSG_LENGTH );
01112           print_output( user_msg, FATAL, __FILE__, __LINE__ );
01113           Throw 0;
01114 
01115         } else {
01116 
01117           /* Read in CDD file */
01118           (void)db_read( input_db, (report_instance ? READ_MODE_REPORT_NO_MERGE : READ_MODE_REPORT_MOD_MERGE) );
01119 
01120           /* Perform binding */
01121           bind_perform( TRUE, 0 );
01122 
01123           Try {
01124 
01125             /* Open output stream */
01126             if( output_file != NULL ) {
01127               ofile = fopen( output_file, "w" );
01128               assert( ofile != NULL );  /* We should have already verified that the file is writable */
01129             } else {
01130               ofile = stdout;
01131             }
01132 
01133             /* Generate report */
01134             report_generate( ofile );
01135 
01136           } Catch_anonymous {
01137             if( ofile != stdout ) {
01138               rv = fclose( ofile );
01139               assert( rv == 0 );
01140             }
01141             Throw 0;
01142           }
01143 
01144           /* Close output file */
01145           if( ofile != stdout ) {
01146             rv = fclose( ofile );
01147             assert( rv == 0 );
01148           }
01149 
01150         }
01151 
01152 #ifdef HAVE_TCLTK
01153       } else {
01154 
01155         unsigned int slen;
01156 
01157         Try {
01158 
01159           unsigned int rv;
01160 
01161           /* Initialize the Tcl/Tk interpreter */
01162           interp = Tcl_CreateInterp();
01163           assert( interp );
01164 
01165           if( Tcl_Init( interp ) == TCL_ERROR ) {
01166             printf( "ERROR: %s\n", interp->result );
01167             Throw 0;
01168           }
01169 
01170           if( Tk_SafeInit( interp ) == TCL_ERROR ) {
01171             printf( "ERROR: %s\n", interp->result );
01172             Throw 0;
01173           }
01174 
01175           /* Get the COVERED_HOME environment variable */
01176 #ifndef INSTALL_DIR
01177           if( getenv( "COVERED_HOME" ) == NULL ) {
01178             print_output( "COVERED_HOME not initialized.  Exiting...", FATAL, __FILE__, __LINE__ );
01179             Throw 0;
01180           }
01181           covered_home = strdup_safe( getenv( "COVERED_HOME" ) );
01182 #else
01183           covered_home = strdup_safe( INSTALL_DIR );
01184 #endif
01185 
01186           /* Get the COVERED_BROWSER environment variable */
01187 #ifndef COVERED_BROWSER
01188           covered_browser = strdup_safe( getenv( "COVERED_BROWSER" ) );
01189 #else
01190           covered_browser = strdup_safe( COVERED_BROWSER );
01191 #endif
01192 
01193           covered_version = strdup_safe( VERSION );
01194           user_home       = getenv( "HOME" );
01195 
01196           /* Initialize TCL */
01197           tcl_func_initialize( interp, argv[0], user_home, covered_home, covered_version, covered_browser, input_db );
01198 
01199           /* Call the top-level Tcl file */
01200           slen      = strlen( covered_home ) + 30;
01201           main_file = (char*)malloc_safe( slen );
01202           rv        = snprintf( main_file, slen, "%s/scripts/main_view.tcl", covered_home );
01203           assert( rv < slen );
01204           rv = Tcl_EvalFile( interp, main_file );
01205           if( rv != TCL_OK ) {
01206             rv = snprintf( user_msg, USER_MSG_LENGTH, "TCL/TK: %s\n", Tcl_ErrnoMsg( Tcl_GetErrno() ) );
01207             assert( rv < USER_MSG_LENGTH );
01208             print_output( user_msg, FATAL, __FILE__, __LINE__ );
01209             Throw 0;
01210           }
01211 
01212           /* Call the main-loop */
01213           Tk_MainLoop ();
01214 
01215         } Catch_anonymous {
01216           free_safe( covered_home,    (strlen( covered_home ) + 1) );
01217           free_safe( main_file,       slen );
01218           free_safe( covered_browser, (strlen( covered_browser ) + 1) );
01219           free_safe( covered_version, (strlen( covered_version ) + 1) );
01220           Throw 0;
01221         }
01222 
01223         /* Clean Up */
01224         free_safe( covered_home,    (strlen( covered_home ) + 1) );
01225         free_safe( main_file,       slen );
01226         free_safe( covered_browser, (strlen( covered_browser ) + 1) );
01227         free_safe( covered_version, (strlen( covered_version ) + 1) );
01228 #endif
01229 
01230       }
01231 
01232     }
01233 
01234   } Catch_anonymous {
01235     error = TRUE;
01236   }
01237 
01238   free_safe( output_file, (strlen( output_file ) + 1) );
01239   free_safe( input_db, (strlen( input_db ) + 1) );
01240 
01241   /* Close the database */
01242   db_close();
01243 
01244   if( error ) {
01245     Throw 0;
01246   }
01247 
01248   PROFILE_END;
01249 
01250 }

void report_close_cdd (  ) 

Closes the currently loaded CDD.

Returns:
Returns TRUE if CDD file was closed properly; otherwise, returns FALSE.

Closes the currently loaded CDD file.

References db_close(), PROFILE, and PROFILE_END.

00911                         { PROFILE(REPORT_CLOSE_CDD);
00912 
00913   db_close();
00914 
00915   PROFILE_END;
00916 
00917 }

void report_gather_instance_stats ( funit_inst root  ) 

Recursively gathers instance statistics in each instance structure.

Recursively parses instance tree, creating statistic structures for each of the instances in the tree. Calculates summary coverage information for children nodes first and parent nodes after. In this way, the parent nodes will have the accumulated information from themselves and all of their children.

Parameters:
root Pointer to root of instance tree to search

References statistic_s::arc_excluded, statistic_s::arc_hit, statistic_s::arc_total, statistic_s::assert_excluded, statistic_s::assert_hit, isuppl_u::assert_ovl, statistic_s::assert_total, assertion_get_stats(), funit_inst_s::child_head, statistic_s::comb_excluded, statistic_s::comb_hit, statistic_s::comb_total, combination_get_stats(), flag_suppress_empty_funits, fsm_get_stats(), func_unit_s::fsm_head, funit_inst_s::funit, statistic_s::line_excluded, line_get_stats(), statistic_s::line_hit, statistic_s::line_total, statistic_s::mem_ae_total, statistic_s::mem_cov_found, statistic_s::mem_excluded, statistic_s::mem_rd_hit, statistic_s::mem_tog01_hit, statistic_s::mem_tog10_hit, statistic_s::mem_tog_total, statistic_s::mem_wr_hit, memory_get_stats(), funit_inst_s::next, ovl_is_assertion_module(), isuppl_u::part, PROFILE, PROFILE_END, race_get_stats(), func_unit_s::race_head, statistic_s::race_total, report_assertion, report_combination, report_fsm, report_gather_instance_stats(), report_line, report_memory, report_race, report_toggle, statistic_s::rtype_total, statistic_s::show, func_unit_s::stat, funit_inst_s::stat, statistic_s::state_hit, statistic_s::state_total, statistic_create(), statistic_is_empty(), statistic_s::tog01_hit, statistic_s::tog10_hit, statistic_s::tog_cov_found, statistic_s::tog_excluded, statistic_s::tog_total, and toggle_get_stats().

Referenced by rank_read_cdd(), report_gather_instance_stats(), report_generate(), and report_read_cdd_and_ready().

00494   { PROFILE(REPORT_GATHER_INSTANCE_STATS);
00495 
00496   funit_inst* curr;        /* Pointer to current instance being evaluated */
00497 
00498   /* Create and initialize statistic structure */
00499   statistic_create( &(root->stat) );
00500 
00501   /* Get coverage results for all children first */
00502   curr = root->child_head;
00503   while( curr != NULL ) {
00504     report_gather_instance_stats( curr );
00505     curr = curr->next;
00506   }
00507 
00508   /* If this module is an OVL module or it isn't attached to a functional unit, don't get coverage statistics */
00509   if( (root->funit != NULL) && ((info_suppl.part.assert_ovl == 0) || !ovl_is_assertion_module( root->funit )) ) {
00510 
00511     /* Get coverage results for this instance */
00512     if( report_line ) {
00513       line_get_stats( root->funit,
00514                       &(root->stat->line_hit),
00515                       &(root->stat->line_excluded),
00516                       &(root->stat->line_total) );
00517     }
00518 
00519     if( report_toggle ) {
00520       toggle_get_stats( root->funit,
00521                         &(root->stat->tog01_hit), 
00522                         &(root->stat->tog10_hit),
00523                         &(root->stat->tog_excluded),
00524                         &(root->stat->tog_total), 
00525                         &(root->stat->tog_cov_found) );
00526     }
00527 
00528     if( report_combination ) {
00529       combination_get_stats( root->funit,
00530                              &(root->stat->comb_hit),
00531                              &(root->stat->comb_excluded),
00532                              &(root->stat->comb_total) );
00533     }
00534 
00535     if( report_fsm ) {
00536       fsm_get_stats( root->funit->fsm_head,
00537                      &(root->stat->state_hit),
00538                      &(root->stat->state_total),
00539                      &(root->stat->arc_hit),
00540                      &(root->stat->arc_total),
00541                      &(root->stat->arc_excluded) );
00542     }
00543 
00544     if( report_assertion ) {
00545       assertion_get_stats( root->funit,
00546                            &(root->stat->assert_hit),
00547                            &(root->stat->assert_excluded),
00548                            &(root->stat->assert_total) );
00549     }
00550 
00551     if( report_memory ) {
00552       memory_get_stats( root->funit,
00553                         &(root->stat->mem_wr_hit),
00554                         &(root->stat->mem_rd_hit),
00555                         &(root->stat->mem_ae_total),
00556                         &(root->stat->mem_tog01_hit),
00557                         &(root->stat->mem_tog10_hit),
00558                         &(root->stat->mem_tog_total),
00559                         &(root->stat->mem_excluded),
00560                         &(root->stat->mem_cov_found) );
00561     }
00562 
00563     /* Only get race condition statistics for this instance module if the module hasn't been gathered yet */
00564     if( report_race && (root->funit->stat == NULL) ) {
00565       statistic_create( &(root->funit->stat) );
00566       race_get_stats( root->funit->race_head,
00567                       &(root->funit->stat->race_total),
00568                       &(root->funit->stat->rtype_total) );
00569     }
00570 
00571   }
00572 
00573   /* Set show bit */
00574   if( flag_suppress_empty_funits ) {
00575     root->stat->show = !statistic_is_empty( root->stat );
00576   }
00577 
00578   PROFILE_END;
00579 
00580 }

void report_output_exclusion_reason ( FILE *  ofile,
int  leading_spaces,
const char *  msg,
bool  header 
)

Outputs the given exclusion reason to the given output stream.

Outputs the given exclude report message to the specified output stream, handling the appropriate formatting.

Parameters:
ofile Output file stream
leading_spaces Number of leading spaces (for formatting purposes)
msg Message to display (no newlines and only one space between each word)
header If set to TRUE, display a header before outputting; otherwise, avoid the header

References free_safe, gen_char_string(), line_width, malloc_safe, PROFILE, PROFILE_END, and strdup_safe.

Referenced by combination_list_missed(), exclude_print_exclusion(), exclude_resolve_reason(), fsm_display_arc_verbose(), line_display_verbose(), memory_display_verbose(), ovl_display_verbose(), report_print_header(), and toggle_display_verbose().

01017   { PROFILE(REPORT_OUTPUT_EXCLUSION_REASON);
01018 
01019   char* msg_cpy;
01020   char* msg_tcpy;
01021   char* lead_sp;
01022   int   curr_width;
01023   char* word;
01024 
01025   /* Copy the message */
01026   msg_cpy  = strdup_safe( msg );
01027   msg_tcpy = msg_cpy;
01028 
01029   /* Allocate and populate the leading spaces string */
01030   lead_sp = (char*)malloc_safe( leading_spaces + 1 );
01031   gen_char_string( lead_sp, ' ', leading_spaces );
01032 
01033   /* Output message */
01034   if( header ) {
01035     fprintf( ofile, "\n%sReason:  ", lead_sp );
01036   } else {
01037     fprintf( ofile, "\n%s", lead_sp );
01038   }
01039 
01040   curr_width = leading_spaces + 9;
01041   word       = msg_cpy;
01042   while( *msg_cpy != '\0' ) {
01043     /* Get the next token */
01044     while( (*msg_cpy != '\0') && (*msg_cpy != ' ') ) msg_cpy++;
01045     if( *msg_cpy == ' ' ) {
01046       *msg_cpy = '\0';
01047       msg_cpy++;
01048     }
01049     if( (strlen( word ) + curr_width) > line_width ) {
01050       if( header ) {
01051         fprintf( ofile, "\n%s         ", lead_sp );
01052       } else {
01053         fprintf( ofile, "\n%s", lead_sp );
01054       }
01055       curr_width = leading_spaces + 9;
01056     }
01057     fprintf( ofile, "%s ", word );
01058     if( word[strlen(word)-1] == '.' ) {
01059       fprintf( ofile, " " );
01060     }
01061     curr_width += strlen( word ) + 1;
01062     word = msg_cpy;
01063   }
01064   fprintf( ofile, "\n\n" );
01065 
01066   /* Deallocate memory */
01067   free_safe( msg_tcpy, (strlen( msg ) + 1) );
01068   free_safe( lead_sp, (strlen( lead_sp ) + 1) );
01069 
01070   PROFILE_END;
01071 
01072 }

bool report_parse_args ( int  argc,
int  last_arg,
const char **  argv 
)

Parses arguments on report command command-line.

Returns:
Returns TRUE if the help option was parsed.
Exceptions:
anonymous Throw Throw Throw Throw Throw Throw Throw Throw

Parses the argument list for options. If a legal option is found for the report command, the appropriate action is taken for that option. If an option is found that is not allowed, an error message is reported to the user and the program terminates immediately.

Parameters:
argc Number of arguments in argument list argv
last_arg Index of last parsed argument from list
argv Argument list passed to this program

References Catch_anonymous, check_option_value(), DEFAULT_LINE_WIDTH, FALSE, FATAL, file_exists(), flag_output_exclusion_ids, flag_suppress_empty_funits, flag_use_line_width, free_safe, input_db, is_legal_filename(), line_width, output_file, print_output(), PROFILE, PROFILE_END, read_command_file(), report_assertion, report_bitwise, report_comb_depth, report_covered, REPORT_DETAILED, report_exclusions, report_gui, report_instance, report_memory, report_parse_args(), report_parse_metrics(), REPORT_SUMMARY, report_usage(), REPORT_VERBOSE, strdup_safe, Throw, TRUE, Try, user_msg, USER_MSG_LENGTH, and WARNING.

Referenced by command_report(), and report_parse_args().

00302   { PROFILE(REPORT_PARSE_ARGS);
00303 
00304   int  i;  /* Loop iterator */
00305   bool help_found = FALSE;
00306 
00307   i = last_arg + 1;
00308 
00309   while( (i < argc) && !help_found ) {
00310 
00311     if( strncmp( "-h", argv[i], 2 ) == 0 ) {
00312  
00313       report_usage();
00314       help_found = TRUE;
00315 
00316     } else if( strncmp( "-m", argv[i], 2 ) == 0 ) {
00317     
00318       if( check_option_value( argc, argv, i ) ) {
00319         i++;
00320         report_parse_metrics( argv[i] );
00321       } else {
00322         Throw 0;
00323       }
00324 
00325     } else if( strncmp( "-view", argv[i], 5 ) == 0 ) {
00326 
00327 #ifdef HAVE_TCLTK
00328       report_gui        = TRUE;
00329       report_comb_depth = REPORT_VERBOSE;
00330       report_assertion  = TRUE;
00331       report_memory     = TRUE;
00332 #else
00333       print_output( "The -view option is not available with this build", FATAL, __FILE__, __LINE__ );
00334       Throw 0;
00335 #endif
00336 
00337     } else if( strncmp( "-i", argv[i], 2 ) == 0 ) {
00338 
00339       report_instance = TRUE;
00340 
00341     } else if( strncmp( "-c", argv[i], 2 ) == 0 ) {
00342 
00343       report_covered = TRUE;
00344 
00345     } else if( strncmp( "-e", argv[i], 2 ) == 0 ) {
00346 
00347       report_exclusions = TRUE;
00348 
00349     } else if( strncmp( "-d", argv[i], 2 ) == 0 ) {
00350 
00351       if( check_option_value( argc, argv, i ) ) {
00352         i++;
00353         if( argv[i][0] == 's' ) {
00354           report_comb_depth = REPORT_SUMMARY;
00355         } else if( argv[i][0] == 'd' ) {
00356           report_comb_depth = REPORT_DETAILED;
00357         } else if( argv[i][0] == 'v' ) {
00358           report_comb_depth = REPORT_VERBOSE;
00359         } else {
00360           unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Unrecognized detail type: -d %s", argv[i] );
00361           assert( rv < USER_MSG_LENGTH );
00362           print_output( user_msg, FATAL, __FILE__, __LINE__ );
00363           Throw 0;
00364         }
00365       } else {
00366         Throw 0;
00367       }
00368 
00369     } else if( strncmp( "-o", argv[i], 2 ) == 0 ) {
00370 
00371       if( check_option_value( argc, argv, i ) ) {
00372         i++;
00373         if( output_file != NULL ) {
00374           print_output( "Only one -o option is allowed on the report command-line.  Using first value...", WARNING, __FILE__, __LINE__ );
00375         } else {
00376           if( is_legal_filename( argv[i] ) ) {
00377             output_file = strdup_safe( argv[i] );
00378           } else {
00379             unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Output file \"%s\" is unwritable", argv[i] );
00380             assert( rv < USER_MSG_LENGTH );
00381             print_output( user_msg, FATAL, __FILE__, __LINE__ );
00382             Throw 0;
00383           }
00384         }
00385       } else {
00386         Throw 0;
00387       }
00388 
00389     } else if( strncmp( "-w", argv[i], 2 ) == 0 ) {
00390 
00391       flag_use_line_width = TRUE;
00392 
00393       /* Check to see if user specified a line width value */
00394       if( ((i+1) < argc) && (sscanf( argv[i+1], "%d", &line_width ) == 1) ) {
00395         i++;
00396       } else {
00397         line_width = DEFAULT_LINE_WIDTH;
00398       }
00399 
00400     } else if( strncmp( "-s", argv[i], 2 ) == 0 ) {
00401 
00402       flag_suppress_empty_funits = TRUE;
00403 
00404     } else if( strncmp( "-b", argv[i], 2 ) == 0 ) {
00405 
00406       report_bitwise = TRUE;
00407 
00408     } else if( strncmp( "-f", argv[i], 2 ) == 0 ) {
00409 
00410       if( check_option_value( argc, argv, i ) ) {
00411         char**       arg_list = NULL;
00412         int          arg_num  = 0;
00413         unsigned int j;
00414         i++;
00415         Try {
00416           read_command_file( argv[i], &arg_list, &arg_num );
00417           help_found = report_parse_args( arg_num, -1, (const char**)arg_list );
00418         } Catch_anonymous {
00419           for( j=0; j<arg_num; j++ ) {
00420             free_safe( arg_list[j], (strlen( arg_list[j] ) + 1) );
00421           }
00422           free_safe( arg_list, (sizeof( char* ) * arg_num) );
00423           Throw 0;
00424         }
00425         for( j=0; j<arg_num; j++ ) {
00426           free_safe( arg_list[j], (strlen( arg_list[j] ) + 1) );
00427         }
00428         free_safe( arg_list, (sizeof( char* ) * arg_num) );
00429       } else {
00430         Throw 0;
00431       }
00432 
00433     } else if( strncmp( "-x", argv[i], 2 ) == 0 ) {
00434 
00435       flag_output_exclusion_ids = TRUE;
00436  
00437     } else if( (i + 1) == argc ) {
00438 
00439       if( file_exists( argv[i] ) ) {
00440      
00441         input_db = strdup_safe( argv[i] );
00442  
00443       } else {
00444 
00445         unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Cannot find %s database file for opening", argv[i] );
00446         assert( rv < USER_MSG_LENGTH );
00447         print_output( user_msg, FATAL, __FILE__, __LINE__ );
00448         Throw 0;
00449 
00450       }
00451 
00452     } else {
00453 
00454       unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Unknown report command option \"%s\".  See \"covered -h\" for more information.", argv[i] );
00455       assert( rv < USER_MSG_LENGTH );
00456       print_output( user_msg, FATAL, __FILE__, __LINE__ );
00457       Throw 0;
00458 
00459     }
00460 
00461     i++;
00462 
00463   }
00464 
00465   if( !help_found ) {
00466 
00467     /*
00468      If the user has specified the -x and -c (but not -e), we are not going to be outputting exclusion IDs
00469      because covered items cannot be excluded.  So... we will set flag_output_exclusion_ids to false and
00470      output a warning message.
00471     */
00472     if( flag_output_exclusion_ids && report_covered && !report_exclusions ) {
00473       flag_output_exclusion_ids = FALSE;
00474       print_output( "The -x and -c options were specified.  Covered items cannot be excluded so no exclusion IDs will be output.", WARNING, __FILE__, __LINE__ );
00475     }
00476 
00477   }
00478 
00479   PROFILE_END;
00480 
00481   return( help_found );
00482 
00483 }

void report_print_header ( FILE *  ofile  ) 

Prints header of report.

Generates generic report header for all reports.

Parameters:
ofile Pointer to output stream to display report information to

References cdd_message, curr_db, isuppl_u::excl_always, isuppl_u::excl_assign, isuppl_u::excl_final, isuppl_u::excl_init, isuppl_u::excl_pragma, FALSE, flag_output_exclusion_ids, free_safe, get_relative_path(), input_db, str_link_s::next, isuppl_u::part, PROFILE, PROFILE_END, report_comb_depth, REPORT_DETAILED, report_instance, report_output_exclusion_reason(), REPORT_SUMMARY, REPORT_VERBOSE, and str_link_s::str.

Referenced by report_generate().

00675   { PROFILE(REPORT_PRINT_HEADER);
00676 
00677   int i;  /* Loop iterator */
00678 
00679   switch( report_comb_depth ) {
00680     case REPORT_SUMMARY  :
00681       fprintf( ofile, "                            :::::::::::::::::::::::::::::::::::::::::::::::::::::\n" );
00682       fprintf( ofile, "                            ::                                                 ::\n" );
00683       fprintf( ofile, "                            ::  Covered -- Verilog Coverage Summarized Report  ::\n" );
00684       fprintf( ofile, "                            ::                                                 ::\n" );
00685       fprintf( ofile, "                            :::::::::::::::::::::::::::::::::::::::::::::::::::::\n\n\n" );
00686       break;
00687     case REPORT_DETAILED :
00688       fprintf( ofile, "                             :::::::::::::::::::::::::::::::::::::::::::::::::::\n" );
00689       fprintf( ofile, "                             ::                                               ::\n" );
00690       fprintf( ofile, "                             ::  Covered -- Verilog Coverage Detailed Report  ::\n" );
00691       fprintf( ofile, "                             ::                                               ::\n" );
00692       fprintf( ofile, "                             :::::::::::::::::::::::::::::::::::::::::::::::::::\n\n\n" );
00693       break;
00694     case REPORT_VERBOSE  :
00695       fprintf( ofile, "                             ::::::::::::::::::::::::::::::::::::::::::::::::::\n" );
00696       fprintf( ofile, "                             ::                                              ::\n" );
00697       fprintf( ofile, "                             ::  Covered -- Verilog Coverage Verbose Report  ::\n" );
00698       fprintf( ofile, "                             ::                                              ::\n" );
00699       fprintf( ofile, "                             ::::::::::::::::::::::::::::::::::::::::::::::::::\n\n\n" );
00700       break;
00701     default              :  break;
00702   }
00703 
00704   fprintf( ofile, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
00705   fprintf( ofile, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   GENERAL INFORMATION   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
00706   fprintf( ofile, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
00707 
00708   fprintf( ofile, "* Report generated from CDD file : %s\n\n", input_db );
00709 
00710   /* If the CDD contains a user-supplied message output it here, formatting it as needed. */
00711   if( cdd_message != NULL ) {
00712     fprintf( ofile, "* User-supplied CDD message      :\n" );
00713     report_output_exclusion_reason( ofile, 4, cdd_message, FALSE );
00714   }
00715 
00716   if( report_instance ) {
00717     fprintf( ofile, "* Reported by                    : Instance\n\n" );
00718   } else {
00719     fprintf( ofile, "* Reported by                    : Module\n\n" );
00720   }
00721 
00722   if( flag_output_exclusion_ids ) {
00723     fprintf( ofile, "* Report contains exclusion IDs (value within parenthesis preceding verbose output)\n\n" );
00724   }
00725 
00726   if( (info_suppl.part.excl_assign == 1) ||
00727       (info_suppl.part.excl_always == 1) ||
00728       (info_suppl.part.excl_init   == 1) ||
00729       (info_suppl.part.excl_final  == 1) ||
00730       (info_suppl.part.excl_pragma == 1) ) {
00731     fprintf( ofile, "* CDD file excludes the following block types:\n" );
00732     if( info_suppl.part.excl_assign == 1 ) {
00733       fprintf( ofile, "    assign - Continuous Assignments\n" );
00734     }
00735     if( info_suppl.part.excl_always == 1 ) {
00736       fprintf( ofile, "    always - Always Statements\n" );
00737     }
00738     if( info_suppl.part.excl_init == 1 ) {
00739       fprintf( ofile, "    initial - Initial Statements\n" );
00740     }
00741     if( info_suppl.part.excl_final == 1 ) {
00742       fprintf( ofile, "    final - Final Statements\n" );
00743     }
00744     if( info_suppl.part.excl_pragma == 1 ) {
00745       fprintf( ofile, "    pragma - Code surrounded by coverage off/on pragmas\n" );
00746     }
00747     fprintf( ofile, "\n" );
00748   }
00749 
00750   if( merge_in_head != NULL ) {
00751 
00752     if( merge_in_head == merge_in_tail ) {
00753 
00754       char* file;
00755 
00756       fprintf( ofile, "* Report generated from CDD file that was merged from the following files with the following leading hierarchies:\n" );
00757       fprintf( ofile, "    Filename                                           Leading Hierarchy\n" );
00758       fprintf( ofile, "    -----------------------------------------------------------------------------------------------------------------\n" );
00759       fprintf( ofile, "    %-49.49s  %-62.62s\n", input_db,           db_list[curr_db]->leading_hierarchies[0] );
00760       file = get_relative_path( merge_in_head->str );
00761       fprintf( ofile, "    %-49.49s  %-62.62s\n", file, db_list[curr_db]->leading_hierarchies[1] ); 
00762       free_safe( file, (strlen( file ) + 1) );
00763 
00764       if( report_instance && db_list[curr_db]->leading_hiers_differ ) {
00765         fprintf( ofile, "\n* Merged CDD files contain different leading hierarchies, will use value \"<NA>\" to represent leading hierarchy.\n\n" );
00766       }
00767 
00768     } else {
00769 
00770       str_link* strl = merge_in_head;
00771 
00772       fprintf( ofile, "* Report generated from CDD file that was merged from the following files:\n" );
00773       fprintf( ofile, "    Filename                                           Leading Hierarchy\n" );
00774       fprintf( ofile, "    -----------------------------------------------------------------------------------------------------------------\n" );
00775 
00776       i = 1;
00777       while( strl != NULL ) {
00778         char* file = get_relative_path( strl->str );
00779         fprintf( ofile, "    %-49.49s  %-62.62s\n", file, db_list[curr_db]->leading_hierarchies[i++] );
00780         free_safe( file, (strlen( file ) + 1) );
00781         strl = strl->next;
00782       }
00783 
00784       if( report_instance && db_list[curr_db]->leading_hiers_differ ) {
00785         fprintf( ofile, "\n* Merged CDD files contain different leading hierarchies, will use value \"<NA>\" to represent leading hierarchy.\n\n" );
00786       }
00787 
00788     }
00789 
00790     fprintf( ofile, "\n" );
00791 
00792   }
00793 
00794   PROFILE_END;
00795 
00796 }

void report_read_cdd_and_ready ( const char *  ifile  ) 

Reads the CDD and readies the design for reporting.

Returns:
Returns TRUE if CDD file was read properly; otherwise, returns FALSE.
Exceptions:
anonymous db_read Throw bind_perform

Reads in specified CDD file and gathers functional unit statistics to get ready for GUI interaction with this CDD file.

Parameters:
ifile Name of CDD file to read from

References bind_perform(), curr_db, db_read(), db_size, FATAL, funit_head, inst_link_s::inst, db_s::inst_head, inst_link_s::next, print_output(), PROFILE, PROFILE_END, READ_MODE_MERGE_INST_MERGE, READ_MODE_REPORT_MOD_MERGE, READ_MODE_REPORT_NO_MERGE, report_gather_funit_stats(), report_gather_instance_stats(), Throw, and TRUE.

00864   { PROFILE(REPORT_READ_CDD_AND_READY);
00865 
00866   /* Open database file for reading */
00867   if( (ifile == NULL) || (ifile[0] == '\0') ) {
00868 
00869     print_output( "CDD file name was not specified for reading", FATAL, __FILE__, __LINE__ );
00870     Throw 0;
00871 
00872   } else {
00873 
00874     inst_link* instl;
00875     bool       first = (db_size == 0);
00876 
00877     /* Read in database, performing instance merging */
00878     curr_db = 0;
00879     (void)db_read( ifile, (first ? READ_MODE_REPORT_NO_MERGE : READ_MODE_MERGE_INST_MERGE) );
00880     bind_perform( TRUE, 0 );
00881 
00882     /* Gather instance statistics */
00883     instl = db_list[0]->inst_head;
00884     while( instl != NULL ) {
00885       report_gather_instance_stats( instl->inst );
00886       instl = instl->next;
00887     }
00888 
00889     /* Read in database again, performing module merging */
00890     curr_db = 1;
00891     (void)db_read( ifile, READ_MODE_REPORT_MOD_MERGE );
00892     bind_perform( TRUE, 0 );
00893 
00894     /* Now merge functional units and gather module statistics */
00895     report_gather_funit_stats( db_list[1]->funit_head );
00896 
00897     /* Set the current database back to 0 */
00898     curr_db = 0;
00899 
00900   }
00901 
00902   PROFILE_END;
00903 
00904 }

void report_save_cdd ( const char *  filename  ) 

Saves the currently loaded CDD as the specified filename.

Exceptions:
anonymous db_write

Saves the currently loaded CDD database to the given filename.

Parameters:
filename Name to use for saving the currently loaded filename

References curr_db, db_write(), FALSE, PROFILE, and PROFILE_END.

00926   { PROFILE(REPORT_SAVE_CDD);
00927 
00928   /* Write the instance database */
00929   curr_db = 1;
00930 
00931   db_write( filename, FALSE, FALSE );
00932 
00933   /* Restore the database */
00934   curr_db = 0;
00935 
00936   PROFILE_END;
00937 
00938 }

Generated on Sun Nov 21 00:55:40 2010 for Covered by  doxygen 1.6.3