/* * routine to get and zero all delays in design */ int process_all_insts(int reason, int udata) { handle topinst; for (topinst = NULL;;) { if ((topinst = acc_next_child(NULL, topinst)) == NULL) break; process_inst(topinst); } io_printf(" >>> All instances processed\n"); return(0); }
handle next_level(handle h, int l) { handle child_handle; if (l == 0) return null; child_handle = null; while (child_handle = acc_next_child (h, child_handle)) { next_level (child_handle, l-1); fprintf (fp, "%s\n", acc_fetch_fullname (child_handle)); } }
/* * process one instance and recursively process all under instances * processing is top down depth first */ static void process_inst(handle up_ihref) { int isiz; handle ihref; /* iproc_rtn(up_ihref); */ isiz = acc_count(acc_next_child, up_ihref); io_printf(" There are %d instances in %s.\n", isiz, acc_fetch_fullname(up_ihref)); for (ihref = NULL;;) { if ((ihref = acc_next_child(up_ihref, ihref)) == NULL) return; process_inst(ihref); } }
/* * process instance from top */ int process_all_insts(int reason, int udata) { int isiz; handle topiref; isiz = acc_count(acc_next_child, NULL); io_printf(" There are %d top level modules.\n", isiz); /* iproc_rtn = ???; */ /* build the iterator for each module */ for (topiref = NULL;;) { if ((topiref = acc_next_child(NULL, topiref)) == NULL) break; process_inst(topiref); } io_printf(" >>> All instances processed by acc_.\n"); return(0); }
/* * process one instance and recursively process all under instances * processing is top down depth first */ static void process_inst(handle upinst) { handle inst, net; io_printf("... processing instance %s.\n", acc_fetch_fullname(upinst)); for (net = acc_next_net(upinst, NULL); net != NULL; net = acc_next_net(upinst, net)) { mei_count_drivers(upinst, net); mei_count_loads(upinst, net); mei_count_cellloads(upinst, net); } for (inst = NULL;;) { if ((inst = acc_next_child(upinst, inst)) == NULL) return; process_inst(inst); } }
/************************************************* lxt2_add - add object to file ************************************************/ static void lxt2_add( handle object, int depth ) { int real = 0; int event = 0; int flags; int msb; int lsb; info_p info; handle block; handle term; static int filter[] = { accIntegerVar, accNamedEvent, accNet, accRealVar, accRegister, accTimeVar, 0 }; switch( acc_fetch_type(object) ) { case accNamedEvent: flags = LXT2_WR_SYM_F_BITS; event = 1; break; case accRealVar: flags = LXT2_WR_SYM_F_DOUBLE; real = 1; break; case accIntegerVar: case accNet: case accPort: case accReg: case accTimeVar: case accParameter: flags = LXT2_WR_SYM_F_BITS; break; case accStatement: case accTask: case accModule: term = null; while(1) { term = acc_next( filter, object, term ); if( term == null ) { break; } lxt2_add( term, depth ); } if( depth == 1 ) { return; } block = null; while(1) { block = acc_next_child( object, block ); if( block == null ) { break; } lxt2_add( block, (depth==0) ? 0 : depth-1 ); } return; default: return; } info = (info_p)malloc( sizeof(info_t) ); if( !info ) { tf_error( "cannot allocate memory" ); tf_dofinish(); return; } info->object = object; info->name = strdup( acc_fetch_fullname(object) ); info->next = lxt.objectList; lxt.objectList = info; info->sequence = lxt.sequence; info->event = event; info->real = real; info->updateNext = 0; if( real ) { info->symbol = lxt2_wr_symbol_add( lxt.t, info->name, 0, 0, 0, flags ); } else if( event ) { info->symbol = lxt2_wr_symbol_add( lxt.t, info->name, 0, 0, 0, flags ); } else { acc_fetch_range( object, &msb, &lsb ); #if DEBUG io_printf( "lxt2_add: %s [ %d : %d ]\n", info->name, msb, lsb ); #endif info->symbol = lxt2_wr_symbol_add( lxt.t, info->name, 0, msb, lsb, flags ); } acc_vcl_add( object, lxt2_changed, (char*)info, vcl_verilog_logic ); #if DEBUG io_printf( "lxt2_recordvars: adding %p %s\n", info->symbol, info->name ); #endif }
/* * process one instance and recursively process all under instances * processing is top down depth first */ static int process_inst(handle upinst) { handle scope, inst, net, bit, var, prim, term, port; static int varlist[] = { accReg, accIntegerVar, accTimeVar, 0 }; io_printf("... setting up vcls for instance %s\n", acc_fetch_fullname(upinst)); /* first strength vcls on all nets */ /* first add vcls for nets */ io_printf("... vcls for wires\n"); for (net = acc_next_net(upinst, NULL); net != NULL; net = acc_next_net(upinst, net)) { if (acc_fetch_size(net) == 1) add_vcl(net); else { /* for vector wires, must put vcl on bit - need to access strength */ for (bit = acc_next_bit(net, NULL); bit != NULL; bit = acc_next_bit(net, bit)) add_vcl(bit); } } /* then variables */ io_printf("... vcls for variables\n"); for (var = acc_next(varlist, upinst, NULL); var != NULL; var = acc_next(varlist, upinst, var)) add_vcl(var); io_printf("... vcls for primitive terminals\n"); /* then primitives output terminals */ for (prim = acc_next_primitive(upinst, NULL); prim != NULL; prim = acc_next_primitive(upinst, prim)) { for (term = acc_next_terminal(prim, NULL); term != NULL; term = acc_next_terminal(prim, term)) { /* only output terminals can have vcl added */ if (acc_fetch_direction(term) == accInput) continue; add_vcl(term); } } /* then module ports */ io_printf("... vcls for ports\n"); for (port = acc_next_port(upinst, NULL); port != NULL; port = acc_next_port(upinst, port)) { if (acc_fetch_size(port) == 1) add_vcl(port); else { /* for vector ports, must put vcl on bit - need to access strength */ for (bit = acc_next_bit(port, NULL); bit != NULL; bit = acc_next_bit(port, bit)) add_vcl(bit); } } /* finally all variables in contained scopes */ for (scope = acc_next_scope(upinst, NULL); scope != NULL; scope = acc_next_scope(upinst, scope)) { /* final step setup vcls for contained scopes */ setup_1scope_chgcbs(scope); } for (inst = NULL;;) { if ((inst = acc_next_child(upinst, inst)) == NULL) break; process_inst(inst); } return(0); }