/* * return 1 if obj inside inst */ int mei_isinside(handle inst, handle obj) { handle parent; for (parent = acc_handle_parent(obj); parent != NULL; parent = acc_handle_parent(parent)) { if (acc_compare_handles(parent, inst)) return(1); } return(0); }
/* * count and list all acc world (prim terminal) drivers */ void mei_count_drivers(handle inst, handle net) { int count = 0; handle term; char s1[1024], s2[1024]; io_printf(" ... processing drivers for %s:\n", acc_fetch_fullname(net)); for (term = acc_next_driver(net, NULL); term != NULL; term = acc_next_driver(net, term)) { if (mei_isinside(inst, term) == 1) { strcpy(s1, "inside"); count++; } else strcpy(s1, "outside"); if (acc_fetch_type(term) == accTerminal) { sprintf(s2, "prim %s port %d", acc_fetch_fullname(acc_handle_parent(term)), acc_fetch_index(term)); } else strcpy(s2, acc_fetch_fullname(term)); io_printf(" +++ %s is %s driver of %s in %s.\n", s2, s1, acc_fetch_fullname(net), acc_fetch_fullname(inst)); } io_printf("net %s has %d inside drivers.\n", acc_fetch_name(net), count); }
/************************************************* lxt2_recordvars - add objects to be recorded ************************************************/ int lxt2_recordvars( int data, int reason ) { int update = 0; int objects = 0; int i; acc_initialize(); switch( reason ) { case reason_calltf: break; case reason_checktf: goto DONE; case reason_finish: if( lxt.inited ) { lxt2_close(); } goto DONE; case reason_rosynch: update = (lxt.updateList != NULL); while( lxt.updateList ) { info_p info; info = lxt.updateList; lxt2_dump( info, 0 ); lxt.updateList = info->updateNext; info->updateNext = 0; } if( update ) { lxt2_timemarkerp1(); } while( lxt.eventList ) { info_p info; info = lxt.eventList; lxt2_dump( info, 1 ); lxt.eventList = info->updateNext; info->updateNext = 0; } lxt2_nexttimemarker(); goto DONE; default: goto DONE; } ginstance = tf_getinstance(); /* * parse options first */ for( i = 1; i <= tf_nump(); ++i ) { handle object; if( tf_typep(i) == tf_nullparam ) { continue; } if( tf_typep(i) == tf_string ) { char* str = acc_fetch_tfarg_str(i); lxt2_option( str ); continue; } } /* * on first call, initialize structure */ if( !lxt.inited ) { lxt2_init(); } for( i = 1; i <= tf_nump(); ++i ) { handle object; if( tf_typep(i) == tf_nullparam ) { continue; } if( tf_typep(i) == tf_string ) { continue; } object = acc_handle_tfarg(i); if( !object ) { tf_error( "cannot find object" ); tf_dofinish(); goto DONE; } lxt2_add( object, lxt.depth ); objects++; } if( objects == 0 ) { #if DEBUG io_printf( "lxt2_recordvars: defaultpath=%s\n", acc_fetch_fullname(acc_handle_parent(acc_handle_tfinst())), lxt.depth ); #endif lxt2_add( acc_handle_parent(acc_handle_tfinst()), lxt.depth ); } lxt2_dump( lxt.objectList, 1 ); DONE: acc_close(); return 0; }