Go to the source code of this file.
Functions | |
| void | lxt_parse (const char *lxt_file) |
| Parses and scores LXT-style dumpfile. | |
|
|
Parses and scores LXT-style dumpfile.
00144 { PROFILE(LXT_PARSE);
00145
00146 struct lxt2_rd_trace* lt; /* LXT read structure */
00147 int i; /* Loop iterator */
00148 int numfacs; /* Number of symbols in design */
00149 struct lxt2_rd_geometry* g;
00150 lxtint32_t newindx;
00151 char netname[4096]; /* Name of current signal */
00152
00153 /* Open LXT file for opening and extract members */
00154 if( (lt = lxt2_rd_init( lxt_file )) != NULL ) {
00155
00156 numfacs = lxt2_rd_get_num_facs( lt );
00157
00158 (void)lxt2_rd_set_fac_process_mask_all( lt );
00159 (void)lxt2_rd_set_max_block_mem_usage( lt, 0 ); /* no need to cache blocks */
00160
00161 /* Create initial symbol table */
00162 vcd_symtab = symtable_create();
00163
00164 /* Allocate memory for instance scope */
00165 curr_inst_scope = (char**)malloc_safe( sizeof( char* ) );
00166 curr_inst_scope[0] = (char*)malloc_safe( 4096 );
00167 curr_inst_scope_size = 1;
00168
00169 Try {
00170
00171 /* Get symbol information */
00172 for( i=0; i<numfacs; i++ ) {
00173
00174 g = lxt2_rd_get_fac_geometry( lt, i );
00175 newindx = lxt2_rd_get_alias_root( lt, i );
00176
00177 /* Extract scope and net name from facility name */
00178 scope_extract_back( lxt2_rd_get_facname( lt, i ), netname, curr_inst_scope[0] );
00179 db_sync_curr_instance();
00180
00181 if( g->flags & LXT2_RD_SYM_F_DOUBLE ) {
00182
00183 db_assign_symbol( netname, vcdid( newindx ), 63, 0 );
00184
00185 } else if( g->flags & LXT2_RD_SYM_F_STRING ) {
00186
00187 /* We ignore string values at the moment */
00188
00189 } else {
00190
00191 if( g->len == 1 ) {
00192 if( g->msb != 0 ) {
00193 db_assign_symbol( netname, vcdid( newindx ), g->msb, g->msb );
00194 } else {
00195 db_assign_symbol( netname, vcdid( newindx ), 0, 0 );
00196 }
00197 } else {
00198 db_assign_symbol( netname, vcdid( newindx ), g->msb, g->lsb );
00199 }
00200
00201 }
00202
00203 }
00204
00205 /* Check to see that at least one instance was found */
00206 if( !one_instance_found ) {
00207
00208 print_output( "No instances were found in specified VCD file that matched design", FATAL, __FILE__, __LINE__ );
00209
00210 /* If the -i option was not specified, let the user know */
00211 if( !instance_specified ) {
00212 print_output( " Please use -i option to specify correct hierarchy to top-level module to score",
00213 FATAL, __FILE__, __LINE__ );
00214 } else {
00215 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, " Incorrect hierarchical path specified in -i option: %s", top_instance );
00216 assert( rv < USER_MSG_LENGTH );
00217 print_output( user_msg, FATAL, __FILE__, __LINE__ );
00218 }
00219
00220 Throw 0;
00221
00222 }
00223
00224 /* Create timestep symbol table array */
00225 if( vcd_symtab_size > 0 ) {
00226 timestep_tab = malloc_safe_nolimit( sizeof( symtable*) * vcd_symtab_size );
00227 }
00228
00229 /* Perform simulation */
00230 (void)lxt2_rd_iter_blocks( lt, vcd_callback, NULL );
00231
00232 /* Perform last simulation if necessary */
00233 if( vcd_prevtime_valid ) {
00234 (void)db_do_timestep( vcd_prevtime, FALSE );
00235 }
00236
00237 } Catch_anonymous {
00238 assert( curr_inst_scope_size == 1 );
00239 free_safe( curr_inst_scope[0], 4096 );
00240 free_safe( curr_inst_scope, sizeof( char* ) );
00241 curr_inst_scope = NULL;
00242 curr_inst_scope_size = 0;
00243 symtable_dealloc( vcd_symtab );
00244 free_safe( timestep_tab, (sizeof( symtable* ) * vcd_symtab_size) );
00245 lxt2_rd_close( lt );
00246 Throw 0;
00247 }
00248
00249 /* Deallocate memory */
00250 assert( curr_inst_scope_size == 1 );
00251 free_safe( curr_inst_scope[0], 4096 );
00252 free_safe( curr_inst_scope, sizeof( char* ) );
00253 curr_inst_scope = NULL;
00254 curr_inst_scope_size = 0;
00255 symtable_dealloc( vcd_symtab );
00256 free_safe( timestep_tab, (sizeof( symtable* ) * vcd_symtab_size) );
00257
00258 /* Close LXT file */
00259 lxt2_rd_close( lt );
00260
00261 } else {
00262
00263 print_output( "Unable to read data from LXT dumpfile. Exiting without scoring.", FATAL, __FILE__, __LINE__ );
00264 Throw 0;
00265
00266 }
00267
00268 PROFILE_END;
00269
00270 }
|
1.3.4