#include "defines.h"
Go to the source code of this file.
Data Structures | |
| struct | func_iter_s |
Typedefs | |
| typedef func_iter_s | func_iter |
Functions | |
| void | func_iter_init (func_iter *fi, func_unit *funit, bool stmts, bool sigs) |
| Initializes the values in the given structure. | |
| statement * | func_iter_get_next_statement (func_iter *fi) |
| Provides the next statement iterator in the functional unit statement iterator. | |
| vsignal * | func_iter_get_next_signal (func_iter *fi) |
| Provides the next signal in the functional unit signal iterator. | |
| void | func_iter_dealloc (func_iter *si) |
| Deallocates functional unit iterator. | |
|
|
Structure for iterating through a functional unit and its unnamed scopes. |
|
|
Deallocates functional unit iterator. Deallocates all allocated memory for the given functional unit iterator.
00335 { PROFILE(FUNC_ITER_DEALLOC);
00336
00337 int i; /* Loop iterator */
00338
00339 if( fi != NULL ) {
00340
00341 /* Deallocate statement iterators */
00342 if( fi->sis != NULL ) {
00343
00344 /* Deallocate all statement iterators */
00345 for( i=0; i<fi->scopes; i++ ) {
00346 free_safe( fi->sis[i], sizeof( stmt_iter ) );
00347 }
00348
00349 /* Deallocate array of statement iterators */
00350 free_safe( fi->sis, (sizeof( stmt_iter* ) * fi->scopes) );
00351
00352 }
00353
00354 /* Deallocate signal array */
00355 if( fi->sigs != NULL ) {
00356
00357 /* Deallocate array of signals */
00358 free_safe( fi->sigs, (sizeof( sig_link* ) * fi->scopes) );
00359
00360 }
00361
00362 }
00363
00364 PROFILE_END;
00365
00366 }
|
|
|
Provides the next signal in the functional unit signal iterator.
00297 { PROFILE(FUNC_ITER_GET_NEXT_SIGNAL);
00298
00299 vsignal* sig;
00300
00301 assert( fi != NULL );
00302
00303 if( fi->curr_sigl != NULL ) {
00304
00305 sig = fi->curr_sigl->sig;
00306 fi->curr_sigl = fi->curr_sigl->next;
00307
00308 } else {
00309
00310 do {
00311 fi->sig_num++;
00312 } while( (fi->sig_num < fi->scopes) && (fi->sigs[fi->sig_num] == NULL) );
00313
00314 if( fi->sig_num < fi->scopes ) {
00315 sig = fi->sigs[fi->sig_num]->sig;
00316 fi->curr_sigl = fi->sigs[fi->sig_num]->next;
00317 } else {
00318 sig = NULL;
00319 fi->curr_sigl = NULL;
00320 }
00321
00322 }
00323
00324 PROFILE_END;
00325
00326 return( sig );
00327
00328 }
|
|
|
Provides the next statement iterator in the functional unit statement iterator.
00260 { PROFILE(FUNC_ITER_GET_NEXT_STATEMENT);
00261
00262 statement* stmt; /* Pointer to next statement in line order */
00263
00264 assert( fi != NULL );
00265
00266 if( fi->si_num == 0 ) {
00267
00268 stmt = NULL;
00269
00270 } else {
00271
00272 assert( fi->sis[0]->curr != NULL );
00273
00274 /* Get the statement at the head of the sorted list */
00275 stmt = fi->sis[0]->curr->stmt;
00276
00277 /* Go to the next statement in the current statement list */
00278 stmt_iter_get_next_in_order( fi->sis[0] );
00279
00280 /* Resort */
00281 func_iter_sort( fi );
00282
00283 }
00284
00285 PROFILE_END;
00286
00287 return( stmt );
00288
00289 }
|
|
||||||||||||||||||||
|
Initializes the values in the given structure. Initializes the contents of the functional unit iterator structure. This should be called before the functional unit iterator structure is populated with either statement iterator or signal information.
00223 { PROFILE(FUNC_ITER_INIT);
00224
00225 assert( fi != NULL );
00226 assert( funit != NULL );
00227
00228 /* Count the number of scopes that are within the functional unit iterator */
00229 fi->scopes = func_iter_count_scopes( funit );
00230 fi->sis = NULL;
00231 fi->sigs = NULL;
00232 fi->sig_num = 0;
00233
00234 /* Add statement iterators */
00235 if( stmts ) {
00236 fi->sis = (stmt_iter**)malloc_safe( sizeof( stmt_iter* ) * fi->scopes );
00237 fi->si_num = 0;
00238 func_iter_add_stmt_iters( fi, funit );
00239 }
00240
00241 /* Add signal lists */
00242 if( sigs ) {
00243 fi->sigs = (sig_link**)malloc_safe( sizeof( sig_link* ) * fi->scopes );
00244 fi->sig_num = 0;
00245 func_iter_add_sig_links( fi, funit );
00246 fi->sig_num = 0;
00247 fi->curr_sigl = fi->sigs[0];
00248 }
00249
00250 PROFILE_END;
00251
00252 }
|
1.3.4