Contains functions for parsing Verilog modules. More...
#include "defines.h"
Go to the source code of this file.
Functions | |
void | parse_design (const char *top, const char *output_db) |
Parses the specified design and generates scoring modules. | |
void | parse_and_score_dumpfile (const char *db, const char *dump_file, int dump_mode) |
Parses VCD dumpfile and scores design. |
Contains functions for parsing Verilog modules.
void parse_and_score_dumpfile | ( | const char * | db, | |
const char * | dump_file, | |||
int | dump_mode | |||
) |
Parses VCD dumpfile and scores design.
anonymous | db_do_timestep Throw vcd_parse bind_perform db_read lxt_parse db_write |
Reads in specified CDD database file, reads in specified dumpfile in the specified format, performs re-simulation and writes the scored design back to the specified CDD database file for merging or reporting.
db | Name of output database file to generate | |
dump_file | Name of dumpfile to parse for scoring | |
dump_mode | Type of dumpfile being used (see Dumpfile Format for legal values) |
References bind_perform(), Catch_anonymous, db_do_timestep(), db_read(), db_write(), DEBUG, debug_mode, DUMP_FMT_FST, DUMP_FMT_LXT, DUMP_FMT_VCD, FALSE, fst_parse(), lxt_parse(), isuppl_u::part, print_output(), PROFILE, PROFILE_END, READ_MODE_NO_MERGE, isuppl_u::scored, sim_dealloc(), sim_initialize(), Throw, TRUE, Try, user_msg, USER_MSG_LENGTH, and vcd_parse().
Referenced by command_score().
00243 { PROFILE(PARSE_AND_SCORE_DUMPFILE); 00244 00245 assert( dump_file != NULL ); 00246 00247 Try { 00248 00249 #ifdef DEBUG_MODE 00250 if( debug_mode ) { 00251 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "======== Reading in database %s ========\n", db ); 00252 assert( rv < USER_MSG_LENGTH ); 00253 print_output( user_msg, DEBUG, __FILE__, __LINE__ ); 00254 } 00255 #endif 00256 00257 /* Read in contents of specified database file */ 00258 (void)db_read( db, READ_MODE_NO_MERGE ); 00259 00260 /* Bind expressions to signals/functional units */ 00261 bind_perform( TRUE, 0 ); 00262 00263 /* Add static values to simulator */ 00264 sim_initialize(); 00265 00266 #ifdef DEBUG_MODE 00267 if( debug_mode ) { 00268 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "======== Reading in VCD dumpfile %s ========\n", dump_file ); 00269 assert( rv < USER_MSG_LENGTH ); 00270 print_output( user_msg, DEBUG, __FILE__, __LINE__ ); 00271 } 00272 #endif 00273 00274 /* Perform the parse */ 00275 switch( dump_mode ) { 00276 case DUMP_FMT_VCD : vcd_parse( dump_file ); break; 00277 case DUMP_FMT_LXT : lxt_parse( dump_file ); break; 00278 case DUMP_FMT_FST : fst_parse( dump_file ); break; 00279 default : assert( (dump_mode == DUMP_FMT_VCD) || (dump_mode == DUMP_FMT_LXT) || (dump_mode == DUMP_FMT_FST) ); 00280 } 00281 00282 /* Flush any pending statement trees that are waiting for delay */ 00283 (void)db_do_timestep( 0, TRUE ); 00284 00285 #ifdef DEBUG_MODE 00286 if( debug_mode ) { 00287 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "======== Writing database %s ========\n", db ); 00288 assert( rv < USER_MSG_LENGTH ); 00289 print_output( user_msg, DEBUG, __FILE__, __LINE__ ); 00290 } 00291 #endif 00292 00293 /* Indicate that this CDD contains scored information */ 00294 info_suppl.part.scored = 1; 00295 00296 /* Write contents to database file */ 00297 db_write( db, FALSE, FALSE ); 00298 00299 } Catch_anonymous { 00300 sim_dealloc(); 00301 Throw 0; 00302 } 00303 00304 /* Deallocate simulator stuff */ 00305 sim_dealloc(); 00306 00307 PROFILE_END; 00308 00309 }
void parse_design | ( | const char * | top, | |
const char * | output_db | |||
) |
Parses the specified design and generates scoring modules.
anonymous | fsm_var_bind race_check_modules Throw bind_perform db_write |
Resets the lexer and parses all Verilog files specified in use_files list. After all design files are parsed, their information will be appropriately stored in the associated lists.
top | Name of top-level module to score | |
output_db | Name of output directory for generated scored files |
References bind_perform(), Catch_anonymous, db_check_for_top_module(), db_close(), db_write(), DEBUG, debug_mode, dumpvars_file, error_count, FALSE, FATAL, FATAL_WRAP, flag_check_races, fsm_var_bind(), fsm_var_cleanup(), instance_specified, NORMAL, parser_dealloc_sig_range(), ppfilename, print_output(), PROFILE, PROFILE_END, race_check_modules(), reset_lexer(), score_generate_top_dumpvars_module(), sim_dealloc(), stmt_blk_remove(), str_link_add(), strdup_safe, Throw, top_module, TRUE, Try, user_msg, USER_MSG_LENGTH, VLparse(), WARNING, and WARNING_WRAP.
Referenced by command_score().
00106 { PROFILE(PARSE_DESIGN); 00107 00108 Try { 00109 00110 (void)str_link_add( strdup_safe( top ), &modlist_head, &modlist_tail ); 00111 00112 if( use_files_head != NULL ) { 00113 00114 int parser_ret; 00115 00116 /* Initialize lexer with first file */ 00117 reset_lexer( use_files_head ); 00118 00119 Try { 00120 00121 /* Parse the design -- if we catch an exception, remove the temporary ppfilename */ 00122 parser_ret = VLparse(); 00123 00124 if( (parser_ret != 0) || (error_count > 0) ) { 00125 print_output( "Error in parsing design", FATAL, __FILE__, __LINE__ ); 00126 Throw 0; 00127 } 00128 00129 } Catch_anonymous { 00130 (void)unlink( ppfilename ); 00131 parser_dealloc_sig_range( &curr_urange, FALSE ); 00132 parser_dealloc_sig_range( &curr_prange, FALSE ); 00133 Throw 0; 00134 } 00135 00136 /* Deallocate any memory in curr_range variable */ 00137 parser_dealloc_sig_range( &curr_urange, FALSE ); 00138 parser_dealloc_sig_range( &curr_prange, FALSE ); 00139 00140 #ifdef DEBUG_MODE 00141 if( debug_mode ) { 00142 print_output( "======== Completed design parsing ========\n", DEBUG, __FILE__, __LINE__ ); 00143 } 00144 #endif 00145 00146 /* Check to make sure that the -t and -i options were specified correctly */ 00147 if( db_check_for_top_module() ) { 00148 if( instance_specified ) { 00149 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Module specified with -t option (%s) is a top-level module.", top_module ); 00150 assert( rv < USER_MSG_LENGTH ); 00151 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00152 print_output( "The -i option should not have been specified", FATAL_WRAP, __FILE__, __LINE__ ); 00153 Throw 0; 00154 } 00155 } else { 00156 if( !instance_specified ) { 00157 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Module specified with -t option (%s) is not a top-level module.", top_module ); 00158 assert( rv < USER_MSG_LENGTH ); 00159 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00160 print_output( "The -i option must be specified to provide the hierarchy to the module specified with", FATAL_WRAP, __FILE__, __LINE__ ); 00161 print_output( "the -t option.", FATAL_WRAP, __FILE__, __LINE__ ); 00162 Throw 0; 00163 } 00164 } 00165 00166 /* Perform all signal/expression binding */ 00167 bind_perform( FALSE, 0 ); 00168 fsm_var_bind(); 00169 00170 /* Perform race condition checking */ 00171 if( flag_check_races ) { 00172 print_output( "\nChecking for race conditions...", NORMAL, __FILE__, __LINE__ ); 00173 race_check_modules(); 00174 } else { 00175 print_output( "The -rI option was specified in the command-line, causing Covered to skip race condition", WARNING, __FILE__, __LINE__ ); 00176 print_output( "checking; therefore, coverage information may not be accurate if actual race conditions", WARNING_WRAP, __FILE__, __LINE__ ); 00177 print_output( "do exist. Proceed at your own risk!", WARNING_WRAP, __FILE__, __LINE__ ); 00178 } 00179 00180 /* Remove all statement blocks that cannot be considered for coverage */ 00181 stmt_blk_remove(); 00182 00183 #ifdef DEBUG_MODE 00184 if( debug_mode ) { 00185 print_output( "======== Completed race condition checking ========\n", DEBUG, __FILE__, __LINE__ ); 00186 } 00187 #endif 00188 00189 } else { 00190 00191 print_output( "No Verilog input files specified", FATAL, __FILE__, __LINE__ ); 00192 Throw 0; 00193 00194 } 00195 00196 /* Output the dumpvars module, if specified. */ 00197 if( dumpvars_file != NULL ) { 00198 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Outputting dumpvars file %s...", dumpvars_file ); 00199 assert( rv < USER_MSG_LENGTH ); 00200 print_output( user_msg, NORMAL, __FILE__, __LINE__ ); 00201 score_generate_top_dumpvars_module( dumpvars_file ); 00202 } 00203 00204 /* Write contents to baseline database file. */ 00205 db_write( output_db, TRUE, TRUE ); 00206 00207 } Catch_anonymous { 00208 fsm_var_cleanup(); 00209 sim_dealloc(); 00210 db_close(); 00211 Throw 0; 00212 } 00213 00214 /* Deallocate simulator stuff */ 00215 sim_dealloc(); 00216 00217 /* Close database */ 00218 db_close(); 00219 00220 #ifdef DEBUG_MODE 00221 if( debug_mode ) { 00222 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "======== Design written to database %s successfully ========\n\n", output_db ); 00223 assert( rv < USER_MSG_LENGTH ); 00224 print_output( user_msg, DEBUG, __FILE__, __LINE__ ); 00225 } 00226 #endif 00227 00228 PROFILE_END; 00229 00230 }