help-gnucap
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gnucap] Time step control


From: a r
Subject: Re: [Help-gnucap] Time step control
Date: Mon, 3 Dec 2007 18:14:16 +0000

On Dec 3, 2007 4:19 PM, al davis <address@hidden> wrote:
> On Monday 03 December 2007, a r wrote:
> > 1. there is something wrong with the pulse formula:
> > "pulse (0 2.5 2.5n 0.01n 0.01n 1.48n 3n)" does not generate
> > 1.48n width pulses. I will look into it later.
>
> It works for me.

Perhaps you haven't tried simulating the exact card I included. The
generation algorithm is wrong.

I have corrected the function generating pulse waveform:

void EVAL_BM_PULSE::tr_eval(ELEMENT* d)const
{
 double time = SIM::time0;
 if (0 < _period && _period < BIGBIG) {
   if (time > _delay)
     time = fmod(time - _delay, _period) + _delay;
 }
 double time_offset = SIM::time0 - time;

 double ev = 0; // effective value
 if (time >= _delay+_rise+_width+_fall) {      /* past pulse   */
   ev = _iv;
   SIM::new_event(_delay + _period + time_offset);
 }else if (time >= _delay+_rise+_width) {      /* falling      */
   double interp = (time - (_delay+_rise+_width)) / _fall;
   ev = _pv + interp * (_iv - _pv);
   SIM::new_event(_delay + _rise + _width + _fall + time_offset);
 }else if (time >= _delay + _rise) {           /* pulse val    */
   ev = _pv;
   SIM::new_event(_delay + _rise + _width + time_offset);
 }else if (time >= _delay) {                   /* rising       */
   double interp = (time - _delay) / _rise;
   ev = _iv + interp * (_pv - _iv);
   SIM::new_event(_delay + _rise + time_offset);
 }else{                                        /* init val     */
   ev = _iv;
   SIM::new_event(_delay + time_offset);
 }

 tr_finish_tdv(d, ev);
}


> > 2. (this seems more critical) time step is not decreased (or
> > not decreased enough) when the transition occurs. Sure,
> > additional events are added but all devices (bsim3) driven by
> > this signal are not modeled exactly.
>
> You requested "method=euler", which disables truncation error
> based step control.  Try "method=trap".
>
> It might seem like we are going in a circle, with my
> recommending trap now.  Actually, with the pulse properly
> generating events now it should work.
>
> Truncation error control should make the steps small enough to
> avoid trap ringing, provided you set the tolerances
> correctly.  "trtol=1".

Trap method works better in fact but anything more than trtol=0.001
gives terrible ringing. Setting trtol=1 does not change anything.

For the example I included before using the following cards works just
fine. Finally I am getting behaviour I wanted (but haven't tested
these settings on a real design yet).

.option method=trap trtol=0.001
.tran 1n 20n trace alltime >inv_test.dat

-r.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]