#include "arc.h"
#include "assertion.h"
#include "comb.h"
#include "db.h"
#include "defines.h"
#include "exclude.h"
#include "expr.h"
#include "fsm.h"
#include "func_iter.h"
#include "func_unit.h"
#include "instance.h"
#include "line.h"
#include "link.h"
#include "memory.h"
#include "ovl.h"
#include "profiler.h"
#include "toggle.h"
#include "vector.h"
Functions | |
| char * | exclude_get_message (const char *eid) |
| bool | exclude_is_parent_excluded (expression *expr) |
| void | exclude_expr_assign_and_recalc (expression *expr, func_unit *funit, bool excluded, bool set_line, statistic *stat) |
| void | exclude_sig_assign_and_recalc (vsignal *sig, bool excluded, statistic *stat) |
| void | exclude_arc_assign_and_recalc (fsm_table *table, int arc_index, bool exclude, statistic *stat) |
| void | exclude_add_exclude_reason (char type, int id, char *reason, func_unit *funit) |
| void | exclude_remove_exclude_reason (char type, int id, func_unit *funit) |
| bool | exclude_is_line_excluded (func_unit *funit, int line) |
| Returns TRUE if the specified line is excluded in the given functional unit. | |
| void | exclude_set_line_exclude (func_unit *funit, int line, int value, char *reason, statistic *stat) |
| Sets the excluded bit for all expressions in the given functional unit with the specified line number and recalculates the summary coverage information. | |
| bool | exclude_is_toggle_excluded (func_unit *funit, char *sig_name) |
| Returns TRUE if the specified signal is excluded in the given functional unit. | |
| void | exclude_set_toggle_exclude (func_unit *funit, const char *sig_name, int value, char type, char *reason, statistic *stat) |
| Sets the excluded bit for the specified signal in the given functional unit and recalculates the summary coverage information. | |
| bool | exclude_is_comb_excluded (func_unit *funit, int expr_id, int uline_id) |
| void | exclude_set_comb_exclude (func_unit *funit, int expr_id, int uline_id, int value, char *reason, statistic *stat) |
| Sets the excluded bit for the specified expression in the given functional unit and recalculates the summary coverage information. | |
| bool | exclude_is_fsm_excluded (func_unit *funit, int expr_id, char *from_state, char *to_state) |
| Returns TRUE if the specified FSM is excluded in the given functional unit. | |
| void | exclude_set_fsm_exclude (func_unit *funit, int expr_id, char *from_state, char *to_state, int value, char *reason, statistic *stat) |
| Sets the excluded bit for the specified state transition in the given functional unit and recalculates the summary coverage information. | |
| bool | exclude_is_assert_excluded (func_unit *funit, char *inst_name, int expr_id) |
| Returns TRUE if given assertion is excluded from coverage. | |
| void | exclude_set_assert_exclude (func_unit *funit, char *inst_name, int expr_id, int value, char *reason, statistic *stat) |
| Sets the excluded bit for the specified expression in the given functional unit and recalculates the summary coverage information. | |
| void | exclude_usage () |
| bool | exclude_parse_args (int argc, int last_arg, const char **argv) |
| exclude_reason * | exclude_find_exclude_reason (char type, int id, func_unit *funit) |
| Returns a pointer to the found exclude reason if one is found for the given type and ID; otherwise, returns NULL. | |
| void | exclude_db_write (exclude_reason *er, FILE *ofile) |
| Outputs the given exclude reason structure to the specified file stream. | |
| void | exclude_db_read (char **line, func_unit *curr_funit) |
| Reads the given exclude reason from the specified line and stores its information in the curr_funit structure. | |
| void | exclude_resolve_reason (exclude_reason *orig_er, func_unit *orig_funit, int resolution, const char *new_reason, long new_timestamp) |
| void | exclude_db_merge (func_unit *base, char **line) |
| Reads the given exclude reason from the specified line and merges its information with the base functional unit. | |
| void | exclude_merge (func_unit *base, exclude_reason *er) |
| Performs exclusion reason merging. | |
| vsignal * | exclude_find_signal (int id, func_unit **found_funit) |
| expression * | exclude_find_expression (int id, func_unit **found_funit) |
| int | exclude_find_fsm_arc (int id, fsm_table **found_fsm, func_unit **found_funit) |
| char * | exclude_format_reason (const char *old_str) |
| Formats the reason string for storage purposes. | |
| void | exclude_handle_exclude_reason (int prev_excluded, const char *id, func_unit *funit) |
| void | exclude_print_exclusion (const char *id, int excluded, func_unit *funit) |
| bool | exclude_line_from_id (const char *id) |
| bool | exclude_toggle_from_id (const char *id) |
| bool | exclude_memory_from_id (const char *id) |
| bool | exclude_expr_from_id (const char *id) |
| bool | exclude_fsm_from_id (const char *id) |
| bool | exclude_assert_from_id (const char *id) |
| bool | exclude_apply_exclusions () |
| void | command_exclude (int argc, int last_arg, const char **argv) |
| Allows the user to exclude coverage points from reporting. | |
Variables | |
| db ** | db_list |
| unsigned int | curr_db |
| isuppl | info_suppl |
| char | user_msg [USER_MSG_LENGTH] |
| int | merge_er_value |
| char * | exclude_cdd = NULL |
| str_link * | excl_ids_head = NULL |
| str_link * | excl_ids_tail = NULL |
| bool | exclude_prompt_for_msgs = FALSE |
| bool | exclude_print = FALSE |
|
||||||||||||||||
|
Allows the user to exclude coverage points from reporting. Performs the exclude command.
01880 { PROFILE(COMMAND_EXCLUDE);
01881
01882 unsigned int rv;
01883 comp_cdd_cov** comp_cdds = NULL;
01884 unsigned int comp_cdd_num = 0;
01885 bool error = FALSE;
01886
01887 /* Output header information */
01888 rv = snprintf( user_msg, USER_MSG_LENGTH, COVERED_HEADER );
01889 assert( rv < USER_MSG_LENGTH );
01890 print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01891
01892 Try {
01893
01894 unsigned int rv;
01895
01896 /* Parse score command-line */
01897 if( !exclude_parse_args( argc, last_arg, argv ) ) {
01898
01899 /* Read in database */
01900 rv = snprintf( user_msg, USER_MSG_LENGTH, "Reading CDD file \"%s\"", exclude_cdd );
01901 assert( rv < USER_MSG_LENGTH );
01902 print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01903
01904 db_read( exclude_cdd, READ_MODE_REPORT_NO_MERGE );
01905 bind_perform( TRUE, 0 );
01906
01907 /* Apply the specified exclusion IDs */
01908 if( exclude_apply_exclusions() ) {
01909 rv = snprintf( user_msg, USER_MSG_LENGTH, "Writing CDD file \"%s\"", exclude_cdd );
01910 assert( rv < USER_MSG_LENGTH );
01911 print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01912 db_write( exclude_cdd, FALSE, FALSE, TRUE );
01913 }
01914
01915 }
01916
01917 } Catch_anonymous {
01918 error = TRUE;
01919 }
01920
01921 /* Close down the database */
01922 db_close();
01923
01924 /* Deallocate other allocated variables */
01925 str_link_delete_list( excl_ids_head );
01926 free_safe( exclude_cdd, (strlen( exclude_cdd ) + 1) );
01927
01928 if( error ) {
01929 Throw 0;
01930 }
01931
01932 PROFILE_END;
01933
01934 }
|
|
||||||||||||||||||||
|
Handle the creation of the exclude reason structure.
00275 { PROFILE(EXCLUDE_ADD_EXCLUDE_REASON);
00276
00277 exclude_reason* er;
00278 int rv;
00279 struct timeval tv;
00280
00281 /*
00282 If the coverage point was not previously excluded, allow the user to specify a reason and
00283 store this information in the functional unit.
00284 */
00285 er = (exclude_reason*)malloc_safe( sizeof( exclude_reason ) );
00286 er->type = type;
00287 er->id = id;
00288 er->reason = reason;
00289 er->next = NULL;
00290
00291 /* Add timestamp information */
00292 rv = gettimeofday( &tv, NULL );
00293 assert( rv == 0 );
00294 er->timestamp = tv.tv_sec;
00295
00296 if( funit->er_head == NULL ) {
00297 funit->er_head = funit->er_tail = er;
00298 } else {
00299 funit->er_tail->next = er;
00300 funit->er_tail = er;
00301 }
00302
00303 }
|
|
|
01840 { PROFILE(EXCLUDE_APPLY_EXCLUSIONS);
01841
01842 bool retval = FALSE; /* Return value for this function */
01843 str_link* strl; /* Pointer to current string link */
01844 unsigned int rv;
01845
01846 strl = excl_ids_head;
01847 while( strl != NULL ) {
01848 switch( strl->str[0] ) {
01849 case 'L' : retval |= exclude_line_from_id( strl->str ); break;
01850 case 'T' : retval |= exclude_toggle_from_id( strl->str ); break;
01851 case 'M' : retval |= exclude_memory_from_id( strl->str ); break;
01852 case 'E' : retval |= exclude_expr_from_id( strl->str ); break;
01853 case 'F' : retval |= exclude_fsm_from_id( strl->str ); break;
01854 case 'A' : retval |= exclude_assert_from_id( strl->str ); break;
01855 default :
01856 rv = snprintf( user_msg, USER_MSG_LENGTH, "Illegal exclusion identifier specified (%s)", strl->str );
01857 assert( rv < USER_MSG_LENGTH );
01858 print_output( user_msg, FATAL, __FILE__, __LINE__ );
01859 Throw 0;
01860 /*@-unreachable@*/
01861 break;
01862 /*@=unreachable@*/
01863 }
01864 strl = strl->next;
01865 }
01866
01867 PROFILE_END;
01868
01869 return( retval );
01870
01871 }
|
|
||||||||||||||||||||
|
Sets the specified arc entry's exclude bit to the given value and recalculates all affected coverage information for this instance.
00254 { PROFILE(EXCLUDE_ARC_ASSIGN_AND_RECALC);
00255
00256 /* Set the excluded bit in the specified entry and adjust coverage numbers, if necessary */
00257 table->arcs[arc_index]->suppl.part.excluded = (exclude ? 1 : 0);
00258 if( table->arcs[arc_index]->suppl.part.hit == 0 ) {
00259 stat->arc_hit += exclude ? 1 : -1;
00260 stat->arc_excluded += exclude ? 1 : -1;
00261 }
00262
00263 PROFILE_END;
00264
00265 }
|
|
|
01781 { PROFILE(EXCLUDE_ASSERT_FROM_ID);
01782
01783 expression* exp; /* Pointer to found expression */
01784 func_unit* found_funit; /* Pointer to functional unit containing exp */
01785
01786 if( (exp = exclude_find_expression( atoi( id + 1 ), &found_funit )) != NULL ) {
01787
01788 int prev_excluded;
01789 unsigned int rv;
01790
01791 /* Get the previously excluded value */
01792 prev_excluded = exp->suppl.part.excluded;
01793
01794 /* If the user has specified to print the exclusion, do so */
01795 if( exclude_print ) {
01796
01797 exclude_print_exclusion( id, prev_excluded, found_funit );
01798
01799 /* Otherwise, perform the exclusion */
01800 } else {
01801
01802 /* Output result */
01803 if( prev_excluded == 0 ) {
01804 rv = snprintf( user_msg, USER_MSG_LENGTH, " Excluding %s", id );
01805 } else {
01806 rv = snprintf( user_msg, USER_MSG_LENGTH, " Including %s", id );
01807 }
01808 assert( rv < USER_MSG_LENGTH );
01809 print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01810
01811 /* Set the exclude bits in the expression supplemental field */
01812 exp->suppl.part.excluded = (prev_excluded ^ 1);
01813
01814 /* If we are excluding and the -m option was specified, get an exclusion reason from the user */
01815 if( exclude_prompt_for_msgs || (prev_excluded == 1) ) {
01816 exclude_handle_exclude_reason( prev_excluded, id, found_funit );
01817 }
01818
01819 }
01820
01821 } else {
01822
01823 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Unable to find assertion associated with exclusion ID %s", id );
01824 assert( rv < USER_MSG_LENGTH );
01825 print_output( user_msg, WARNING, __FILE__, __LINE__ );
01826
01827 }
01828
01829 PROFILE_END;
01830
01831 return( (exp != NULL) && !exclude_print );
01832
01833 }
|
|
||||||||||||
|
Reads the given exclude reason from the specified line and merges its information with the base functional unit. Reads the given exclude reason structure information from the line read from the CDD file.
01080 { PROFILE(EXCLUDE_DB_MERGE);
01081
01082 char type; /* Specifies the type of exclusion this structure represents */
01083 int id; /* ID of signal/expression/FSM */
01084 int chars_read; /* Number of characters read from line */
01085 time_t timestamp; /* Reason timestamp */
01086 char* reason; /* Pointer to the exclusion reason from the CDD file */
01087
01088 /*@+longintegral@*/
01089 if( sscanf( *line, " %c %d %ld%n", &type, &id, ×tamp, &chars_read ) == 3 ) {
01090 /*@=longintegral@*/
01091
01092 exclude_reason* er;
01093
01094 *line = *line + chars_read;
01095
01096 /* Get the reason string and remove leading whitespace */
01097 while( (*line)[0] == ' ' ) {
01098 (*line)++;
01099 }
01100 reason = *line;
01101 assert( reason != NULL );
01102 assert( reason[0] != '\0' );
01103
01104 /* If the exclusion reason does not exist in the base CDD, go ahead and add it */
01105 if( (er = exclude_find_exclude_reason( type, id, base )) == NULL ) {
01106
01107 /* Allocate and initialize the exclude reason structure */
01108 er = (exclude_reason*)malloc_safe( sizeof( exclude_reason ) );
01109 er->type = type;
01110 er->id = id;
01111 er->timestamp = timestamp;
01112 er->reason = strdup_safe( reason );
01113 er->next = NULL;
01114
01115 /* Add the given exclude reason to the current functional unit list */
01116 if( base->er_head == NULL ) {
01117 base->er_head = base->er_tail = er;
01118 } else {
01119 base->er_tail->next = er;
01120 base->er_tail = er;
01121 }
01122
01123 /* Otherwise, if the exclusion reason does exist, check for a conflict and handle it */
01124 } else {
01125
01126 /*
01127 If the exclusion reason string does not match the current string, resolve the conflict appropriately
01128 (otherwise, just use the reason in the base functional unit).
01129 */
01130 if( strcmp( er->reason, reason ) != 0 ) {
01131 exclude_resolve_reason( er, base, merge_er_value, reason, timestamp );
01132 }
01133
01134 }
01135
01136 } else {
01137
01138 print_output( "CDD being read is not compatible with this version of Covered", FATAL, __FILE__, __LINE__ );
01139 Throw 0;
01140
01141 }
01142
01143 PROFILE_END;
01144
01145 }
|
|
||||||||||||
|
Reads the given exclude reason from the specified line and stores its information in the curr_funit structure. Reads the given exclude reason structure information from the line read from the CDD file.
00925 { PROFILE(EXCLUDE_DB_READ);
00926
00927 char type; /* Specifies the type of exclusion this structure represents */
00928 int id; /* ID of signal/expression/FSM */
00929 int chars_read; /* Number of characters read from line */
00930 time_t timestamp; /* Reason timestamp */
00931
00932 /*@+longintegral@*/
00933 if( sscanf( *line, " %c %d %ld%n", &type, &id, ×tamp, &chars_read ) == 3 ) {
00934 /*@=longintegral@*/
00935
00936 exclude_reason* er;
00937
00938 *line = *line + chars_read;
00939
00940 /* Allocate and initialize the exclude reason structure */
00941 er = (exclude_reason*)malloc_safe( sizeof( exclude_reason ) );
00942 er->type = type;
00943 er->id = id;
00944 er->reason = NULL;
00945 er->timestamp = timestamp;
00946 er->next = NULL;
00947
00948 /* Remove leading whitespace */
00949 while( (*line)[0] == ' ' ) {
00950 (*line)++;
00951 }
00952 er->reason = strdup_safe( *line );
00953
00954 /* Add the given exclude reason to the current functional unit list */
00955 if( curr_funit->er_head == NULL ) {
00956 curr_funit->er_head = curr_funit->er_tail = er;
00957 } else {
00958 curr_funit->er_tail->next = er;
00959 curr_funit->er_tail = er;
00960 }
00961
00962 } else {
00963
00964 print_output( "CDD being read is not compatible with this version of Covered", FATAL, __FILE__, __LINE__ );
00965 Throw 0;
00966
00967 }
00968
00969 PROFILE_END;
00970
00971 }
|
|
||||||||||||
|
Outputs the given exclude reason structure to the specified file stream. Writes the given exclude reason to the specified output stream.
|
|
||||||||||||||||||||||||
|
Sets the specified expression's exclude bit to the given value and recalculates all affected coverage information for this instance.
00103 { PROFILE(EXCLUDE_EXPR_ASSIGN_AND_RECALC);
00104
00105 unsigned int comb_hit = 0; /* Total number of hit combinations within this tree */
00106 unsigned int comb_excluded = 0; /* Total number of excluded combinations */
00107 unsigned int comb_total = 0; /* Total number of combinational logic coverage points within this tree */
00108 int ulid = 0; /* Temporary value */
00109
00110 /* Now recalculate the coverage information for all metrics if this module is not an OVL module */
00111 if( (info_suppl.part.assert_ovl == 0) || !ovl_is_assertion_module( funit ) ) {
00112
00113 /* If this expression is a root expression, recalculate line coverage */
00114 if( ESUPPL_IS_ROOT( expr->suppl ) == 1 ) {
00115 if( (expr->op != EXP_OP_DELAY) &&
00116 (expr->op != EXP_OP_CASE) &&
00117 (expr->op != EXP_OP_CASEX) &&
00118 (expr->op != EXP_OP_CASEZ) &&
00119 (expr->op != EXP_OP_DEFAULT) &&
00120 (expr->op != EXP_OP_NB_CALL) &&
00121 (expr->op != EXP_OP_FORK) &&
00122 (expr->op != EXP_OP_JOIN) &&
00123 (expr->op != EXP_OP_NOOP) &&
00124 (expr->line != 0) &&
00125 (expr->exec_num == 0) ) {
00126 if( excluded ) {
00127 stat->line_hit++;
00128 stat->line_excluded++;
00129 } else {
00130 stat->line_hit--;
00131 stat->line_excluded--;
00132 }
00133 }
00134 }
00135
00136 /* Always recalculate combinational coverage */
00137 combination_reset_counted_expr_tree( expr );
00138 if( excluded ) {
00139 combination_get_tree_stats( expr, &ulid, 0, exclude_is_parent_excluded( expr ), &comb_hit, &comb_excluded, &comb_total );
00140 stat->comb_hit += (comb_total - comb_hit);
00141 stat->comb_excluded += (comb_total - comb_excluded);
00142 } else {
00143 expr->suppl.part.excluded = 0;
00144 combination_get_tree_stats( expr, &ulid, 0, exclude_is_parent_excluded( expr ), &comb_hit, &comb_excluded, &comb_total );
00145 stat->comb_hit -= (comb_total - comb_hit);
00146 stat->comb_excluded -= (comb_total - comb_excluded);
00147 }
00148
00149 } else {
00150
00151 /* If the expression is a coverage point, recalculate the assertion coverage */
00152 if( ovl_is_assertion_module( funit ) && ovl_is_coverage_point( expr ) ) {
00153 if( expr->exec_num == 0 ) {
00154 if( excluded ) {
00155 stat->assert_hit++;
00156 stat->assert_excluded++;
00157 } else {
00158 stat->assert_hit--;
00159 stat->assert_excluded--;
00160 }
00161 }
00162 }
00163
00164 }
00165
00166 /* Set the exclude bits in the expression supplemental field */
00167 expr->suppl.part.excluded = excluded ? 1 : 0;
00168 if( (ESUPPL_IS_ROOT( expr->suppl ) == 1) && (expr->parent->stmt != NULL) ) {
00169 expr->parent->stmt->suppl.part.excluded = (excluded && set_line) ? 1 : 0;
00170 }
00171
00172 PROFILE_END;
00173
00174 }
|
|
|
01656 { PROFILE(EXCLUDE_EXPR_FROM_ID);
01657
01658 expression* exp; /* Pointer to found expression */
01659 func_unit* found_funit; /* Pointer to functional unit containing exp */
01660
01661 if( (exp = exclude_find_expression( atoi( id + 1 ), &found_funit )) != NULL ) {
01662
01663 int prev_excluded;
01664 unsigned int rv;
01665
01666 /* Get the previously excluded value */
01667 prev_excluded = exp->suppl.part.excluded;
01668
01669 /* If the user has specified to print the exclusion, do so */
01670 if( exclude_print ) {
01671
01672 exclude_print_exclusion( id, prev_excluded, found_funit );
01673
01674 /* Otherwise, perform the exclusion */
01675 } else {
01676
01677 /* Output result */
01678 if( prev_excluded == 0 ) {
01679 rv = snprintf( user_msg, USER_MSG_LENGTH, " Excluding %s", id );
01680 } else {
01681 rv = snprintf( user_msg, USER_MSG_LENGTH, " Including %s", id );
01682 }
01683 assert( rv < USER_MSG_LENGTH );
01684 print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01685
01686 /* Set the exclude bits in the expression supplemental field */
01687 exp->suppl.part.excluded = (prev_excluded ^ 1);
01688
01689 /* If we are excluding and the -m option was specified, get an exclusion reason from the user */
01690 if( exclude_prompt_for_msgs || (prev_excluded == 1) ) {
01691 exclude_handle_exclude_reason( prev_excluded, id, found_funit );
01692 }
01693
01694 }
01695
01696 } else {
01697
01698 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Unable to find expression associated with exclusion ID %s", id );
01699 assert( rv < USER_MSG_LENGTH );
01700 print_output( user_msg, WARNING, __FILE__, __LINE__ );
01701
01702 }
01703
01704 PROFILE_END;
01705
01706 return( (exp != NULL) && !exclude_print );
01707
01708 }
|
|
||||||||||||||||
|
Returns a pointer to the found exclude reason if one is found for the given type and ID; otherwise, returns NULL.
00888 { PROFILE(EXCLUDE_FIND_EXCLUDE_REASON);
00889
00890 exclude_reason* er; /* Pointer to current exclude reason structure */
00891
00892 er = funit->er_head;
00893 while( (er != NULL) && ((er->type != type) || (er->id != id)) ) {
00894 er = er->next;
00895 }
00896
00897 PROFILE_END;
00898
00899 return( er );
00900
00901 }
|
|
||||||||||||
|
01227 { PROFILE(EXCLUDE_FIND_EXPRESSION);
01228
01229 inst_link* instl; /* Pointer to current instance link */
01230 expression* exp; /* Pointer to found expression */
01231
01232 instl = db_list[curr_db]->inst_head;
01233 while( (instl != NULL) && ((exp = instance_find_expression_by_exclusion_id( instl->inst, id, found_funit )) == NULL) ) {
01234 instl = instl->next;
01235 }
01236
01237 if( exp != NULL ) {
01238 *found_funit = funit_get_curr_module( *found_funit );
01239 }
01240
01241 PROFILE_END;
01242
01243 return( exp );
01244
01245 }
|
|
||||||||||||||||
|
01254 { PROFILE(EXCLUDE_FIND_FSM_ARC);
01255
01256 inst_link* instl; /* Pointer to current instance link */
01257 int arc_index;
01258
01259 instl = db_list[curr_db]->inst_head;
01260 while( (instl != NULL) && ((arc_index = instance_find_fsm_arc_index_by_exclusion_id( instl->inst, id, found_fsm, found_funit )) == -1) ) {
01261 instl = instl->next;
01262 }
01263
01264 if( arc_index != -1 ) {
01265 *found_funit = funit_get_curr_module( *found_funit );
01266 }
01267
01268 PROFILE_END;
01269
01270 return( arc_index );
01271
01272 }
|
|
||||||||||||
|
01201 { PROFILE(EXCLUDE_FIND_SIGNAL);
01202
01203 inst_link* instl; /* Pointer to current instance link */
01204 vsignal* sig; /* Pointer to found signal */
01205
01206 instl = db_list[curr_db]->inst_head;
01207 while( (instl != NULL) && ((sig = instance_find_signal_by_exclusion_id( instl->inst, id, found_funit )) == NULL) ) {
01208 instl = instl->next;
01209 }
01210
01211 if( sig != NULL ) {
01212 *found_funit = funit_get_curr_module( *found_funit );
01213 }
01214
01215 PROFILE_END;
01216
01217 return( sig );
01218
01219 }
|
|
|
Formats the reason string for storage purposes.
01279 { PROFILE(EXCLUDE_FORMAT_REASON);
01280
01281 char* msg; /* Pointer to the reformatted message */
01282 unsigned int msg_size; /* Current size of message array */
01283 char c; /* Current character */
01284 bool sp_just_seen = TRUE; /* Set to TRUE if a space character was just seen */
01285 char str[100]; /* Temporary string */
01286 unsigned int i; /* Loop iterator */
01287 unsigned int index = 0; /* Index into str array to store next character */
01288
01289 msg = strdup_safe( "" );
01290 msg_size = 1;
01291 str[0] = '\0';
01292
01293 if( old_str != NULL ) {
01294
01295 for( i=0; i<strlen( old_str ); i++ ) {
01296
01297 c = old_str[i];
01298
01299 /* Convert any formatting characters to spaces */
01300 c = ((c == '\n') || (c == '\t') || (c == '\r')) ? ' ' : c;
01301
01302 /* If the user has specified multiple formatting characters together, ignore all but the first. */
01303 if( (c != ' ') || !sp_just_seen ) {
01304 sp_just_seen = (c == ' ') ? TRUE : FALSE;
01305 str[(index % 99) + 0] = c;
01306 str[(index % 99) + 1] = '\0';
01307 if( ((index + 1) % 99) == 0 ) {
01308 msg = (char*)realloc_safe( msg, msg_size, (msg_size + strlen( str )) );
01309 msg_size += strlen( str );
01310 strcat( msg, str );
01311 str[0] = '\0';
01312 }
01313 index++;
01314 }
01315
01316 }
01317
01318 }
01319
01320 /* Take what's left in the str array and put it into the msg array */
01321 if( strlen( str ) > 0 ) {
01322 msg = (char*)realloc_safe( msg, msg_size, (msg_size + strlen( str )) );
01323 strcat( msg, str );
01324 msg[strlen(msg)] = '\0';
01325 }
01326
01327 PROFILE_END;
01328
01329 return( msg );
01330
01331 }
|
|
|
01718 { PROFILE(EXCLUDE_FSM_FROM_ID);
01719
01720 int arc_index; /* Index of found state transition in arcs array */
01721 fsm_table* found_fsm; /* Pointer to found FSM structure */
01722 func_unit* found_funit; /* Pointer to functional unit containing arc */
01723
01724 if( (arc_index = exclude_find_fsm_arc( atoi( id + 1 ), &found_fsm, &found_funit )) != -1 ) {
01725
01726 int prev_excluded;
01727 unsigned int rv;
01728
01729 /* Get the previously excluded value */
01730 prev_excluded = found_fsm->arcs[arc_index]->suppl.part.excluded;
01731
01732 /* If the user has specified to print the exclusion, do so */
01733 if( exclude_print ) {
01734
01735 exclude_print_exclusion( id, prev_excluded, found_funit );
01736
01737 /* Otherwise, perform the exclusion */
01738 } else {
01739
01740 /* Output result */
01741 if( prev_excluded == 0 ) {
01742 rv = snprintf( user_msg, USER_MSG_LENGTH, " Excluding %s", id );
01743 } else {
01744 rv = snprintf( user_msg, USER_MSG_LENGTH, " Including %s", id );
01745 }
01746 assert( rv < USER_MSG_LENGTH );
01747 print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01748
01749 /* Toggle the exclude bit */
01750 found_fsm->arcs[arc_index]->suppl.part.excluded = (prev_excluded ^ 1);
01751
01752 /* If we are excluding and the -m option was specified, get an exclusion reason from the user */
01753 if( exclude_prompt_for_msgs || (prev_excluded == 1) ) {
01754 exclude_handle_exclude_reason( prev_excluded, id, found_funit );
01755 }
01756
01757 }
01758
01759 } else {
01760
01761 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Unable to find FSM arc associated with exclusion ID %s", id );
01762 assert( rv < USER_MSG_LENGTH );
01763 print_output( user_msg, WARNING, __FILE__, __LINE__ );
01764
01765 }
01766
01767 PROFILE_END;
01768
01769 return( (arc_index != -1) && !exclude_print );
01770
01771 }
|
|
|
01338 { PROFILE(EXCLUDED_GET_MESSAGE);
01339
01340 char* msg; /* Pointer to the message from the user */
01341 unsigned int msg_size; /* The current size of the specified message */
01342 char c; /* Current character */
01343 bool nl_just_seen = TRUE; /* Set to TRUE if a newline was just seen */
01344 bool sp_just_seen = TRUE; /* Set to TRUE if a space character was just seen */
01345 int index = 0; /* Current string index */
01346 char str[100];
01347 char* formatted_msg; /* Formatted message */
01348 unsigned int rv;
01349
01350 rv = snprintf( user_msg, USER_MSG_LENGTH, "Please specify a reason for exclusion for exclusion ID %s (Enter a '.' (period) on a newline to end):\n", eid );
01351 assert( rv < USER_MSG_LENGTH );
01352 print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01353
01354 msg = strdup_safe( "" );
01355 msg_size = 1;
01356 str[0] = '\0';
01357
01358 while( ((c = (char)getchar()) != EOF) && ((c != '.') || !nl_just_seen) ) {
01359
01360 /* Mark if we have just seen a newline (for the purposes of determining if the user has completed input) */
01361 nl_just_seen = (c == '\n') ? TRUE : FALSE;
01362
01363 /* Place the read character into the temporary string */
01364 str[(index % 99) + 0] = c;
01365 str[(index % 99) + 1] = '\0';
01366
01367 /*
01368 If the temporary string has been filled, realloc the msg and append the contents of the the temporary array to this newly
01369 allocated array.
01370 */
01371 if( ((index + 1) % 99) == 0 ) {
01372 msg = (char*)realloc_safe( msg, msg_size, (msg_size + strlen( str )) );
01373 msg_size += strlen( str );
01374 strcat( msg, str );
01375 }
01376
01377 index++;
01378
01379 }
01380
01381 if( strlen( str ) > 0 ) {
01382 msg = (char*)realloc_safe( msg, msg_size, (msg_size + strlen( str )) );
01383 strcat( msg, str );
01384 msg[strlen(msg)-1] = '\0';
01385 }
01386
01387 print_output( "", NORMAL, __FILE__, __LINE__ );
01388
01389 /* Now reformat the message */
01390 formatted_msg = exclude_format_reason( msg );
01391
01392 free_safe( msg, (strlen( msg ) + ((strlen( str ) > 0) ? 2 : 1)) );
01393
01394 PROFILE_END;
01395
01396 return( formatted_msg );
01397
01398 }
|
|
||||||||||||||||
|
Handle the creation/deallocation of the exclude reason structure.
01407 { PROFILE(EXCLUDE_HANDLE_EXCLUDE_REASON);
01408
01409 /*
01410 If the coverage point was not previously excluded, allow the user to specify a reason and
01411 store this information in the functional unit.
01412 */
01413 if( prev_excluded == 0 ) {
01414
01415 char* str = exclude_get_message( id );
01416
01417 if( (str != NULL) && (strlen( str ) > 0) ) {
01418 exclude_add_exclude_reason( id[0], atoi( id + 1 ), str, funit );
01419 } else {
01420 free_safe( str, (strlen( str ) + 1) );
01421 }
01422
01423 /*
01424 If the coverage point was previously excluded, attempt to find the matching exclusion reason, and, if
01425 it is found, remove it from the list.
01426 */
01427 } else {
01428
01429 exclude_remove_exclude_reason( id[0], atoi( id + 1 ), funit );
01430
01431 }
01432
01433 PROFILE_END;
01434
01435 }
|
|
||||||||||||||||
|
Returns TRUE if given assertion is excluded from coverage.
00657 { PROFILE(EXCLUDE_IS_ASSERT_EXCLUDED);
00658
00659 funit_inst* inst; /* Pointer to found functional unit instance */
00660 funit_inst* curr_child; /* Pointer to current child functional instance */
00661 exp_link* expl; /* Pointer to current expression link */
00662 int ignore = 0; /* Number of instances to ignore */
00663 statement* stmt; /* Pointer to current statement */
00664
00665 /* Find the functional unit instance that matches the description */
00666 if( (inst = inst_link_find_by_funit( funit, db_list[curr_db]->inst_head, &ignore )) != NULL ) {
00667
00668 func_iter fi;
00669
00670 /* Find child instance */
00671 curr_child = inst->child_head;
00672 while( (curr_child != NULL) && (strcmp( curr_child->name, inst_name ) != 0) ) {
00673 curr_child = curr_child->next;
00674 }
00675 assert( curr_child != NULL );
00676
00677 /* Initialize the functional unit iterator */
00678 func_iter_init( &fi, curr_child->funit, TRUE, FALSE );
00679
00680 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->id != expr_id) );
00681
00682 /* Deallocate functional unit statement iterator */
00683 func_iter_dealloc( &fi );
00684
00685 }
00686
00687 PROFILE_END;
00688
00689 return( (inst == NULL) || (stmt == NULL) || (stmt->exp->id != expr_id) || (stmt->exp->suppl.part.excluded == 1) );
00690
00691 }
|
|
||||||||||||||||
|
00477 { PROFILE(EXCLUDE_IS_COMB_EXCLUDED);
00478
00479 func_iter fi; /* Functional unit iterator */
00480 statement* stmt; /* Pointer to found statement */
00481 expression* subexp; /* Pointer to found expression */
00482
00483 /* Find the matching root expression */
00484 func_iter_init( &fi, funit, TRUE, FALSE );
00485 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->id != expr_id) );
00486 func_iter_dealloc( &fi );
00487
00488 if( stmt != NULL ) {
00489 subexp = expression_find_uline_id( stmt->exp, uline_id );
00490 }
00491
00492 PROFILE_END;
00493
00494 return( (stmt == NULL) || (subexp == NULL) || (subexp->suppl.part.excluded == 1) );
00495
00496 }
|
|
||||||||||||||||||||
|
Returns TRUE if the specified FSM is excluded in the given functional unit.
00554 { PROFILE(EXCLUDE_IS_FSM_EXCLUDED);
00555
00556 fsm_link* curr_fsm; /* Pointer to current FSM structure */
00557 int found_index; /* Index of found state transition */
00558
00559 /* Find the corresponding table */
00560 curr_fsm = funit->fsm_head;
00561 while( (curr_fsm != NULL) && (curr_fsm->table->to_state->id != expr_id) ) {
00562 curr_fsm = curr_fsm->next;
00563 }
00564
00565 if( curr_fsm != NULL ) {
00566
00567 vector* from_vec;
00568 vector* to_vec;
00569 int from_base, to_base;
00570
00571 /* Convert from/to state strings into vector values */
00572 vector_from_string( &from_state, FALSE, &from_vec, &from_base );
00573 vector_from_string( &to_state, FALSE, &to_vec, &to_base );
00574
00575 /* Find the arc entry and perform the exclusion assignment and coverage recalculation */
00576 found_index = arc_find_arc( curr_fsm->table->table, arc_find_from_state( curr_fsm->table->table, from_vec ), arc_find_to_state( curr_fsm->table->table, to_vec ) );
00577
00578 /* Deallocate vectors */
00579 vector_dealloc( from_vec );
00580 vector_dealloc( to_vec );
00581
00582 }
00583
00584 PROFILE_END;
00585
00586 return( (curr_fsm == NULL) || (found_index == -1) || (curr_fsm->table->table->arcs[found_index]->suppl.part.excluded == 1) );
00587
00588 }
|
|
||||||||||||
|
Returns TRUE if the specified line is excluded in the given functional unit.
00349 { PROFILE(EXCLUDE_IS_LINE_EXCLUDED);
00350
00351 func_iter fi; /* Functional unit iterator */
00352 statement* stmt; /* Pointer to current statement */
00353
00354 func_iter_init( &fi, funit, TRUE, FALSE );
00355 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->line != line) );
00356 func_iter_dealloc( &fi );
00357
00358 PROFILE_END;
00359
00360 return( (stmt == NULL) || (stmt->suppl.part.excluded == 1) );
00361
00362 }
|
|
|
00085 {
00086
00087 return( (expr != NULL) &&
00088 ((ESUPPL_EXCLUDED( expr->suppl ) == 1) ||
00089 ((ESUPPL_IS_ROOT( expr->suppl ) == 0) && exclude_is_parent_excluded( expr->parent->expr ))) );
00090
00091 }
|
|
||||||||||||
|
Returns TRUE if the specified signal is excluded in the given functional unit.
00412 { PROFILE(EXCLUDE_IS_TOGGLE_EXCLUDED);
00413
00414 func_iter fi; /* Functional unit iterator */
00415 vsignal* sig; /* Pointer to current signal */
00416
00417 func_iter_init( &fi, funit, FALSE, TRUE );
00418 while( ((sig = func_iter_get_next_signal( &fi )) != NULL) && (strcmp( sig->name, sig_name ) != 0) );
00419 func_iter_dealloc( &fi );
00420
00421 PROFILE_END;
00422
00423 return( (sig == NULL) || (sig->suppl.part.excluded == 1) );
00424
00425 }
|
|
|
01473 { PROFILE(EXCLUDE_LINE_FROM_ID);
01474
01475 expression* exp; /* Pointer to found expression */
01476 func_unit* found_funit; /* Pointer to functional unit containing found expression */
01477
01478 if( (exp = exclude_find_expression( atoi( id + 1 ), &found_funit )) != NULL ) {
01479
01480 int prev_excluded;
01481 unsigned int rv;
01482
01483 assert( ESUPPL_IS_ROOT( exp->suppl ) == 1 );
01484
01485 /* Get the previously excluded value */
01486 prev_excluded = exp->parent->stmt->suppl.part.excluded;
01487
01488 /* If the user wants to print the information do so */
01489 if( exclude_print ) {
01490
01491 exclude_print_exclusion( id, prev_excluded, found_funit );
01492
01493 /* Otherwise, perform the exclusion */
01494 } else {
01495
01496 /* Output result */
01497 if( prev_excluded == 0 ) {
01498 rv = snprintf( user_msg, USER_MSG_LENGTH, " Excluding %s", id );
01499 } else {
01500 rv = snprintf( user_msg, USER_MSG_LENGTH, " Including %s", id );
01501 }
01502 assert( rv < USER_MSG_LENGTH );
01503 print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01504
01505 /* Set the exclude bits in the expression supplemental field */
01506 exp->suppl.part.excluded = (prev_excluded ^ 1);
01507 exp->parent->stmt->suppl.part.excluded = (prev_excluded ^ 1);
01508
01509 /* If we are excluding and the -m option was specified, get an exclusion reason from the user */
01510 if( exclude_prompt_for_msgs || (prev_excluded == 1) ) {
01511 exclude_handle_exclude_reason( prev_excluded, id, found_funit );
01512 }
01513
01514 }
01515
01516 } else {
01517
01518 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Unable to find line associated with exclusion ID %s", id );
01519 assert( rv < USER_MSG_LENGTH );
01520 print_output( user_msg, WARNING, __FILE__, __LINE__ );
01521
01522 }
01523
01524 PROFILE_END;
01525
01526 return( (exp != NULL) && !exclude_print );
01527
01528 }
|
|
|
01597 { PROFILE(EXCLUDE_MEMORY_FROM_ID);
01598
01599 vsignal* sig; /* Pointer to found signal */
01600 func_unit* found_funit; /* Pointer to functional unit containing sig */
01601
01602 if( (sig = exclude_find_signal( atoi( id + 1 ), &found_funit )) != NULL ) {
01603
01604 int prev_excluded = sig->suppl.part.excluded;
01605 unsigned int rv;
01606
01607 /* If the user has specified to print the exclusion, do so */
01608 if( exclude_print ) {
01609
01610 exclude_print_exclusion( id, prev_excluded, found_funit );
01611
01612 /* Otherwise, perform the exclusion */
01613 } else {
01614
01615 /* Output result */
01616 if( prev_excluded == 0 ) {
01617 rv = snprintf( user_msg, USER_MSG_LENGTH, " Excluding %s", id );
01618 } else {
01619 rv = snprintf( user_msg, USER_MSG_LENGTH, " Including %s", id );
01620 }
01621 assert( rv < USER_MSG_LENGTH );
01622 print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01623
01624 /* Set the exclude bits in the expression supplemental field */
01625 sig->suppl.part.excluded = (prev_excluded ^ 1);
01626
01627 /* If we are excluding and the -m option was specified, get an exclusion reason from the user */
01628 if( exclude_prompt_for_msgs || (prev_excluded == 1) ) {
01629 exclude_handle_exclude_reason( prev_excluded, id, found_funit );
01630 }
01631
01632 }
01633
01634 } else {
01635
01636 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Unable to find memory associated with exclusion ID %s", id );
01637 assert( rv < USER_MSG_LENGTH );
01638 print_output( user_msg, WARNING, __FILE__, __LINE__ );
01639
01640 }
01641
01642 PROFILE_END;
01643
01644 return( (sig != NULL) && !exclude_print );
01645
01646 }
|
|
||||||||||||
|
Performs exclusion reason merging. Reads the given exclude reason structure information from the line read from the CDD file.
01153 { PROFILE(EXCLUDE_MERGE);
01154
01155 exclude_reason* found_er;
01156
01157 /* If the exclusion reason does not exist in the base CDD, go ahead and add it */
01158 if( (found_er = exclude_find_exclude_reason( er->type, er->id, base )) == NULL ) {
01159
01160 exclude_reason* new_er;
01161
01162 /* Allocate and initialize the exclude reason structure */
01163 new_er = (exclude_reason*)malloc_safe( sizeof( exclude_reason ) );
01164 new_er->type = er->type;
01165 new_er->id = er->id;
01166 new_er->timestamp = er->timestamp;
01167 new_er->reason = strdup_safe( er->reason );
01168 new_er->next = NULL;
01169
01170 /* Add the given exclude reason to the current functional unit list */
01171 if( base->er_head == NULL ) {
01172 base->er_head = base->er_tail = new_er;
01173 } else {
01174 base->er_tail->next = new_er;
01175 base->er_tail = new_er;
01176 }
01177
01178 /* Otherwise, if the exclusion reason does exist, check for a conflict and handle it */
01179 } else {
01180
01181 /*
01182 If the exclusion reason string does not match the current string, resolve the conflict appropriately
01183 (otherwise, just use the reason in the base functional unit).
01184 */
01185 if( strcmp( found_er->reason, er->reason ) != 0 ) {
01186 exclude_resolve_reason( found_er, base, merge_er_value, er->reason, er->timestamp );
01187 }
01188
01189 }
01190
01191 PROFILE_END;
01192
01193 }
|
|
||||||||||||||||
|
00795 {
00796
00797 int i;
00798 bool help_found = FALSE;
00799
00800 i = last_arg + 1;
00801
00802 while( (i < argc) && !help_found ) {
00803
00804 if( strncmp( "-h", argv[i], 2 ) == 0 ) {
00805
00806 exclude_usage();
00807 help_found = TRUE;
00808
00809 } else if( strncmp( "-f", argv[i], 2 ) == 0 ) {
00810
00811 if( check_option_value( argc, argv, i ) ) {
00812 char** arg_list = NULL;
00813 int arg_num = 0;
00814 unsigned int j;
00815 i++;
00816 Try {
00817 read_command_file( argv[i], &arg_list, &arg_num );
00818 help_found = exclude_parse_args( arg_num, -1, (const char**)arg_list );
00819 } Catch_anonymous {
00820 for( j=0; j<arg_num; j++ ) {
00821 free_safe( arg_list[j], (strlen( arg_list[j] ) + 1) );
00822 }
00823 free_safe( arg_list, (sizeof( char* ) * arg_num) );
00824 Throw 0;
00825 }
00826 for( j=0; j<arg_num; j++ ) {
00827 free_safe( arg_list[j], (strlen( arg_list[j] ) + 1) );
00828 }
00829 free_safe( arg_list, (sizeof( char* ) * arg_num) );
00830 } else {
00831 Throw 0;
00832 }
00833
00834 } else if( strncmp( "-m", argv[i], 2 ) == 0 ) {
00835
00836 exclude_prompt_for_msgs = TRUE;
00837
00838 } else if( strncmp( "-p", argv[i], 2 ) == 0 ) {
00839
00840 exclude_print = TRUE;
00841
00842 } else if( strncmp( "-", argv[i], 1 ) == 0 ) {
00843
00844 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Unknown exclude option (%s) specified.", argv[i] );
00845 assert( rv < USER_MSG_LENGTH );
00846 print_output( user_msg, FATAL, __FILE__, __LINE__ );
00847 Throw 0;
00848
00849 } else if( (i + 1) == argc ) {
00850
00851 /* Check to make sure that the user has specified at least one exclusion ID */
00852 if( excl_ids_head == NULL ) {
00853 print_output( "At least one exclusion ID must be specified", FATAL, __FILE__, __LINE__ );
00854 Throw 0;
00855 }
00856
00857 if( file_exists( argv[i] ) ) {
00858 exclude_cdd = strdup_safe( argv[i] );
00859 } else {
00860 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Specified CDD file (%s) does not exist", argv[i] );
00861 assert( rv < USER_MSG_LENGTH );
00862 print_output( user_msg, FATAL, __FILE__, __LINE__ );
00863 Throw 0;
00864 }
00865
00866 } else {
00867
00868 (void)str_link_add( strdup_safe( argv[i] ), &excl_ids_head, &excl_ids_tail );
00869
00870 }
00871
00872 i++;
00873
00874 }
00875
00876 return( help_found );
00877
00878 }
|
|
||||||||||||||||
|
Prints the exclusion information to standard output.
01444 { PROFILE(EXCLUDE_PRINT_EXCLUSION);
01445
01446 printf( "Exclusion ID: %s, Status: %s\n", id, ((excluded == 1) ? "EXCLUDED" : "INCLUDED") );
01447
01448 /* Only output an exclusion message if we are currently excluded */
01449 if( excluded == 1 ) {
01450
01451 exclude_reason* er = exclude_find_exclude_reason( id[0], atoi( id + 1 ), funit );
01452
01453 if( er != NULL ) {
01454 report_output_exclusion_reason( stdout, 2, er->reason, FALSE );
01455 } else {
01456 report_output_exclusion_reason( stdout, 2, "No exclusion information has been specified.", FALSE );
01457 }
01458
01459 }
01460
01461 PROFILE_END;
01462
01463 }
|
|
||||||||||||||||
|
Handles the deallocation of the exclude reason structure.
00312 { PROFILE(EXCLUDE_REMOVE_EXCLUDE_REASON);
00313
00314 exclude_reason* last_er = NULL;
00315 exclude_reason* er = funit->er_head;
00316
00317 /*
00318 If the coverage point was previously excluded, attempt to find the matching exclusion reason, and, if
00319 it is found, remove it from the list.
00320 */
00321 while( (er != NULL) && ((er->type != type) || (er->id != id)) ) {
00322 last_er = er;
00323 er = er->next;
00324 }
00325
00326 if( er != NULL ) {
00327 if( last_er == NULL ) {
00328 funit->er_head = er->next;
00329 if( er->next == NULL ) {
00330 funit->er_tail = NULL;
00331 }
00332 } else {
00333 last_er->next = er->next;
00334 }
00335 free_safe( er->reason, (strlen( er->reason ) + 1) );
00336 free_safe( er, sizeof( exclude_reason ) );
00337 }
00338
00339 PROFILE_END;
00340
00341 }
|
|
||||||||||||||||||||||||
|
Resolves an exclusion reason conflict according to the merge option specified by the user.
00982 { PROFILE(EXCLUDE_RESOLVE_REASON);
00983
00984 unsigned int slen;
00985 char* eid;
00986 char answer;
00987 char c;
00988
00989 switch( resolution ) {
00990
00991 case MERGE_ER_NONE :
00992 eid = db_gen_exclusion_id( orig_er->type, orig_er->id );
00993 printf( "Exclusion reason conflict for %s\n", eid );
00994 printf( " Exclusion reason #1:\n" );
00995 report_output_exclusion_reason( stdout, 4, orig_er->reason, FALSE );
00996 printf( " Exclusion reason #2:\n" );
00997 report_output_exclusion_reason( stdout, 4, new_reason, FALSE );
00998 do {
00999 printf( "Choose an exclusion reason to use (none, 1, 2, both, rewrite, abort): " );
01000 answer = (char)getchar();
01001 while( ((c = (char)getchar()) != EOF) && (c != '\n') );
01002 } while( (answer != 'n') && (answer != '1') && (answer != '2') && (answer != 'b') && (answer != 'r') && (answer != 'a') );
01003 switch( answer ) {
01004 case 'n' :
01005 exclude_remove_exclude_reason( orig_er->type, orig_er->id, orig_funit );
01006 break;
01007 case '1' :
01008 /* No need to do anything */
01009 break;
01010 case '2' :
01011 exclude_resolve_reason( orig_er, orig_funit, MERGE_ER_LAST, new_reason, new_timestamp );
01012 break;
01013 case 'b' :
01014 exclude_resolve_reason( orig_er, orig_funit, MERGE_ER_ALL, new_reason, new_timestamp );
01015 break;
01016 case 'r' :
01017 free_safe( orig_er->reason, (strlen( orig_er->reason ) + 1) );
01018 orig_er->reason = exclude_get_message( eid );
01019 break;
01020 case 'a' :
01021 Throw 0;
01022 /*@-unreachable@*/
01023 break;
01024 /*@=unreachable@*/
01025 }
01026 free_safe( eid, (strlen( eid ) + 1) );
01027 break;
01028
01029 case MERGE_ER_FIRST :
01030 /* Do nothing. The first message is already in the base. */
01031 break;
01032
01033 case MERGE_ER_LAST :
01034 free_safe( orig_er->reason, (strlen( orig_er->reason ) + 1) );
01035 orig_er->reason = strdup_safe( new_reason );
01036 break;
01037
01038 case MERGE_ER_ALL :
01039 slen = strlen( orig_er->reason ) + 1 + strlen( new_reason ) + 1;
01040 if( orig_er->reason[strlen( orig_er->reason ) - 1] != '.' ) {
01041 slen++;
01042 }
01043 orig_er->reason = (char*)realloc_safe( orig_er->reason, (strlen( orig_er->reason ) + 1), slen );
01044 if( orig_er->reason[strlen( orig_er->reason ) - 1] != '.' ) {
01045 strcat( orig_er->reason, "." );
01046 }
01047 strcat( orig_er->reason, " " );
01048 strcat( orig_er->reason, new_reason );
01049 break;
01050
01051 case MERGE_ER_NEW :
01052 if( orig_er->timestamp < new_timestamp ) {
01053 free_safe( orig_er->reason, (strlen( orig_er->reason ) + 1) );
01054 orig_er->reason = strdup_safe( new_reason );
01055 }
01056 break;
01057
01058 case MERGE_ER_OLD :
01059 if( orig_er->timestamp > new_timestamp ) {
01060 free_safe( orig_er->reason, (strlen( orig_er->reason ) + 1) );
01061 orig_er->reason = strdup_safe( new_reason );
01062 }
01063 break;
01064
01065 default :
01066 assert( 0 );
01067 break;
01068 }
01069
01070 PROFILE_END;
01071
01072 }
|
|
||||||||||||||||||||||||||||
|
Sets the excluded bit for the specified expression in the given functional unit and recalculates the summary coverage information. Finds the expression and functional unit instance for the given name, type and sig_name and calls the exclude_expr_assign_and_recalc function for the matching expression, setting the excluded bit of the expression and recalculating the summary coverage information.
00705 { PROFILE(EXCLUDE_SET_ASSERT_EXCLUDE);
00706
00707 funit_inst* inst; /* Pointer to found functional unit instance */
00708 funit_inst* curr_child; /* Pointer to current child functional instance */
00709 exp_link* expl; /* Pointer to current expression link */
00710 int ignore = 0; /* Number of instances to ignore */
00711
00712 /* Find the functional unit instance that matches the description */
00713 if( (inst = inst_link_find_by_funit( funit, db_list[curr_db]->inst_head, &ignore )) != NULL ) {
00714
00715 func_iter fi;
00716 statement* stmt;
00717
00718 /* Find child instance */
00719 curr_child = inst->child_head;
00720 while( (curr_child != NULL) && (strcmp( curr_child->name, inst_name ) != 0) ) {
00721 curr_child = curr_child->next;
00722 }
00723 assert( curr_child != NULL );
00724
00725 /* Initialize the functional unit iterator */
00726 func_iter_init( &fi, curr_child->funit, TRUE, FALSE );
00727
00728 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->id != expr_id) );
00729
00730 /* Find the signal that matches the given signal name and sets its excluded bit */
00731 if( stmt->exp->id == expr_id ) {
00732
00733 /* Exclude/include the assertion and recalculate the summary information */
00734 exclude_expr_assign_and_recalc( stmt->exp, curr_child->funit, (value == 1), FALSE, stat );
00735
00736 /* Handle the exclusion reason */
00737 if( value == 1 ) {
00738 if( reason != NULL ) {
00739 exclude_add_exclude_reason( 'A', stmt->exp->id, reason, curr_child->funit );
00740 }
00741 } else {
00742 exclude_remove_exclude_reason( 'A', stmt->exp->id, curr_child->funit );
00743 }
00744
00745 }
00746
00747 /* Deallocate functional unit statement iterator */
00748 func_iter_dealloc( &fi );
00749
00750 }
00751
00752 PROFILE_END;
00753
00754 }
|
|
||||||||||||||||||||||||||||
|
Sets the excluded bit for the specified expression in the given functional unit and recalculates the summary coverage information. Finds the expression and functional unit instance for the given name, type and sig_name and calls the exclude_expr_assign_and_recalc function for the matching expression, setting the excluded bit of the expression and recalculating the summary coverage information.
00510 { PROFILE(EXCLUDE_SET_COMB_EXCLUDE);
00511
00512 func_iter fi; /* Functional unit iterator */
00513 statement* stmt; /* Pointer to current statement */
00514
00515 /* Find the root expression */
00516 func_iter_init( &fi, funit, TRUE, FALSE );
00517 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->id != expr_id) );
00518 func_iter_dealloc( &fi );
00519
00520 if( stmt != NULL ) {
00521
00522 expression* subexp;
00523
00524 if( (subexp = expression_find_uline_id( stmt->exp, uline_id )) != NULL ) {
00525
00526 /* Exclude/include the expression and recalculate the summary information */
00527 exclude_expr_assign_and_recalc( subexp, funit, (value == 1), FALSE, stat );
00528
00529 /* Handle the exclusion reason */
00530 if( value == 1 ) {
00531 if( reason != NULL ) {
00532 exclude_add_exclude_reason( 'E', subexp->id, reason, funit );
00533 }
00534 } else {
00535 exclude_remove_exclude_reason( 'E', subexp->id, funit );
00536 }
00537
00538 }
00539
00540 }
00541
00542 PROFILE_END;
00543
00544 }
|
|
||||||||||||||||||||||||||||||||
|
Sets the excluded bit for the specified state transition in the given functional unit and recalculates the summary coverage information. Finds the FSM table associated with the specified expr_id and sets the include/exclude status of the given from_state/to_state transition appropriately.
00602 { PROFILE(EXCLUDE_SET_FSM_EXCLUDE);
00603
00604 fsm_link* curr_fsm;
00605
00606 /* Find the corresponding table */
00607 curr_fsm = funit->fsm_head;
00608 while( (curr_fsm != NULL) && (curr_fsm->table->to_state->id != expr_id) ) {
00609 curr_fsm = curr_fsm->next;
00610 }
00611
00612 if( curr_fsm != NULL ) {
00613
00614 vector* from_vec;
00615 vector* to_vec;
00616 int found_index;
00617 int from_base, to_base;
00618
00619 /* Convert from/to state strings into vector values */
00620 vector_from_string( &from_state, FALSE, &from_vec, &from_base );
00621 vector_from_string( &to_state, FALSE, &to_vec, &to_base );
00622
00623 /* Find the arc entry and perform the exclusion assignment and coverage recalculation */
00624 if( (found_index = arc_find_arc( curr_fsm->table->table, arc_find_from_state( curr_fsm->table->table, from_vec ), arc_find_to_state( curr_fsm->table->table, to_vec ) )) != -1 ) {
00625
00626 /* Handle the exclusion and recalculate the summary values */
00627 exclude_arc_assign_and_recalc( curr_fsm->table->table, found_index, (value == 1), stat );
00628
00629 /* Handle the exclusion reason */
00630 if( value == 1 ) {
00631 if( reason != NULL ) {
00632 exclude_add_exclude_reason( 'F', (curr_fsm->table->table->id + found_index), reason, funit );
00633 }
00634 } else {
00635 exclude_remove_exclude_reason( 'F', (curr_fsm->table->table->id + found_index), funit );
00636 }
00637
00638 }
00639
00640 /* Deallocate vectors */
00641 vector_dealloc( from_vec );
00642 vector_dealloc( to_vec );
00643
00644 }
00645
00646 PROFILE_END;
00647
00648 }
|
|
||||||||||||||||||||||||
|
Sets the excluded bit for all expressions in the given functional unit with the specified line number and recalculates the summary coverage information. Finds the expression(s) and functional unit instance for the given name, type and line number and calls the exclude_expr_assign_and_recalc function for each matching expression, setting the excluded bit of the expression and recalculating the summary coverage information.
00375 { PROFILE(EXCLUDE_SET_LINE_EXCLUDE);
00376
00377 func_iter fi; /* Functional unit iterator */
00378 statement* stmt; /* Pointer to current statement */
00379
00380 func_iter_init( &fi, funit, TRUE, FALSE );
00381
00382 do {
00383 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->line != line) );
00384 if( stmt != NULL ) {
00385
00386 exclude_expr_assign_and_recalc( stmt->exp, funit, (value == 1), TRUE, stat );
00387
00388 /* Handle the exclusion reason */
00389 if( value == 1 ) {
00390 if( reason != NULL ) {
00391 exclude_add_exclude_reason( 'L', stmt->exp->id, reason, funit );
00392 }
00393 } else {
00394 exclude_remove_exclude_reason( 'L', stmt->exp->id, funit );
00395 }
00396
00397 }
00398 } while( stmt != NULL );
00399
00400 func_iter_dealloc( &fi );
00401
00402 PROFILE_END;
00403
00404 }
|
|
||||||||||||||||||||||||||||
|
Sets the excluded bit for the specified signal in the given functional unit and recalculates the summary coverage information. Finds the signal and functional unit instance for the given name, type and sig_name and calls the exclude_sig_assign_and_recalc function for the matching signal, setting the excluded bit of the signal and recalculating the summary coverage information.
00439 { PROFILE(EXCLUDE_SET_TOGGLE_EXCLUDE);
00440
00441 func_iter fi; /* Functional unit iterator */
00442 vsignal* sig; /* Pointer to current signal */
00443
00444 /* Find the signal that matches the given signal name, if it exists */
00445 func_iter_init( &fi, funit, FALSE, TRUE );
00446 while( ((sig = func_iter_get_next_signal( &fi )) != NULL) && (strcmp( sig->name, sig_name ) != 0) );
00447 func_iter_dealloc( &fi );
00448
00449 /* Set its exclude bit if it exists */
00450 if( sig != NULL ) {
00451
00452 /* Exclude/include the signal and recalculate the summary information */
00453 exclude_sig_assign_and_recalc( sig, (value == 1), stat );
00454
00455 /* Handle the exclusion reason */
00456 if( value == 1 ) {
00457 if( reason != NULL ) {
00458 exclude_add_exclude_reason( type, sig->id, reason, funit );
00459 }
00460 } else {
00461 exclude_remove_exclude_reason( type, sig->id, funit );
00462 }
00463
00464 }
00465
00466 PROFILE_END;
00467
00468 }
|
|
||||||||||||||||
|
Sets the specified signal's exclude bit to the given value and recalculates all affected coverage information for this instance.
00184 { PROFILE(EXCLUDE_SIG_ASSIGN_AND_RECALC);
00185
00186 /* First, set the exclude bit in the signal supplemental field */
00187 sig->suppl.part.excluded = excluded ? 1 : 0;
00188
00189 /* If the signal is a memory, we need to update the memory coverage numbers */
00190 if( sig->suppl.part.type == SSUPPL_TYPE_MEM ) {
00191
00192 unsigned int wr_hit = 0; /* Number of addressable elements written */
00193 unsigned int rd_hit = 0; /* Number of addressable elements read */
00194 unsigned int ae_total = 0; /* Number of addressable elements in this memory */
00195 unsigned int tog01_hit = 0; /* Number of bits toggling from 0->1 */
00196 unsigned int tog10_hit = 0; /* Number of bits toggling from 1->0 */
00197 unsigned int tog_total = 0; /* Total number of toggle bits */
00198 unsigned int mem_excluded = 0; /* Number of excluded memory coverage points */
00199 bool cov_found;
00200
00201 /* Get the stats for the current memory */
00202 memory_get_stat( sig, &wr_hit, &rd_hit, &ae_total, &tog01_hit, &tog10_hit, &tog_total, &mem_excluded, &cov_found, TRUE );
00203
00204 /* Recalculate the total and hit values for memory coverage */
00205 if( excluded ) {
00206 stat->mem_wr_hit += (ae_total - wr_hit);
00207 stat->mem_rd_hit += (ae_total - rd_hit);
00208 stat->mem_tog01_hit += (tog_total - tog01_hit);
00209 stat->mem_tog10_hit += (tog_total - tog10_hit);
00210 stat->mem_excluded += ((ae_total * 2) + (tog_total * 2));
00211 } else {
00212 stat->mem_wr_hit -= (ae_total - wr_hit);
00213 stat->mem_rd_hit -= (ae_total - rd_hit);
00214 stat->mem_tog01_hit -= (tog_total - tog01_hit);
00215 stat->mem_tog10_hit -= (tog_total - tog10_hit);
00216 stat->mem_excluded -= ((ae_total * 2) + (tog_total * 2));
00217 }
00218
00219 /* Otherwise, the toggle coverage numbers should be adjusted */
00220 } else {
00221
00222 unsigned int hit01 = 0; /* Number of bits transitioning from 0 -> 1 */
00223 unsigned int hit10 = 0; /* Number of bits transitioning from 1 -> 0 */
00224
00225 /* Get the total hit01 and hit10 information */
00226 vector_toggle_count( sig->value, &hit01, &hit10 );
00227
00228 /* Recalculate the total and hit values for toggle coverage */
00229 if( excluded ) {
00230 stat->tog01_hit += (sig->value->width - hit01);
00231 stat->tog10_hit += (sig->value->width - hit10);
00232 stat->tog_excluded += (sig->value->width * 2);
00233 } else {
00234 stat->tog01_hit -= (sig->value->width - hit01);
00235 stat->tog10_hit -= (sig->value->width - hit10);
00236 stat->tog_excluded -= (sig->value->width * 2);
00237 }
00238
00239 }
00240
00241 PROFILE_END;
00242
00243 }
|
|
|
01538 { PROFILE(EXCLUDE_TOGGLE_FROM_ID);
01539
01540 vsignal* sig; /* Pointer to found signal */
01541 func_unit* found_funit; /* Pointer to functional unit containing sig */
01542
01543 if( (sig = exclude_find_signal( atoi( id + 1 ), &found_funit )) != NULL ) {
01544
01545 int prev_excluded = sig->suppl.part.excluded;
01546 unsigned int rv;
01547
01548 /* If the user wants to print the information do so */
01549 if( exclude_print ) {
01550
01551 exclude_print_exclusion( id, prev_excluded, found_funit );
01552
01553 /* Otherwise, perform the exclusion */
01554 } else {
01555
01556 /* Output result */
01557 if( prev_excluded == 0 ) {
01558 rv = snprintf( user_msg, USER_MSG_LENGTH, " Excluding %s", id );
01559 } else {
01560 rv = snprintf( user_msg, USER_MSG_LENGTH, " Including %s", id );
01561 }
01562 assert( rv < USER_MSG_LENGTH );
01563 print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01564
01565 /* Set the exclude bits in the expression supplemental field */
01566 sig->suppl.part.excluded = (prev_excluded ^ 1);
01567
01568 /* If we are excluding and the -m option was specified, get an exclusion reason from the user */
01569 if( exclude_prompt_for_msgs || (prev_excluded == 1) ) {
01570 exclude_handle_exclude_reason( prev_excluded, id, found_funit );
01571 }
01572
01573 }
01574
01575 } else {
01576
01577 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Unable to find toggle signal associated with exclusion ID %s", id );
01578 assert( rv < USER_MSG_LENGTH );
01579 print_output( user_msg, WARNING, __FILE__, __LINE__ );
01580
01581 }
01582
01583 PROFILE_END;
01584
01585 return( (sig != NULL) && !exclude_print );
01586
01587 }
|
|
|
Outputs usage information to standard output for exclude command.
00761 {
00762
00763 printf( "\n" );
00764 printf( "Usage: covered exclude (-h | ([<options>] <exclusion_ids>+ <database_file>)\n" );
00765 printf( "\n" );
00766 printf( " -h Displays this help information.\n" );
00767 printf( "\n" );
00768 printf( " Options:\n" );
00769 printf( " -f <filename> Name of file containing additional arguments to parse.\n" );
00770 printf( " -m Allows a message to be associated with an exclusion.\n" );
00771 printf( " The message should describe the reason why a coverage point\n" );
00772 printf( " is being excluded. If a coverage point is being included for\n" );
00773 printf( " coverage (i.e., it was previously excluded from coverage), no\n" );
00774 printf( " message prompt will be specified.\n" );
00775 printf( " -p Outputs the status of the exclusion ID and an exclusion message\n" );
00776 printf( " if one exists. No excluding will occur if this option is set.\n" );
00777 printf( "\n" );
00778
00779 }
|
|
|
Index of current database in db_list array that is being handled. |
|
|
Array of database pointers storing all currently loaded databases. |
|
|
Pointer to the head of the list of exclusion IDs to toggle exclusion/inclusion mode of. |
|
|
Pointer to the tail of the list of exclusion IDs to toggle exclusion/inclusion mode of. |
|
|
Name of CDD file that will be read, modified with exclusion modifications and written back. |
|
|
If set to TRUE, prints the status and exclusion reason for the given exclusion ID. Set to TRUE via the -p option. |
|
|
If set to TRUE, causes a message prompt to be displayed for each coverage point that will be excluded from coverage. |
|
|
Informational line for the CDD file. |
|
|
Specifies the value of the -er option. |
|
|
Holds some output that will be displayed via the print_output command. This is created globally so that memory does not need to be reallocated for each function that wishes to use it. |
1.3.4