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

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


Detailed Description

Contains functions for handling user-specified exclusion of coverage results.

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

#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_reasonexclude_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.


Function Documentation

void command_exclude int  argc,
int  last_arg,
const char **  argv
 

Allows the user to exclude coverage points from reporting.

Performs the exclude command.

Parameters:
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

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 }   

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.

Parameters:
base  Pointer to base functional unit to merge into
line  Pointer to 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, &timestamp, &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 }

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.

Parameters:
line  Pointer to the line read from the CDD file
curr_funit  Pointer to the current functional unit

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, &timestamp, &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 }

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.

Parameters:
er  Pointer to exclude reason structure to output
ofile  Pointer to output file stream

00909   { PROFILE(EXCLUDE_DB_WRITE);
00910 
00911   /*@+longintegral@*/
00912   fprintf( ofile, "%d %c %d %ld %s\n", DB_TYPE_EXCLUDE, er->type, er->id, er->timestamp, er->reason );
00913   /*@=longintegral@*/
00914 
00915   PROFILE_END;
00916 
00917 }

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.

Returns:
Returns a pointer to the found exclusion reason that matches the given type and ID; otherwise, returns a value of 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 }

char* exclude_format_reason const char *  old_str  ) 
 

Formats the reason string for storage purposes.

Returns:
Returns the reformatted string that removes all newlines and extra spaces.
Parameters:
old_str  Pointer to string that needs to be formatted

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 } 

bool exclude_is_assert_excluded func_unit funit,
char *  inst_name,
int  expr_id
 

Returns TRUE if given assertion is excluded from coverage.

Returns:
Returns TRUE if the given assertion is excluded from coverage consideration; otherwise, returns FALSE.
Parameters:
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

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 }

bool exclude_is_comb_excluded func_unit funit,
int  expr_id,
int  uline_id
 

Returns:
Returns TRUE if specified underlined expression is excluded from coverage; otherwise, returns FALSE.
Parameters:
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

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 }

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.

Returns:
Returns TRUE if the given FSM state transition was excluded from coverage; otherwise, returns FALSE.
Parameters:
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

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 }

bool exclude_is_line_excluded func_unit funit,
int  line
 

Returns TRUE if the specified line is excluded in the given functional unit.

Returns:
Returns TRUE if the specified line is excluded in the given functional unit; otherwise, returns FALSE.
Parameters:
funit  Pointer to functional unit to check
line  Line number of line to check

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 }

bool exclude_is_toggle_excluded func_unit funit,
char *  sig_name
 

Returns TRUE if the specified signal is excluded in the given functional unit.

Returns:
Returns TRUE if the specified signal is excluded from coverage consideration; otherwise, returns FALSE.
Parameters:
funit  Pointer to functional unit to check
sig_name  Name of signal to search for

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 }

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.

Parameters:
base  Pointer to base functional unit to merge into
er  Pointer to exclusion reason to merge

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 }

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.

Parameters:
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

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 }

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.

Parameters:
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

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 }

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.

Parameters:
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

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 }

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.

Parameters:
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

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 }

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.

Parameters:
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

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 }


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