|
|
|
@ -1,3 +1,4 @@ |
|
|
|
// (diff buffer-file-name "dctran.c" "-b -w -U2") |
|
|
|
/********** |
|
|
|
Author: 2010-05 Stefano Perticaroli ``spertica'' |
|
|
|
**********/ |
|
|
|
@ -54,7 +55,7 @@ DCpss(CKTcircuit *ckt, int restart) |
|
|
|
int i; |
|
|
|
double olddelta; |
|
|
|
double delta; |
|
|
|
double new; |
|
|
|
double newdelta; |
|
|
|
double startdTime; |
|
|
|
double startsTime; |
|
|
|
double startlTime; |
|
|
|
@ -84,13 +85,13 @@ DCpss(CKTcircuit *ckt, int restart) |
|
|
|
long type = MT_TRANAN, length = 1; |
|
|
|
#endif /* PARALLEL_ARCH */ |
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - add - wbk - 12/19/90 - Add IPC stuff */ |
|
|
|
/* gtri - add - wbk - 12/19/90 - Add IPC stuff */ |
|
|
|
Ipc_Boolean_t ipc_firsttime = IPC_TRUE; |
|
|
|
Ipc_Boolean_t ipc_secondtime = IPC_FALSE; |
|
|
|
Ipc_Boolean_t ipc_delta_cut = IPC_FALSE; |
|
|
|
double ipc_last_time = 0.0; |
|
|
|
double ipc_last_delta = 0.0; |
|
|
|
/* gtri - end - wbk - 12/19/90 - Add IPC stuff */ |
|
|
|
/* gtri - end - wbk - 12/19/90 - Add IPC stuff */ |
|
|
|
#endif |
|
|
|
#ifdef CLUSTER |
|
|
|
int redostep; |
|
|
|
@ -158,18 +159,17 @@ DCpss(CKTcircuit *ckt, int restart) |
|
|
|
ckt->CKTbreakSize=2; |
|
|
|
|
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - begin - wbk - 12/19/90 - Modify setting of CKTminBreak */ |
|
|
|
/* gtri - begin - wbk - 12/19/90 - Modify setting of CKTminBreak */ |
|
|
|
/* if(ckt->CKTminBreak==0) ckt->CKTminBreak=ckt->CKTmaxStep*5e-5; */ |
|
|
|
/* Set to 10 times delmin for ATESSE 1 compatibity */ |
|
|
|
if(ckt->CKTminBreak==0) ckt->CKTminBreak = 10.0 * ckt->CKTdelmin; |
|
|
|
/* gtri - end - wbk - 12/19/90 - Modify setting of CKTminBreak */ |
|
|
|
/* gtri - end - wbk - 12/19/90 - Modify setting of CKTminBreak */ |
|
|
|
#else |
|
|
|
if(ckt->CKTminBreak==0) ckt->CKTminBreak=ckt->CKTmaxStep*5e-5; |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - add - wbk - 12/19/90 - Add IPC stuff and set anal_init and anal_type */ |
|
|
|
|
|
|
|
/* gtri - add - wbk - 12/19/90 - Add IPC stuff and set anal_init and anal_type */ |
|
|
|
/* Tell the beginPlot routine what mode we're in */ |
|
|
|
g_ipc.anal_type = IPC_ANAL_TRAN; |
|
|
|
|
|
|
|
@ -177,8 +177,7 @@ DCpss(CKTcircuit *ckt, int restart) |
|
|
|
g_mif_info.circuit.anal_type = MIF_DC; |
|
|
|
|
|
|
|
g_mif_info.circuit.anal_init = MIF_TRUE; |
|
|
|
|
|
|
|
/* gtri - end - wbk */ |
|
|
|
/* gtri - end - wbk */ |
|
|
|
#endif |
|
|
|
error = CKTnames(ckt,&numNames,&nameList); |
|
|
|
if(error) return(error); |
|
|
|
@ -198,13 +197,13 @@ DCpss(CKTcircuit *ckt, int restart) |
|
|
|
save_mode = (ckt->CKTmode&MODEUIC)|MODETRANOP | MODEINITJCT; |
|
|
|
save_order = ckt->CKTorder; |
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - begin - wbk - set a breakpoint at end of supply ramping time */ |
|
|
|
/* gtri - begin - wbk - set a breakpoint at end of supply ramping time */ |
|
|
|
/* must do this after CKTtime set to 0 above */ |
|
|
|
if(ckt->enh->ramp.ramptime > 0.0) |
|
|
|
CKTsetBreak(ckt, ckt->enh->ramp.ramptime); |
|
|
|
/* gtri - end - wbk - set a breakpoint at end of supply ramping time */ |
|
|
|
/* gtri - end - wbk - set a breakpoint at end of supply ramping time */ |
|
|
|
|
|
|
|
/* gtri - begin - wbk - Call EVTop if event-driven instances exist */ |
|
|
|
/* gtri - begin - wbk - Call EVTop if event-driven instances exist */ |
|
|
|
if(ckt->evt->counts.num_insts != 0) { |
|
|
|
/* use new DCOP algorithm */ |
|
|
|
converged = EVTop(ckt, |
|
|
|
@ -216,13 +215,14 @@ DCpss(CKTcircuit *ckt, int restart) |
|
|
|
|
|
|
|
EVTop_save(ckt, MIF_FALSE, 0.0); |
|
|
|
|
|
|
|
/* gtri - end - wbk - Call EVTop if event-driven instances exist */ |
|
|
|
/* gtri - end - wbk - Call EVTop if event-driven instances exist */ |
|
|
|
} else |
|
|
|
#endif |
|
|
|
converged = CKTop(ckt, |
|
|
|
(ckt->CKTmode & MODEUIC)|MODETRANOP| MODEINITJCT, |
|
|
|
(ckt->CKTmode & MODEUIC)|MODETRANOP| MODEINITFLOAT, |
|
|
|
ckt->CKTdcMaxIter); |
|
|
|
|
|
|
|
#ifdef STEPDEBUG |
|
|
|
if(converged != 0) { |
|
|
|
fprintf(stdout,"\nTransient solution failed -\n"); |
|
|
|
@ -243,36 +243,36 @@ DCpss(CKTcircuit *ckt, int restart) |
|
|
|
fflush(stdout); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
if(converged != 0) return(converged); |
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - add - wbk - 12/19/90 - Add IPC stuff */ |
|
|
|
/* gtri - add - wbk - 12/19/90 - Add IPC stuff */ |
|
|
|
|
|
|
|
/* Send the operating point results for Mspice compatibility */ |
|
|
|
if(g_ipc.enabled) { |
|
|
|
ipc_send_dcop_prefix(); |
|
|
|
CKTdump(ckt,(double)0,(((PSSan*)ckt->CKTcurJob)->PSSplot_td)); |
|
|
|
CKTdump(ckt, 0.0, ((PSSan*)ckt->CKTcurJob)->PSSplot_td); |
|
|
|
ipc_send_dcop_suffix(); |
|
|
|
} |
|
|
|
|
|
|
|
/* gtri - end - wbk */ |
|
|
|
/* gtri - end - wbk */ |
|
|
|
|
|
|
|
|
|
|
|
/* gtri - add - wbk - 12/19/90 - set anal_init and anal_type */ |
|
|
|
/* gtri - add - wbk - 12/19/90 - set anal_init and anal_type */ |
|
|
|
|
|
|
|
g_mif_info.circuit.anal_init = MIF_TRUE; |
|
|
|
|
|
|
|
/* Tell the code models what mode we're in */ |
|
|
|
g_mif_info.circuit.anal_type = MIF_TRAN; |
|
|
|
|
|
|
|
/* gtri - end - wbk */ |
|
|
|
/* gtri - end - wbk */ |
|
|
|
|
|
|
|
/* gtri - begin - wbk - Add Breakpoint stuff */ |
|
|
|
/* gtri - begin - wbk - Add Breakpoint stuff */ |
|
|
|
|
|
|
|
/* Initialize the temporary breakpoint variables to infinity */ |
|
|
|
g_mif_info.breakpoint.current = 1.0e30; |
|
|
|
g_mif_info.breakpoint.last = 1.0e30; |
|
|
|
|
|
|
|
/* gtri - end - wbk - Add Breakpoint stuff */ |
|
|
|
/* gtri - end - wbk - Add Breakpoint stuff */ |
|
|
|
#endif |
|
|
|
ckt->CKTstat->STATtimePts ++; |
|
|
|
ckt->CKTorder=1; |
|
|
|
@ -302,7 +302,7 @@ DCpss(CKTcircuit *ckt, int restart) |
|
|
|
ckt->CKTorder = save2; |
|
|
|
} |
|
|
|
#endif |
|
|
|
/*print*/ |
|
|
|
|
|
|
|
ckt->CKTmode = (ckt->CKTmode&MODEUIC)|MODETRAN | MODEINITTRAN; |
|
|
|
/* modeinittran set here */ |
|
|
|
ckt->CKTag[0]=ckt->CKTag[1]=0; |
|
|
|
@ -342,7 +342,8 @@ DCpss(CKTcircuit *ckt, int restart) |
|
|
|
firsttime=0; |
|
|
|
/* To get rawfile working saj*/ |
|
|
|
error = SPfrontEnd->OUTpBeginPlot |
|
|
|
(NULL, NULL, NULL, NULL, 0, 666, NULL, 666, &(((PSSan*)ckt->CKTcurJob)->PSSplot_td)); |
|
|
|
(NULL, NULL, NULL, NULL, 0, 666, NULL, 666, |
|
|
|
&(((PSSan*)ckt->CKTcurJob)->PSSplot_td)); |
|
|
|
if(error) { |
|
|
|
fprintf(stderr, "Couldn't relink rawfile\n"); |
|
|
|
return error; |
|
|
|
@ -380,6 +381,7 @@ nextTime: |
|
|
|
ckt->CKTtimePoints[ckt->CKTtimeIndex] = ckt->CKTtime; |
|
|
|
} |
|
|
|
/* end LTRA code addition */ |
|
|
|
|
|
|
|
error = CKTaccept(ckt); |
|
|
|
/* check if current breakpoint is outdated; if so, clear */ |
|
|
|
if (ckt->CKTtime > ckt->CKTbreaks[0]) CKTclrBreak(ckt); |
|
|
|
@ -420,7 +422,7 @@ nextTime: |
|
|
|
return(error); |
|
|
|
} |
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - modify - wbk - 12/19/90 - Send IPC stuff */ |
|
|
|
/* gtri - modify - wbk - 12/19/90 - Send IPC stuff */ |
|
|
|
|
|
|
|
if(g_ipc.enabled) { |
|
|
|
|
|
|
|
@ -448,43 +450,43 @@ nextTime: |
|
|
|
/* or if delta was cut */ |
|
|
|
if( (ckt->CKTtime >= (g_ipc.mintime + g_ipc.last_time)) || |
|
|
|
ipc_firsttime || ipc_secondtime || ipc_delta_cut ) { |
|
|
|
|
|
|
|
ipc_send_data_prefix(ckt->CKTtime); |
|
|
|
CKTdump(ckt,ckt->CKTtime, |
|
|
|
(((PSSan*)ckt->CKTcurJob)->PSSplot_td)); |
|
|
|
CKTdump(ckt, ckt->CKTtime, ((PSSan*)ckt->CKTcurJob)->PSSplot_td); |
|
|
|
ipc_send_data_suffix(); |
|
|
|
|
|
|
|
if(ipc_firsttime) { |
|
|
|
ipc_firsttime = IPC_FALSE; |
|
|
|
ipc_secondtime = IPC_TRUE; |
|
|
|
} else if(ipc_secondtime) |
|
|
|
} else if(ipc_secondtime) { |
|
|
|
ipc_secondtime = IPC_FALSE; |
|
|
|
} |
|
|
|
|
|
|
|
g_ipc.last_time = ckt->CKTtime; |
|
|
|
} |
|
|
|
} |
|
|
|
} else |
|
|
|
/* gtri - modify - wbk - 12/19/90 - Send IPC stuff */ |
|
|
|
/* gtri - modify - wbk - 12/19/90 - Send IPC stuff */ |
|
|
|
#endif |
|
|
|
#ifdef CLUSTER |
|
|
|
if ( in_pss && pss_cycle_counter==1 ) { |
|
|
|
if ( in_pss && pss_cycle_counter==1 ) |
|
|
|
CLUoutput(ckt); |
|
|
|
} |
|
|
|
#endif |
|
|
|
if ( in_pss && pss_cycle_counter==1 ) { |
|
|
|
if(ckt->CKTtime >= ckt->CKTinitTime) CKTdump( ckt, ckt->CKTtime, ( ((PSSan*)ckt->CKTcurJob)->PSSplot_td) ); |
|
|
|
if(ckt->CKTtime >= ckt->CKTinitTime) |
|
|
|
CKTdump(ckt, ckt->CKTtime, ((PSSan*)ckt->CKTcurJob)->PSSplot_td); |
|
|
|
psstimes[pss_points_cycle] = ckt->CKTtime; |
|
|
|
for(count_1=1; count_1<msize+1; count_1++) { |
|
|
|
for(count_1=1; count_1<msize+1; count_1++) |
|
|
|
pssvalues[count_1-1 + pss_points_cycle*msize] = ckt->CKTrhsOld[count_1]; |
|
|
|
} |
|
|
|
pss_points_cycle++; |
|
|
|
} |
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - begin - wbk - Update event queues/data for accepted timepoint */ |
|
|
|
/* gtri - begin - wbk - Update event queues/data for accepted timepoint */ |
|
|
|
/* Note: this must be done AFTER sending results to SI so it can't */ |
|
|
|
/* go next to CKTaccept() above */ |
|
|
|
if(ckt->evt->counts.num_insts > 0) |
|
|
|
EVTaccept(ckt, ckt->CKTtime); |
|
|
|
/* gtri - end - wbk - Update event queues/data for accepted timepoint */ |
|
|
|
/* gtri - end - wbk - Update event queues/data for accepted timepoint */ |
|
|
|
#endif |
|
|
|
ckt->CKTstat->STAToldIter = ckt->CKTstat->STATnumIter; |
|
|
|
|
|
|
|
@ -872,17 +874,16 @@ resume: |
|
|
|
ckt->CKTdelta = |
|
|
|
MIN(ckt->CKTdelta,ckt->CKTmaxStep); |
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - begin - wbk - Cut integration order if first timepoint after breakpoint */ |
|
|
|
//if(ckt->CKTtime == g_mif_info.breakpoint.last) |
|
|
|
/* gtri - begin - wbk - Cut integration order if first timepoint after breakpoint */ |
|
|
|
/* if(ckt->CKTtime == g_mif_info.breakpoint.last) */ |
|
|
|
if ( AlmostEqualUlps( ckt->CKTtime, g_mif_info.breakpoint.last, 100 ) ) |
|
|
|
ckt->CKTorder = 1; |
|
|
|
/* gtri - end - wbk - Cut integration order if first timepoint after breakpoint */ |
|
|
|
/* gtri - end - wbk - Cut integration order if first timepoint after breakpoint */ |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/* are we at a breakpoint, or indistinguishably close? */ |
|
|
|
//if ((ckt->CKTtime == ckt->CKTbreaks[0]) || (ckt->CKTbreaks[0] - |
|
|
|
/* if ((ckt->CKTtime == ckt->CKTbreaks[0]) || (ckt->CKTbreaks[0] - */ |
|
|
|
if ( ckt->CKTbreaks[0] - ckt->CKTtime <= ckt->CKTdelmin ) { |
|
|
|
/*if ( AlmostEqualUlps( ckt->CKTtime, ckt->CKTbreaks[0], 100 ) || (ckt->CKTbreaks[0] - |
|
|
|
* (ckt->CKTtime) <= ckt->CKTdelmin)) {*/ |
|
|
|
@ -906,12 +907,11 @@ resume: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ( ckt->CKTbreaks[1] - ckt->CKTbreaks[0] == 0 ) { |
|
|
|
if ( ckt->CKTbreaks[1] - ckt->CKTbreaks[0] == 0 ) |
|
|
|
ckt->CKTdelta = ckt->CKTdelmin; |
|
|
|
} else { |
|
|
|
else |
|
|
|
ckt->CKTdelta = MIN(ckt->CKTdelta, .1 * MIN(ckt->CKTsaveDelta, |
|
|
|
ckt->CKTbreaks[1] - ckt->CKTbreaks[0])); |
|
|
|
} |
|
|
|
|
|
|
|
if(firsttime) { |
|
|
|
ckt->CKTdelta /= 10; |
|
|
|
@ -923,7 +923,7 @@ resume: |
|
|
|
#ifdef XSPICE |
|
|
|
} |
|
|
|
|
|
|
|
/* gtri - begin - wbk - Add Breakpoint stuff */ |
|
|
|
/* gtri - begin - wbk - Add Breakpoint stuff */ |
|
|
|
|
|
|
|
if(ckt->CKTtime + ckt->CKTdelta >= g_mif_info.breakpoint.current) { |
|
|
|
/* If next time > temporary breakpoint, force it to the breakpoint */ |
|
|
|
@ -936,20 +936,22 @@ resume: |
|
|
|
g_mif_info.breakpoint.last = 1.0e30; |
|
|
|
} |
|
|
|
|
|
|
|
/* gtri - end - wbk - Add Breakpoint stuff */ |
|
|
|
/* gtri - end - wbk - Add Breakpoint stuff */ |
|
|
|
|
|
|
|
/* gtri - begin - wbk - Modify Breakpoint stuff */ |
|
|
|
/* gtri - begin - wbk - Modify Breakpoint stuff */ |
|
|
|
/* Throw out any permanent breakpoint times <= current time */ |
|
|
|
while(1) { |
|
|
|
for(;;) { |
|
|
|
#ifdef STEPDEBUG |
|
|
|
printf(" brk_pt: %g ckt_time: %g ckt_min_break: %g\n", ckt->CKTbreaks[0], ckt->CKTtime, ckt->CKTminBreak); |
|
|
|
#endif |
|
|
|
if(AlmostEqualUlps(ckt->CKTbreaks[0],ckt->CKTtime, 100) || ckt->CKTbreaks[0] <= (ckt->CKTtime + ckt->CKTminBreak)) { |
|
|
|
if(AlmostEqualUlps(ckt->CKTbreaks[0],ckt->CKTtime, 100) || |
|
|
|
ckt->CKTbreaks[0] <= ckt->CKTtime + ckt->CKTminBreak) { |
|
|
|
printf("throwing out permanent breakpoint times <= current time (brk pt: %g)\n", ckt->CKTbreaks[0]); |
|
|
|
printf("ckt_time: %g ckt_min_break: %g\n", ckt->CKTtime, ckt->CKTminBreak); |
|
|
|
CKTclrBreak(ckt); |
|
|
|
} else |
|
|
|
} else { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Force the breakpoint if appropriate */ |
|
|
|
if(ckt->CKTtime + ckt->CKTdelta > ckt->CKTbreaks[0]) { |
|
|
|
@ -958,14 +960,13 @@ resume: |
|
|
|
ckt->CKTdelta = ckt->CKTbreaks[0] - ckt->CKTtime; |
|
|
|
} |
|
|
|
|
|
|
|
/* gtri - end - wbk - Modify Breakpoint stuff */ |
|
|
|
/* gtri - end - wbk - Modify Breakpoint stuff */ |
|
|
|
#else /* !XSPICE */ |
|
|
|
|
|
|
|
/* don't want to get below delmin for no reason */ |
|
|
|
ckt->CKTdelta = MAX(ckt->CKTdelta, ckt->CKTdelmin*2.0); |
|
|
|
} |
|
|
|
else if(ckt->CKTtime + ckt->CKTdelta >= ckt->CKTbreaks[0]) |
|
|
|
{ |
|
|
|
else if(ckt->CKTtime + ckt->CKTdelta >= ckt->CKTbreaks[0]) { |
|
|
|
ckt->CKTsaveDelta = ckt->CKTdelta; |
|
|
|
ckt->CKTdelta = ckt->CKTbreaks[0] - ckt->CKTtime; |
|
|
|
/*(void)printf("delta cut to %g to hit breakpoint\n",ckt->CKTdelta);*/ |
|
|
|
@ -973,8 +974,7 @@ resume: |
|
|
|
ckt->CKTbreak = 1; /* why? the current pt. is not a bkpt. */ |
|
|
|
} |
|
|
|
#ifdef CLUSTER |
|
|
|
if(!CLUsync(ckt->CKTtime,&ckt->CKTdelta,0)) |
|
|
|
{ |
|
|
|
if(!CLUsync(ckt->CKTtime,&ckt->CKTdelta,0)) { |
|
|
|
printf("Sync error!\n"); |
|
|
|
exit(0); |
|
|
|
} |
|
|
|
@ -986,10 +986,9 @@ resume: |
|
|
|
#endif /* XSPICE */ |
|
|
|
|
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - begin - wbk - Do event solution */ |
|
|
|
/* gtri - begin - wbk - Do event solution */ |
|
|
|
|
|
|
|
if(ckt->evt->counts.num_insts > 0) |
|
|
|
{ |
|
|
|
if(ckt->evt->counts.num_insts > 0) { |
|
|
|
|
|
|
|
/* if time = 0 and op_alternate was specified as false during */ |
|
|
|
/* dcop analysis, call any changed instances to let them */ |
|
|
|
@ -1014,11 +1013,11 @@ resume: |
|
|
|
if(ckt->CKTbreaks[0] < g_mif_info.breakpoint.current) |
|
|
|
if(ckt->CKTbreaks[0] > ckt->CKTtime + ckt->CKTminBreak) |
|
|
|
g_mif_info.breakpoint.current = ckt->CKTbreaks[0]; |
|
|
|
if(g_mif_info.breakpoint.current < (ckt->CKTtime + ckt->CKTdelta)) { |
|
|
|
if(g_mif_info.breakpoint.current < ckt->CKTtime + ckt->CKTdelta) { |
|
|
|
/* Breakpoint must be > last accepted timepoint */ |
|
|
|
/* and >= current event time */ |
|
|
|
if(g_mif_info.breakpoint.current > (ckt->CKTtime + ckt->CKTminBreak) |
|
|
|
&& (g_mif_info.breakpoint.current >= g_mif_info.circuit.evt_step)) { |
|
|
|
if(g_mif_info.breakpoint.current > ckt->CKTtime + ckt->CKTminBreak && |
|
|
|
g_mif_info.breakpoint.current >= g_mif_info.circuit.evt_step) { |
|
|
|
ckt->CKTsaveDelta = ckt->CKTdelta; |
|
|
|
ckt->CKTdelta = g_mif_info.breakpoint.current - ckt->CKTtime; |
|
|
|
g_mif_info.breakpoint.last = ckt->CKTtime + ckt->CKTdelta; |
|
|
|
@ -1028,37 +1027,33 @@ resume: |
|
|
|
} /* end while next event time <= next analog time */ |
|
|
|
} /* end if there are event instances */ |
|
|
|
|
|
|
|
/* gtri - end - wbk - Do event solution */ |
|
|
|
/* gtri - end - wbk - Do event solution */ |
|
|
|
#endif |
|
|
|
for(i5=5; i5>=0; i5--) |
|
|
|
{ |
|
|
|
ckt->CKTdeltaOld[i5+1]=ckt->CKTdeltaOld[i5]; |
|
|
|
} |
|
|
|
ckt->CKTdeltaOld[0]=ckt->CKTdelta; |
|
|
|
ckt->CKTdeltaOld[i5+1] = ckt->CKTdeltaOld[i5]; |
|
|
|
ckt->CKTdeltaOld[0] = ckt->CKTdelta; |
|
|
|
|
|
|
|
{ double *temp = ckt->CKTstates[ckt->CKTmaxOrder+1]; |
|
|
|
for(i5=ckt->CKTmaxOrder; i5>=0; i5--) |
|
|
|
{ |
|
|
|
ckt->CKTstates[i5+1] = ckt->CKTstates[i5]; |
|
|
|
double *temp = ckt->CKTstates[ckt->CKTmaxOrder+1]; |
|
|
|
for(i5=ckt->CKTmaxOrder; i5>=0; i5--) |
|
|
|
ckt->CKTstates[i5+1] = ckt->CKTstates[i5]; |
|
|
|
ckt->CKTstates[0] = temp; |
|
|
|
} |
|
|
|
ckt->CKTstates[0] = temp; |
|
|
|
} |
|
|
|
|
|
|
|
/* 600 */ |
|
|
|
while (1) |
|
|
|
{ |
|
|
|
for (;;) { |
|
|
|
#ifdef CLUSTER |
|
|
|
redostep = 1; |
|
|
|
#endif |
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - add - wbk - 4/17/91 - Fix Berkeley bug */ |
|
|
|
/* gtri - add - wbk - 4/17/91 - Fix Berkeley bug */ |
|
|
|
/* This is needed here to allow CAPask to output currents */ |
|
|
|
/* during Transient analysis. A grep for CKTcurrentAnalysis */ |
|
|
|
/* indicates that it should not hurt anything else ... */ |
|
|
|
|
|
|
|
ckt->CKTcurrentAnalysis = DOING_TRAN; |
|
|
|
|
|
|
|
/* gtri - end - wbk - 4/17/91 - Fix Berkeley bug */ |
|
|
|
/* gtri - end - wbk - 4/17/91 - Fix Berkeley bug */ |
|
|
|
#endif |
|
|
|
olddelta=ckt->CKTdelta; |
|
|
|
/* time abort? */ |
|
|
|
@ -1097,7 +1092,6 @@ resume: |
|
|
|
/* ************************************ */ |
|
|
|
|
|
|
|
ckt->CKTtime += ckt->CKTdelta; |
|
|
|
|
|
|
|
#ifdef CLUSTER |
|
|
|
CLUinput(ckt); |
|
|
|
#endif |
|
|
|
@ -1109,32 +1103,31 @@ resume: |
|
|
|
save_mode = ckt->CKTmode; |
|
|
|
save_order = ckt->CKTorder; |
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - begin - wbk - Add Breakpoint stuff */ |
|
|
|
/* gtri - begin - wbk - Add Breakpoint stuff */ |
|
|
|
|
|
|
|
/* Initialize temporary breakpoint to infinity */ |
|
|
|
g_mif_info.breakpoint.current = 1.0e30; |
|
|
|
|
|
|
|
/* gtri - end - wbk - Add Breakpoint stuff */ |
|
|
|
/* gtri - end - wbk - Add Breakpoint stuff */ |
|
|
|
|
|
|
|
|
|
|
|
/* gtri - begin - wbk - add convergence problem reporting flags */ |
|
|
|
/* gtri - begin - wbk - add convergence problem reporting flags */ |
|
|
|
/* delta is forced to equal delmin on last attempt near line 650 */ |
|
|
|
if(ckt->CKTdelta <= ckt->CKTdelmin) |
|
|
|
ckt->enh->conv_debug.last_NIiter_call = MIF_TRUE; |
|
|
|
else |
|
|
|
ckt->enh->conv_debug.last_NIiter_call = MIF_FALSE; |
|
|
|
/* gtri - begin - wbk - add convergence problem reporting flags */ |
|
|
|
/* gtri - begin - wbk - add convergence problem reporting flags */ |
|
|
|
|
|
|
|
|
|
|
|
/* gtri - begin - wbk - Call all hybrids */ |
|
|
|
|
|
|
|
/* gtri - begin - wbk - Call all hybrids */ |
|
|
|
|
|
|
|
/* gtri - begin - wbk - Set evt_step */ |
|
|
|
/* gtri - begin - wbk - Set evt_step */ |
|
|
|
|
|
|
|
if(ckt->evt->counts.num_insts > 0) { |
|
|
|
g_mif_info.circuit.evt_step = ckt->CKTtime; |
|
|
|
} |
|
|
|
/* gtri - end - wbk - Set evt_step */ |
|
|
|
/* gtri - end - wbk - Set evt_step */ |
|
|
|
#endif |
|
|
|
|
|
|
|
converged = NIiter(ckt,ckt->CKTtranMaxIter); |
|
|
|
@ -1144,7 +1137,7 @@ resume: |
|
|
|
g_mif_info.circuit.evt_step = ckt->CKTtime; |
|
|
|
EVTcall_hybrids(ckt); |
|
|
|
} |
|
|
|
/* gtri - end - wbk - Call all hybrids */ |
|
|
|
/* gtri - end - wbk - Call all hybrids */ |
|
|
|
|
|
|
|
#endif |
|
|
|
ckt->CKTstat->STATtimePts ++; |
|
|
|
@ -1177,7 +1170,7 @@ resume: |
|
|
|
ckt->CKTorder = 1; |
|
|
|
|
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - begin - wbk - Add Breakpoint stuff */ |
|
|
|
/* gtri - begin - wbk - Add Breakpoint stuff */ |
|
|
|
|
|
|
|
/* Force backup if temporary breakpoint is < current time */ |
|
|
|
} else if(g_mif_info.breakpoint.current < ckt->CKTtime) { |
|
|
|
@ -1191,7 +1184,7 @@ resume: |
|
|
|
} |
|
|
|
ckt->CKTorder = 1; |
|
|
|
|
|
|
|
/* gtri - end - wbk - Add Breakpoint stuff */ |
|
|
|
/* gtri - end - wbk - Add Breakpoint stuff */ |
|
|
|
#endif |
|
|
|
|
|
|
|
} else { |
|
|
|
@ -1217,8 +1210,8 @@ resume: |
|
|
|
goto chkStep; |
|
|
|
#endif |
|
|
|
} |
|
|
|
new = ckt->CKTdelta; |
|
|
|
error = CKTtrunc(ckt,&new); |
|
|
|
newdelta = ckt->CKTdelta; |
|
|
|
error = CKTtrunc(ckt,&newdelta); |
|
|
|
if(error) { |
|
|
|
ckt->CKTcurrentAnalysis = DOING_TRAN; |
|
|
|
ckt->CKTstat->STATtranTime += |
|
|
|
@ -1237,11 +1230,11 @@ resume: |
|
|
|
- startkTime; |
|
|
|
return(error); |
|
|
|
} |
|
|
|
if(new>.9 * ckt->CKTdelta) { |
|
|
|
if(newdelta>.9 * ckt->CKTdelta) { |
|
|
|
if(ckt->CKTorder == 1) { |
|
|
|
new = ckt->CKTdelta; |
|
|
|
newdelta = ckt->CKTdelta; |
|
|
|
ckt->CKTorder = 2; |
|
|
|
error = CKTtrunc(ckt,&new); |
|
|
|
error = CKTtrunc(ckt,&newdelta); |
|
|
|
if(error) { |
|
|
|
ckt->CKTcurrentAnalysis = DOING_TRAN; |
|
|
|
ckt->CKTstat->STATtranTime += |
|
|
|
@ -1260,12 +1253,12 @@ resume: |
|
|
|
ckt->CKTstat->STATsyncTime - startkTime; |
|
|
|
return(error); |
|
|
|
} |
|
|
|
if(new <= 1.05 * ckt->CKTdelta) { |
|
|
|
if(newdelta <= 1.05 * ckt->CKTdelta) { |
|
|
|
ckt->CKTorder = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
/* time point OK - 630*/ |
|
|
|
ckt->CKTdelta = new; |
|
|
|
ckt->CKTdelta = newdelta; |
|
|
|
#ifdef NDEV |
|
|
|
/* show a time process indicator, by Gong Ding, gdiso@ustc.edu */ |
|
|
|
if(ckt->CKTtime/ckt->CKTfinalTime*100<10.0) |
|
|
|
@ -1283,6 +1276,7 @@ resume: |
|
|
|
ckt->CKTdelta,ckt->CKTtime); |
|
|
|
fflush(stdout); |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef WANT_SENSE2 |
|
|
|
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN)) { |
|
|
|
save1 = ckt->CKTmode; |
|
|
|
@ -1294,6 +1288,7 @@ resume: |
|
|
|
ckt->CKTorder = save2; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifndef CLUSTER |
|
|
|
/* go to 650 - trapezoidal */ |
|
|
|
goto nextTime; |
|
|
|
@ -1306,7 +1301,7 @@ resume: |
|
|
|
ckt->CKTtime = ckt->CKTtime -ckt->CKTdelta; |
|
|
|
ckt->CKTstat->STATrejected ++; |
|
|
|
#endif |
|
|
|
ckt->CKTdelta = new; |
|
|
|
ckt->CKTdelta = newdelta; |
|
|
|
#ifdef STEPDEBUG |
|
|
|
(void)printf( |
|
|
|
"delta set to truncation error result:point rejected\n"); |
|
|
|
@ -1344,12 +1339,12 @@ resume: |
|
|
|
} |
|
|
|
} |
|
|
|
#ifdef XSPICE |
|
|
|
/* gtri - begin - wbk - Do event backup */ |
|
|
|
/* gtri - begin - wbk - Do event backup */ |
|
|
|
|
|
|
|
if(ckt->evt->counts.num_insts > 0) |
|
|
|
EVTbackup(ckt, ckt->CKTtime + ckt->CKTdelta); |
|
|
|
|
|
|
|
/* gtri - end - wbk - Do event backup */ |
|
|
|
/* gtri - end - wbk - Do event backup */ |
|
|
|
#endif |
|
|
|
#ifdef CLUSTER |
|
|
|
chkStep: |
|
|
|
|