Contains functions for handling user-specified exclusion of coverage results. More...
#include "defines.h"
Go to the source code of this file.
Functions | |
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. | |
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. | |
char * | exclude_format_reason (const char *old_str) |
Formats the reason string for storage purposes. | |
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_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. | |
void | command_exclude (int argc, int last_arg, const char **argv) |
Allows the user to exclude coverage points from reporting. |
Contains functions for handling user-specified exclusion of coverage results.
void command_exclude | ( | int | argc, | |
int | last_arg, | |||
const char ** | argv | |||
) |
Allows the user to exclude coverage points from reporting.
Performs the exclude command.
argc | Number of arguments in command-line to parse | |
last_arg | Index of last parsed argument from list | |
argv | List of arguments from command-line to parse |
References bind_perform(), Catch_anonymous, COVERED_HEADER, db_close(), db_read(), db_write(), exclude_apply_exclusions(), exclude_cdd, exclude_parse_args(), FALSE, free_safe, HEADER, NORMAL, print_output(), PROFILE, PROFILE_END, READ_MODE_REPORT_NO_MERGE, str_link_delete_list(), Throw, TRUE, Try, user_msg, and USER_MSG_LENGTH.
Referenced by main().
01884 { PROFILE(COMMAND_EXCLUDE); 01885 01886 unsigned int rv; 01887 comp_cdd_cov** comp_cdds = NULL; 01888 unsigned int comp_cdd_num = 0; 01889 bool error = FALSE; 01890 01891 /* Output header information */ 01892 rv = snprintf( user_msg, USER_MSG_LENGTH, COVERED_HEADER ); 01893 assert( rv < USER_MSG_LENGTH ); 01894 print_output( user_msg, HEADER, __FILE__, __LINE__ ); 01895 01896 Try { 01897 01898 unsigned int rv; 01899 01900 /* Parse score command-line */ 01901 if( !exclude_parse_args( argc, last_arg, argv ) ) { 01902 01903 /* Read in database */ 01904 rv = snprintf( user_msg, USER_MSG_LENGTH, "Reading CDD file \"%s\"", exclude_cdd ); 01905 assert( rv < USER_MSG_LENGTH ); 01906 print_output( user_msg, NORMAL, __FILE__, __LINE__ ); 01907 01908 (void)db_read( exclude_cdd, READ_MODE_REPORT_NO_MERGE ); 01909 bind_perform( TRUE, 0 ); 01910 01911 /* Apply the specified exclusion IDs */ 01912 if( exclude_apply_exclusions() ) { 01913 rv = snprintf( user_msg, USER_MSG_LENGTH, "Writing CDD file \"%s\"", exclude_cdd ); 01914 assert( rv < USER_MSG_LENGTH ); 01915 print_output( user_msg, NORMAL, __FILE__, __LINE__ ); 01916 db_write( exclude_cdd, FALSE, FALSE ); 01917 } 01918 01919 } 01920 01921 } Catch_anonymous { 01922 error = TRUE; 01923 } 01924 01925 /* Close down the database */ 01926 db_close(); 01927 01928 /* Deallocate other allocated variables */ 01929 str_link_delete_list( excl_ids_head ); 01930 free_safe( exclude_cdd, (strlen( exclude_cdd ) + 1) ); 01931 01932 if( error ) { 01933 Throw 0; 01934 } 01935 01936 PROFILE_END; 01937 01938 }
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.
Reads the given exclude reason structure information from the line read from the CDD file.
base | Pointer to base functional unit to merge into | |
line | Pointer to the line read from the CDD file |
References func_unit_s::er_head, func_unit_s::er_tail, exclude_find_exclude_reason(), exclude_resolve_reason(), FATAL, exclude_reason_s::id, malloc_safe, merge_er_value, exclude_reason_s::next, print_output(), PROFILE, PROFILE_END, exclude_reason_s::reason, strdup_safe, Throw, exclude_reason_s::timestamp, and exclude_reason_s::type.
Referenced by db_read().
01084 { PROFILE(EXCLUDE_DB_MERGE); 01085 01086 char type; /* Specifies the type of exclusion this structure represents */ 01087 int id; /* ID of signal/expression/FSM */ 01088 int chars_read; /* Number of characters read from line */ 01089 time_t timestamp; /* Reason timestamp */ 01090 char* reason; /* Pointer to the exclusion reason from the CDD file */ 01091 01092 /*@+longintegral@*/ 01093 if( sscanf( *line, " %c %d %ld%n", &type, &id, ×tamp, &chars_read ) == 3 ) { 01094 /*@=longintegral@*/ 01095 01096 exclude_reason* er; 01097 01098 *line = *line + chars_read; 01099 01100 /* Get the reason string and remove leading whitespace */ 01101 while( (*line)[0] == ' ' ) { 01102 (*line)++; 01103 } 01104 reason = *line; 01105 assert( reason != NULL ); 01106 assert( reason[0] != '\0' ); 01107 01108 /* If the exclusion reason does not exist in the base CDD, go ahead and add it */ 01109 if( (er = exclude_find_exclude_reason( type, id, base )) == NULL ) { 01110 01111 /* Allocate and initialize the exclude reason structure */ 01112 er = (exclude_reason*)malloc_safe( sizeof( exclude_reason ) ); 01113 er->type = type; 01114 er->id = id; 01115 er->timestamp = timestamp; 01116 er->reason = strdup_safe( reason ); 01117 er->next = NULL; 01118 01119 /* Add the given exclude reason to the current functional unit list */ 01120 if( base->er_head == NULL ) { 01121 base->er_head = base->er_tail = er; 01122 } else { 01123 base->er_tail->next = er; 01124 base->er_tail = er; 01125 } 01126 01127 /* Otherwise, if the exclusion reason does exist, check for a conflict and handle it */ 01128 } else { 01129 01130 /* 01131 If the exclusion reason string does not match the current string, resolve the conflict appropriately 01132 (otherwise, just use the reason in the base functional unit). 01133 */ 01134 if( strcmp( er->reason, reason ) != 0 ) { 01135 exclude_resolve_reason( er, base, merge_er_value, reason, timestamp ); 01136 } 01137 01138 } 01139 01140 } else { 01141 01142 print_output( "CDD being read is not compatible with this version of Covered", FATAL, __FILE__, __LINE__ ); 01143 Throw 0; 01144 01145 } 01146 01147 PROFILE_END; 01148 01149 }
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.
Reads the given exclude reason structure information from the line read from the CDD file.
line | Pointer to the line read from the CDD file | |
curr_funit | Pointer to the current functional unit |
References func_unit_s::er_head, func_unit_s::er_tail, FATAL, exclude_reason_s::id, malloc_safe, exclude_reason_s::next, print_output(), PROFILE, PROFILE_END, exclude_reason_s::reason, strdup_safe, Throw, exclude_reason_s::timestamp, and exclude_reason_s::type.
Referenced by db_read().
00929 { PROFILE(EXCLUDE_DB_READ); 00930 00931 char type; /* Specifies the type of exclusion this structure represents */ 00932 int id; /* ID of signal/expression/FSM */ 00933 int chars_read; /* Number of characters read from line */ 00934 time_t timestamp; /* Reason timestamp */ 00935 00936 /*@+longintegral@*/ 00937 if( sscanf( *line, " %c %d %ld%n", &type, &id, ×tamp, &chars_read ) == 3 ) { 00938 /*@=longintegral@*/ 00939 00940 exclude_reason* er; 00941 00942 *line = *line + chars_read; 00943 00944 /* Allocate and initialize the exclude reason structure */ 00945 er = (exclude_reason*)malloc_safe( sizeof( exclude_reason ) ); 00946 er->type = type; 00947 er->id = id; 00948 er->reason = NULL; 00949 er->timestamp = timestamp; 00950 er->next = NULL; 00951 00952 /* Remove leading whitespace */ 00953 while( (*line)[0] == ' ' ) { 00954 (*line)++; 00955 } 00956 er->reason = strdup_safe( *line ); 00957 00958 /* Add the given exclude reason to the current functional unit list */ 00959 if( curr_funit->er_head == NULL ) { 00960 curr_funit->er_head = curr_funit->er_tail = er; 00961 } else { 00962 curr_funit->er_tail->next = er; 00963 curr_funit->er_tail = er; 00964 } 00965 00966 } else { 00967 00968 print_output( "CDD being read is not compatible with this version of Covered", FATAL, __FILE__, __LINE__ ); 00969 Throw 0; 00970 00971 } 00972 00973 PROFILE_END; 00974 00975 }
void exclude_db_write | ( | exclude_reason * | er, | |
FILE * | ofile | |||
) |
Outputs the given exclude reason structure to the specified file stream.
Writes the given exclude reason to the specified output stream.
er | Pointer to exclude reason structure to output | |
ofile | Pointer to output file stream |
References DB_TYPE_EXCLUDE, exclude_reason_s::id, PROFILE, PROFILE_END, exclude_reason_s::reason, exclude_reason_s::timestamp, and exclude_reason_s::type.
Referenced by funit_db_write().
00913 { PROFILE(EXCLUDE_DB_WRITE); 00914 00915 /*@+longintegral@*/ 00916 fprintf( ofile, "%d %c %d %ld %s\n", DB_TYPE_EXCLUDE, er->type, er->id, er->timestamp, er->reason ); 00917 /*@=longintegral@*/ 00918 00919 PROFILE_END; 00920 00921 }
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.
References func_unit_s::er_head, exclude_reason_s::id, exclude_reason_s::next, PROFILE, PROFILE_END, and exclude_reason_s::type.
Referenced by arc_get_transitions(), combination_get_exclude_list(), combination_list_missed(), exclude_db_merge(), exclude_merge(), exclude_print_exclusion(), line_collect(), line_display_verbose(), memory_display_verbose(), memory_get_coverage(), ovl_display_verbose(), ovl_get_coverage(), toggle_display_verbose(), and toggle_get_coverage().
00892 { PROFILE(EXCLUDE_FIND_EXCLUDE_REASON); 00893 00894 exclude_reason* er; /* Pointer to current exclude reason structure */ 00895 00896 er = funit->er_head; 00897 while( (er != NULL) && ((er->type != type) || (er->id != id)) ) { 00898 er = er->next; 00899 } 00900 00901 PROFILE_END; 00902 00903 return( er ); 00904 00905 }
char* exclude_format_reason | ( | const char * | old_str | ) |
Formats the reason string for storage purposes.
old_str | Pointer to string that needs to be formatted |
References FALSE, PROFILE, PROFILE_END, realloc_safe, strdup_safe, and TRUE.
Referenced by exclude_get_message().
01283 { PROFILE(EXCLUDE_FORMAT_REASON); 01284 01285 char* msg; /* Pointer to the reformatted message */ 01286 unsigned int msg_size; /* Current size of message array */ 01287 char c; /* Current character */ 01288 bool sp_just_seen = TRUE; /* Set to TRUE if a space character was just seen */ 01289 char str[100]; /* Temporary string */ 01290 unsigned int i; /* Loop iterator */ 01291 unsigned int index = 0; /* Index into str array to store next character */ 01292 01293 msg = strdup_safe( "" ); 01294 msg_size = 1; 01295 str[0] = '\0'; 01296 01297 if( old_str != NULL ) { 01298 01299 for( i=0; i<strlen( old_str ); i++ ) { 01300 01301 c = old_str[i]; 01302 01303 /* Convert any formatting characters to spaces */ 01304 c = ((c == '\n') || (c == '\t') || (c == '\r')) ? ' ' : c; 01305 01306 /* If the user has specified multiple formatting characters together, ignore all but the first. */ 01307 if( (c != ' ') || !sp_just_seen ) { 01308 sp_just_seen = (c == ' ') ? TRUE : FALSE; 01309 str[(index % 99) + 0] = c; 01310 str[(index % 99) + 1] = '\0'; 01311 if( ((index + 1) % 99) == 0 ) { 01312 msg = (char*)realloc_safe( msg, msg_size, (msg_size + strlen( str )) ); 01313 msg_size += strlen( str ); 01314 strcat( msg, str ); 01315 str[0] = '\0'; 01316 } 01317 index++; 01318 } 01319 01320 } 01321 01322 } 01323 01324 /* Take what's left in the str array and put it into the msg array */ 01325 if( strlen( str ) > 0 ) { 01326 msg = (char*)realloc_safe( msg, msg_size, (msg_size + strlen( str )) ); 01327 strcat( msg, str ); 01328 msg[strlen(msg)] = '\0'; 01329 } 01330 01331 PROFILE_END; 01332 01333 return( msg ); 01334 01335 }
Returns TRUE if given assertion is excluded from coverage.
funit | Pointer to functional unit containing the assertion to exclude/include | |
inst_name | Name of assertion instance to exclude/include | |
expr_id | Expression ID to exclude/include |
References funit_inst_s::child_head, curr_db, esuppl_u::excluded, statement_s::exp, FALSE, func_iter_dealloc(), func_iter_get_next_statement(), func_iter_init(), funit_inst_s::funit, expression_s::id, inst_head, inst_link_find_by_funit(), funit_inst_s::name, funit_inst_s::next, esuppl_u::part, PROFILE, PROFILE_END, expression_s::suppl, and TRUE.
00659 { PROFILE(EXCLUDE_IS_ASSERT_EXCLUDED); 00660 00661 funit_inst* inst; /* Pointer to found functional unit instance */ 00662 funit_inst* curr_child; /* Pointer to current child functional instance */ 00663 exp_link* expl; /* Pointer to current expression link */ 00664 int ignore = 0; /* Number of instances to ignore */ 00665 statement* stmt; /* Pointer to current statement */ 00666 00667 /* Find the functional unit instance that matches the description */ 00668 if( (inst = inst_link_find_by_funit( funit, db_list[curr_db]->inst_head, &ignore )) != NULL ) { 00669 00670 func_iter fi; 00671 00672 /* Find child instance */ 00673 curr_child = inst->child_head; 00674 while( (curr_child != NULL) && (strcmp( curr_child->name, inst_name ) != 0) ) { 00675 curr_child = curr_child->next; 00676 } 00677 assert( curr_child != NULL ); 00678 00679 /* Initialize the functional unit iterator */ 00680 func_iter_init( &fi, curr_child->funit, TRUE, FALSE ); 00681 00682 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->id != expr_id) ); 00683 00684 /* Deallocate functional unit statement iterator */ 00685 func_iter_dealloc( &fi ); 00686 00687 } 00688 00689 PROFILE_END; 00690 00691 return( (inst == NULL) || (stmt == NULL) || (stmt->exp->id != expr_id) || (stmt->exp->suppl.part.excluded == 1) ); 00692 00693 }
funit | Pointer to functional unit containing the expression to exclude/include | |
expr_id | Expression ID of the root expression to exclude/include | |
uline_id | Underline ID of expression to exclude/include |
References esuppl_u::excluded, statement_s::exp, expression_find_uline_id(), FALSE, func_iter_dealloc(), func_iter_get_next_statement(), func_iter_init(), expression_s::id, esuppl_u::part, PROFILE, PROFILE_END, expression_s::suppl, and TRUE.
00479 { PROFILE(EXCLUDE_IS_COMB_EXCLUDED); 00480 00481 func_iter fi; /* Functional unit iterator */ 00482 statement* stmt; /* Pointer to found statement */ 00483 expression* subexp; /* Pointer to found expression */ 00484 00485 /* Find the matching root expression */ 00486 func_iter_init( &fi, funit, TRUE, FALSE ); 00487 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->id != expr_id) ); 00488 func_iter_dealloc( &fi ); 00489 00490 if( stmt != NULL ) { 00491 subexp = expression_find_uline_id( stmt->exp, uline_id ); 00492 } 00493 00494 PROFILE_END; 00495 00496 return( (stmt == NULL) || (subexp == NULL) || (subexp->suppl.part.excluded == 1) ); 00497 00498 }
Returns TRUE if the specified FSM is excluded in the given functional unit.
funit | Pointer to functional unit containing FSM to exclude/include | |
expr_id | Expression ID of FSM | |
from_state | String form of the from_state value | |
to_state | String form of the to_state value |
References arc_find_arc(), arc_find_from_state(), arc_find_to_state(), fsm_table_s::arcs, asuppl_u::excluded, FALSE, func_unit_s::fsm_head, expression_s::id, fsm_link_s::next, asuppl_u::part, PROFILE, PROFILE_END, fsm_table_arc_s::suppl, fsm_s::table, fsm_link_s::table, fsm_s::to_state, vector_dealloc(), and vector_from_string().
00556 { PROFILE(EXCLUDE_IS_FSM_EXCLUDED); 00557 00558 fsm_link* curr_fsm; /* Pointer to current FSM structure */ 00559 int found_index; /* Index of found state transition */ 00560 00561 /* Find the corresponding table */ 00562 curr_fsm = funit->fsm_head; 00563 while( (curr_fsm != NULL) && (curr_fsm->table->to_state->id != expr_id) ) { 00564 curr_fsm = curr_fsm->next; 00565 } 00566 00567 if( curr_fsm != NULL ) { 00568 00569 vector* from_vec; 00570 vector* to_vec; 00571 int from_base, to_base; 00572 00573 /* Convert from/to state strings into vector values */ 00574 vector_from_string( &from_state, FALSE, &from_vec, &from_base ); 00575 vector_from_string( &to_state, FALSE, &to_vec, &to_base ); 00576 00577 /* Find the arc entry and perform the exclusion assignment and coverage recalculation */ 00578 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 ) ); 00579 00580 /* Deallocate vectors */ 00581 vector_dealloc( from_vec ); 00582 vector_dealloc( to_vec ); 00583 00584 } 00585 00586 PROFILE_END; 00587 00588 return( (curr_fsm == NULL) || (found_index == -1) || (curr_fsm->table->table->arcs[found_index]->suppl.part.excluded == 1) ); 00589 00590 }
Returns TRUE if the specified line is excluded in the given functional unit.
funit | Pointer to functional unit to check | |
line | Line number of line to check |
References statement_s::exp, FALSE, func_iter_dealloc(), func_iter_get_next_statement(), func_iter_init(), expression_s::line, statement_s::part, PROFILE, PROFILE_END, statement_s::suppl, and TRUE.
00351 { PROFILE(EXCLUDE_IS_LINE_EXCLUDED); 00352 00353 func_iter fi; /* Functional unit iterator */ 00354 statement* stmt; /* Pointer to current statement */ 00355 00356 func_iter_init( &fi, funit, TRUE, FALSE ); 00357 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->line != line) ); 00358 func_iter_dealloc( &fi ); 00359 00360 PROFILE_END; 00361 00362 return( (stmt == NULL) || (stmt->suppl.part.excluded == 1) ); 00363 00364 }
Returns TRUE if the specified signal is excluded in the given functional unit.
funit | Pointer to functional unit to check | |
sig_name | Name of signal to search for |
References ssuppl_u::excluded, FALSE, func_iter_dealloc(), func_iter_get_next_signal(), func_iter_init(), vsignal_s::name, ssuppl_u::part, PROFILE, PROFILE_END, vsignal_s::suppl, and TRUE.
00414 { PROFILE(EXCLUDE_IS_TOGGLE_EXCLUDED); 00415 00416 func_iter fi; /* Functional unit iterator */ 00417 vsignal* sig; /* Pointer to current signal */ 00418 00419 func_iter_init( &fi, funit, FALSE, TRUE ); 00420 while( ((sig = func_iter_get_next_signal( &fi )) != NULL) && (strcmp( sig->name, sig_name ) != 0) ); 00421 func_iter_dealloc( &fi ); 00422 00423 PROFILE_END; 00424 00425 return( (sig == NULL) || (sig->suppl.part.excluded == 1) ); 00426 00427 }
void exclude_merge | ( | func_unit * | base, | |
exclude_reason * | er | |||
) |
Performs exclusion reason merging.
Reads the given exclude reason structure information from the line read from the CDD file.
base | Pointer to base functional unit to merge into | |
er | Pointer to exclusion reason to merge |
References func_unit_s::er_head, func_unit_s::er_tail, exclude_find_exclude_reason(), exclude_resolve_reason(), exclude_reason_s::id, malloc_safe, merge_er_value, exclude_reason_s::next, PROFILE, PROFILE_END, exclude_reason_s::reason, strdup_safe, exclude_reason_s::timestamp, and exclude_reason_s::type.
Referenced by funit_merge().
01157 { PROFILE(EXCLUDE_MERGE); 01158 01159 exclude_reason* found_er; 01160 01161 /* If the exclusion reason does not exist in the base CDD, go ahead and add it */ 01162 if( (found_er = exclude_find_exclude_reason( er->type, er->id, base )) == NULL ) { 01163 01164 exclude_reason* new_er; 01165 01166 /* Allocate and initialize the exclude reason structure */ 01167 new_er = (exclude_reason*)malloc_safe( sizeof( exclude_reason ) ); 01168 new_er->type = er->type; 01169 new_er->id = er->id; 01170 new_er->timestamp = er->timestamp; 01171 new_er->reason = strdup_safe( er->reason ); 01172 new_er->next = NULL; 01173 01174 /* Add the given exclude reason to the current functional unit list */ 01175 if( base->er_head == NULL ) { 01176 base->er_head = base->er_tail = new_er; 01177 } else { 01178 base->er_tail->next = new_er; 01179 base->er_tail = new_er; 01180 } 01181 01182 /* Otherwise, if the exclusion reason does exist, check for a conflict and handle it */ 01183 } else { 01184 01185 /* 01186 If the exclusion reason string does not match the current string, resolve the conflict appropriately 01187 (otherwise, just use the reason in the base functional unit). 01188 */ 01189 if( strcmp( found_er->reason, er->reason ) != 0 ) { 01190 exclude_resolve_reason( found_er, base, merge_er_value, er->reason, er->timestamp ); 01191 } 01192 01193 } 01194 01195 PROFILE_END; 01196 01197 }
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.
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.
funit | Pointer to functional unit | |
inst_name | Name of child instance to find in given functional unit | |
expr_id | Expression ID of expression to set exclude value for | |
value | Specifies if we should exclude (1) or include (0) the specified line | |
reason | Reason for the exclusion (if value is 1) | |
stat | Pointer to statistic structure to update |
References funit_inst_s::child_head, curr_db, exclude_add_exclude_reason(), exclude_expr_assign_and_recalc(), exclude_remove_exclude_reason(), statement_s::exp, FALSE, func_iter_dealloc(), func_iter_get_next_statement(), func_iter_init(), funit_inst_s::funit, expression_s::id, inst_head, inst_link_find_by_funit(), funit_inst_s::name, funit_inst_s::next, PROFILE, PROFILE_END, and TRUE.
00707 { PROFILE(EXCLUDE_SET_ASSERT_EXCLUDE); 00708 00709 funit_inst* inst; /* Pointer to found functional unit instance */ 00710 funit_inst* curr_child; /* Pointer to current child functional instance */ 00711 exp_link* expl; /* Pointer to current expression link */ 00712 int ignore = 0; /* Number of instances to ignore */ 00713 00714 /* Find the functional unit instance that matches the description */ 00715 if( (inst = inst_link_find_by_funit( funit, db_list[curr_db]->inst_head, &ignore )) != NULL ) { 00716 00717 func_iter fi; 00718 statement* stmt; 00719 00720 /* Find child instance */ 00721 curr_child = inst->child_head; 00722 while( (curr_child != NULL) && (strcmp( curr_child->name, inst_name ) != 0) ) { 00723 curr_child = curr_child->next; 00724 } 00725 assert( curr_child != NULL ); 00726 00727 /* Initialize the functional unit iterator */ 00728 func_iter_init( &fi, curr_child->funit, TRUE, FALSE ); 00729 00730 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->id != expr_id) ); 00731 00732 assert( stmt != NULL ); 00733 00734 /* Find the signal that matches the given signal name and sets its excluded bit */ 00735 if( stmt->exp->id == expr_id ) { 00736 00737 /* Exclude/include the assertion and recalculate the summary information */ 00738 exclude_expr_assign_and_recalc( stmt->exp, curr_child->funit, (value == 1), FALSE, stat ); 00739 00740 /* Handle the exclusion reason */ 00741 if( value == 1 ) { 00742 if( reason != NULL ) { 00743 exclude_add_exclude_reason( 'A', stmt->exp->id, reason, curr_child->funit ); 00744 } 00745 } else { 00746 exclude_remove_exclude_reason( 'A', stmt->exp->id, curr_child->funit ); 00747 } 00748 00749 } 00750 00751 /* Deallocate functional unit statement iterator */ 00752 func_iter_dealloc( &fi ); 00753 00754 } 00755 00756 PROFILE_END; 00757 00758 }
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.
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.
funit | Pointer to functional unit | |
expr_id | Expression ID of root expression to set exclude value for | |
uline_id | Underline ID of expression to set exclude value for | |
value | Specifies if we should exclude (1) or include (0) the specified line | |
reason | Reason for the exclusion (if value is 1) | |
stat | Pointer to statistic structure to update |
References exclude_add_exclude_reason(), exclude_expr_assign_and_recalc(), exclude_remove_exclude_reason(), statement_s::exp, expression_find_uline_id(), FALSE, func_iter_dealloc(), func_iter_get_next_statement(), func_iter_init(), expression_s::id, PROFILE, PROFILE_END, and TRUE.
00512 { PROFILE(EXCLUDE_SET_COMB_EXCLUDE); 00513 00514 func_iter fi; /* Functional unit iterator */ 00515 statement* stmt; /* Pointer to current statement */ 00516 00517 /* Find the root expression */ 00518 func_iter_init( &fi, funit, TRUE, FALSE ); 00519 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->id != expr_id) ); 00520 func_iter_dealloc( &fi ); 00521 00522 if( stmt != NULL ) { 00523 00524 expression* subexp; 00525 00526 if( (subexp = expression_find_uline_id( stmt->exp, uline_id )) != NULL ) { 00527 00528 /* Exclude/include the expression and recalculate the summary information */ 00529 exclude_expr_assign_and_recalc( subexp, funit, (value == 1), FALSE, stat ); 00530 00531 /* Handle the exclusion reason */ 00532 if( value == 1 ) { 00533 if( reason != NULL ) { 00534 exclude_add_exclude_reason( 'E', subexp->id, reason, funit ); 00535 } 00536 } else { 00537 exclude_remove_exclude_reason( 'E', subexp->id, funit ); 00538 } 00539 00540 } 00541 00542 } 00543 00544 PROFILE_END; 00545 00546 }
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.
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.
funit | Pointer to functional unit | |
expr_id | Expression ID of output state variable | |
from_state | String containing input state value | |
to_state | String containing output state value | |
value | Specifies if we should exclude (1) or include (0) the specified line | |
reason | Reason for the exclusion (if value is 1) | |
stat | Pointer to statistics structure to update |
References arc_find_arc(), arc_find_from_state(), arc_find_to_state(), exclude_add_exclude_reason(), exclude_arc_assign_and_recalc(), exclude_remove_exclude_reason(), FALSE, func_unit_s::fsm_head, fsm_table_s::id, expression_s::id, fsm_link_s::next, PROFILE, PROFILE_END, fsm_s::table, fsm_link_s::table, fsm_s::to_state, vector_dealloc(), and vector_from_string().
00604 { PROFILE(EXCLUDE_SET_FSM_EXCLUDE); 00605 00606 fsm_link* curr_fsm; 00607 00608 /* Find the corresponding table */ 00609 curr_fsm = funit->fsm_head; 00610 while( (curr_fsm != NULL) && (curr_fsm->table->to_state->id != expr_id) ) { 00611 curr_fsm = curr_fsm->next; 00612 } 00613 00614 if( curr_fsm != NULL ) { 00615 00616 vector* from_vec; 00617 vector* to_vec; 00618 int found_index; 00619 int from_base, to_base; 00620 00621 /* Convert from/to state strings into vector values */ 00622 vector_from_string( &from_state, FALSE, &from_vec, &from_base ); 00623 vector_from_string( &to_state, FALSE, &to_vec, &to_base ); 00624 00625 /* Find the arc entry and perform the exclusion assignment and coverage recalculation */ 00626 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 ) { 00627 00628 /* Handle the exclusion and recalculate the summary values */ 00629 exclude_arc_assign_and_recalc( curr_fsm->table->table, found_index, (value == 1), stat ); 00630 00631 /* Handle the exclusion reason */ 00632 if( value == 1 ) { 00633 if( reason != NULL ) { 00634 exclude_add_exclude_reason( 'F', (curr_fsm->table->table->id + found_index), reason, funit ); 00635 } 00636 } else { 00637 exclude_remove_exclude_reason( 'F', (curr_fsm->table->table->id + found_index), funit ); 00638 } 00639 00640 } 00641 00642 /* Deallocate vectors */ 00643 vector_dealloc( from_vec ); 00644 vector_dealloc( to_vec ); 00645 00646 } 00647 00648 PROFILE_END; 00649 00650 }
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.
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.
funit | Pointer to functional unit | |
line | Line number of expression that needs to be set | |
value | Specifies if we should exclude (1) or include (0) the specified line | |
reason | Reason for the exclusion if value is 1 | |
stat | Pointer to statistics structure to update |
References exclude_add_exclude_reason(), exclude_expr_assign_and_recalc(), exclude_remove_exclude_reason(), statement_s::exp, FALSE, func_iter_dealloc(), func_iter_get_next_statement(), func_iter_init(), expression_s::id, expression_s::line, PROFILE, PROFILE_END, and TRUE.
00377 { PROFILE(EXCLUDE_SET_LINE_EXCLUDE); 00378 00379 func_iter fi; /* Functional unit iterator */ 00380 statement* stmt; /* Pointer to current statement */ 00381 00382 func_iter_init( &fi, funit, TRUE, FALSE ); 00383 00384 do { 00385 while( ((stmt = func_iter_get_next_statement( &fi )) != NULL) && (stmt->exp->line != line) ); 00386 if( stmt != NULL ) { 00387 00388 exclude_expr_assign_and_recalc( stmt->exp, funit, (value == 1), TRUE, stat ); 00389 00390 /* Handle the exclusion reason */ 00391 if( value == 1 ) { 00392 if( reason != NULL ) { 00393 exclude_add_exclude_reason( 'L', stmt->exp->id, reason, funit ); 00394 } 00395 } else { 00396 exclude_remove_exclude_reason( 'L', stmt->exp->id, funit ); 00397 } 00398 00399 } 00400 } while( stmt != NULL ); 00401 00402 func_iter_dealloc( &fi ); 00403 00404 PROFILE_END; 00405 00406 }
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.
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.
funit | Pointer to functional unit | |
sig_name | Name of signal to set the toggle exclusion for | |
value | Specifies if we should exclude (1) or include (0) the specified line | |
type | Exclusion ID type (T=toggle, M=memory) | |
reason | Reason for exclusion (if value is 1) | |
stat | Pointer to statistics structure to update |
References exclude_add_exclude_reason(), exclude_remove_exclude_reason(), exclude_sig_assign_and_recalc(), FALSE, func_iter_dealloc(), func_iter_get_next_signal(), func_iter_init(), vsignal_s::id, vsignal_s::name, PROFILE, PROFILE_END, and TRUE.
00441 { PROFILE(EXCLUDE_SET_TOGGLE_EXCLUDE); 00442 00443 func_iter fi; /* Functional unit iterator */ 00444 vsignal* sig; /* Pointer to current signal */ 00445 00446 /* Find the signal that matches the given signal name, if it exists */ 00447 func_iter_init( &fi, funit, FALSE, TRUE ); 00448 while( ((sig = func_iter_get_next_signal( &fi )) != NULL) && (strcmp( sig->name, sig_name ) != 0) ); 00449 func_iter_dealloc( &fi ); 00450 00451 /* Set its exclude bit if it exists */ 00452 if( sig != NULL ) { 00453 00454 /* Exclude/include the signal and recalculate the summary information */ 00455 exclude_sig_assign_and_recalc( sig, (value == 1), stat ); 00456 00457 /* Handle the exclusion reason */ 00458 if( value == 1 ) { 00459 if( reason != NULL ) { 00460 exclude_add_exclude_reason( type, sig->id, reason, funit ); 00461 } 00462 } else { 00463 exclude_remove_exclude_reason( type, sig->id, funit ); 00464 } 00465 00466 } 00467 00468 PROFILE_END; 00469 00470 }