Contains functions for LXT parsing/simulation. More...
Go to the source code of this file.
Functions | |
void | lxt_parse (const char *lxt_file) |
Parses and scores LXT-style dumpfile. |
Contains functions for LXT parsing/simulation.
void lxt_parse | ( | const char * | lxt_file | ) |
Parses and scores LXT-style dumpfile.
anonymous | db_do_timestep Throw Throw Throw lxt2_rd_iter_blocks |
Main LXT parsing function. Reads in an LXT-style dumpfile, tells Covered about signal information and simulation results.
lxt_file | Name of LXT file to read and score |
References Catch_anonymous, curr_inst_scope, curr_inst_scope_size, db_assign_symbol(), db_check_dumpfile_scopes(), db_do_timestep(), db_sync_curr_instance(), FALSE, FATAL, lxt2_rd_geometry::flags, free_safe, lxt2_rd_geometry::len, lxt2_rd_geometry::lsb, lxt2_rd_close(), lxt2_rd_get_alias_root(), lxt2_rd_get_fac_geometry(), lxt2_rd_get_facname(), lxt2_rd_get_num_facs(), lxt2_rd_init(), lxt2_rd_iter_blocks(), lxt2_rd_set_fac_process_mask_all(), lxt2_rd_set_max_block_mem_usage(), LXT2_RD_SYM_F_DOUBLE, LXT2_RD_SYM_F_STRING, malloc_safe, malloc_safe_nolimit, lxt2_rd_geometry::msb, lxt2_rd_trace::numfacs, print_output(), PROFILE, PROFILE_END, scope_extract_back(), symtable_create(), symtable_dealloc(), Throw, Try, vcd_callback(), vcd_prevtime, vcd_prevtime_valid, vcd_symtab_size, and vcdid().
Referenced by parse_and_score_dumpfile().
00141 { PROFILE(LXT_PARSE); 00142 00143 struct lxt2_rd_trace* lt; /* LXT read structure */ 00144 int i; /* Loop iterator */ 00145 int numfacs; /* Number of symbols in design */ 00146 struct lxt2_rd_geometry* g; 00147 lxtint32_t newindx; 00148 char netname[4096]; /* Name of current signal */ 00149 00150 /* Open LXT file for opening and extract members */ 00151 if( (lt = lxt2_rd_init( lxt_file )) != NULL ) { 00152 00153 numfacs = lxt2_rd_get_num_facs( lt ); 00154 00155 (void)lxt2_rd_set_fac_process_mask_all( lt ); 00156 (void)lxt2_rd_set_max_block_mem_usage( lt, 0 ); /* no need to cache blocks */ 00157 00158 /* Create initial symbol table */ 00159 vcd_symtab = symtable_create(); 00160 00161 /* Allocate memory for instance scope */ 00162 curr_inst_scope = (char**)malloc_safe( sizeof( char* ) ); 00163 curr_inst_scope[0] = (char*)malloc_safe( 4096 ); 00164 curr_inst_scope_size = 1; 00165 00166 Try { 00167 00168 /* Get symbol information */ 00169 for( i=0; i<numfacs; i++ ) { 00170 00171 g = lxt2_rd_get_fac_geometry( lt, i ); 00172 newindx = lxt2_rd_get_alias_root( lt, i ); 00173 00174 /* Extract scope and net name from facility name */ 00175 scope_extract_back( lxt2_rd_get_facname( lt, i ), netname, curr_inst_scope[0] ); 00176 db_sync_curr_instance(); 00177 00178 if( g->flags & LXT2_RD_SYM_F_DOUBLE ) { 00179 00180 db_assign_symbol( netname, vcdid( newindx ), 63, 0 ); 00181 00182 } else if( g->flags & LXT2_RD_SYM_F_STRING ) { 00183 00184 /* We ignore string values at the moment */ 00185 00186 } else { 00187 00188 if( g->len == 1 ) { 00189 if( g->msb != 0 ) { 00190 db_assign_symbol( netname, vcdid( newindx ), g->msb, g->msb ); 00191 } else { 00192 db_assign_symbol( netname, vcdid( newindx ), 0, 0 ); 00193 } 00194 } else { 00195 db_assign_symbol( netname, vcdid( newindx ), g->msb, g->lsb ); 00196 } 00197 00198 } 00199 00200 } 00201 00202 /* Check to see that at least one instance was found */ 00203 db_check_dumpfile_scopes(); 00204 00205 /* Create timestep symbol table array */ 00206 if( vcd_symtab_size > 0 ) { 00207 timestep_tab = malloc_safe_nolimit( sizeof( symtable*) * vcd_symtab_size ); 00208 } 00209 00210 /* Perform simulation */ 00211 (void)lxt2_rd_iter_blocks( lt, vcd_callback, NULL ); 00212 00213 /* Perform last simulation if necessary */ 00214 if( vcd_prevtime_valid ) { 00215 (void)db_do_timestep( vcd_prevtime, FALSE ); 00216 } 00217 00218 } Catch_anonymous { 00219 assert( curr_inst_scope_size == 1 ); 00220 free_safe( curr_inst_scope[0], 4096 ); 00221 free_safe( curr_inst_scope, sizeof( char* ) ); 00222 curr_inst_scope = NULL; 00223 curr_inst_scope_size = 0; 00224 symtable_dealloc( vcd_symtab ); 00225 free_safe( timestep_tab, (sizeof( symtable* ) * vcd_symtab_size) ); 00226 lxt2_rd_close( lt ); 00227 Throw 0; 00228 } 00229 00230 /* Deallocate memory */ 00231 assert( curr_inst_scope_size == 1 ); 00232 free_safe( curr_inst_scope[0], 4096 ); 00233 free_safe( curr_inst_scope, sizeof( char* ) ); 00234 curr_inst_scope = NULL; 00235 curr_inst_scope_size = 0; 00236 symtable_dealloc( vcd_symtab ); 00237 free_safe( timestep_tab, (sizeof( symtable* ) * vcd_symtab_size) ); 00238 00239 /* Close LXT file */ 00240 lxt2_rd_close( lt ); 00241 00242 } else { 00243 00244 print_output( "Unable to read data from LXT dumpfile. Exiting without scoring.", FATAL, __FILE__, __LINE__ ); 00245 Throw 0; 00246 00247 } 00248 00249 PROFILE_END; 00250 00251 }