Hi Holger,
Sorry I juxtaposed your name. Your help is greatly appreciated.
Bill Swartz <bills@...> writes:
> Hi Volger, Paolo,
>
> Holger Vogt <holger.vogt@...> writes:
> > Hi Bill, Paolo,
> >
> > a few remarks:
> >
> > there are some tests incorporated in
> > ng-spice-rework/examples/func_cap.sp, inverter.sp, inverter2.sp.
>
> Thanks. I need test cases. I have found errors in the previous
> implementation. The comments are correct (one should do interpolation
> on the time) but the operation wasn't performed. For integration,
> rms, and averaging, the from and to time measurements should be interpolated
> when they don't fall exactly on a timestep. So now ngspice gets the
> correct answer for measurements like
> .MEASURE TRAN integ2 INTEG v(vdd) TO=2.74e-9
> when TO is not a multiple of the timestep.
>
> > Do we need to reserve 'LAST' as a special keyword? I don't think so
> > (maybe I am missing something?). It would be enough to test within the
> > .meas statement against
> >
> > FALL=LAST, FALL = LAST FALL =LAST FALL= LAST
> >
> > and that's it!
>
> I wish that were so. The numparam package performs substitution early in
> the process. By the time, the program gets to
>
> inp_subcktexpand (deck=0x141e410) at subckt.c:332
>
> It has already performed the substitution:
> gdb> p c->li_line
> $1 = 0x1421040 ".measure tran inv_delay trig v(in) val= 0.5 fall= 10\
> 00000025 targ v(out) val= 1000000026 rise=1"
>
> If I don't add the snippet of code to xpressn.c as attached, we get:
> 58: Undefined number [LAST]
> 58: Cannot compute substitute
> Copies=59 Evals=57 Placeholders=29 Symbols=21 Errors=2
> Numparam expansion errors: Run Spice anyway? y/n ? n
>
> > We have already too many special cases imposed by the numparam code (e.g.
> > the restriction concerning .model names), and I would like to get rid of
> > them.
>
> Ok, I would have to trap the measurement statement at the first evaluation
> of the numparam code. Unfortunately, I think this becomes just as awkward.
>
>
> > Claiming ngspice compatibility with HSPICE is an ambitious undertaking! If
> > you claim that you have to offer it to the user! And it is not limited to
> > a statement within the .meas code, WHEN statement FALL=LAST token! It
> > starts with the fact that the line may start with .meas, not only .measure,
> > and it ends up, well, with HSPICE compatibility in a wide sense.
>
> Totally agree. That is why I brought up this issue to discuss.
>
> > >From a Windows perspective the personalization of a program via
> > environmental variables is strange. I would prefer, if needed anyhow,
> > using spinit, the initialization file. This seems to me much more
> > tranparent, easy to organize by the user, and not too difficult to
> > implement.
>
> In the Unix world, environment variables are common. However, they
> are best suited for system options such as selecting the installation
> directory or the path of loadable modules. I totally agree that this
> is program behaviour and should be in the initialization file. I will
> change it so I put it in the initialization file if we decide to add
> the option.
>
> Perhaps we need a feature in the init file like
> set ngbehavior {native hspice spectre spice2 spice3}
> similar to wher Paolo proposed.
>
> Adding compatibility modes is ambitious but we have to start somewhere.
>
>
> > I would prefer not to use xpressn.c to do command line parsing or to
> > define special cases. The ngspice code might become even more difficult
> > to maintain, if we use many different places to define important issues.
>
> I don't know if this is necessarily the case. The relevent piece of code
> in nupa_substitute is :
>
> else
> {
> pscopy (t, s, i + 1, k - i - 1);
>
> ! if( dico->hspice_compatibility && (strcasecmp(t,"LAST")==0) ) {
> ! strcpy(q,"last") ;
> ! err=0;
> ! } else
> ! err = evaluate (dico, q, t, 0);
> }
> i = k;
>
> This could be generalized to a set of keywords based on compatibility
> mode (program,keyword) such (hspice,last). In addition, we could have
> a hash table here of model names to ignore, relieving us of the problems
> you have described above.
>
>
> > It will be necessary that the new .meas patch will improve the existing
> > code and that it is tested against all the options the .meas statement offers.
>
> Totally agree. In any event, the current code is wrong in some cases and
> needs to be fixed.
>
> .MEASURE TRAN integ2 INTEG v(vdd) FROM=0.0e0 TO=2.74e-9
> where vdd=1.0V
>
> OLD:
> integ2 = 2.73750e-09 from= 0.00000e+00 to= 2.74000e-09
> NEW
> integ2 = 2.74000e-09 from= 0.00000e+00 to= 2.74000e-09
>
>
>
> Again, the attached patch is only for discussion purposes. I plan to
> send a complete patch when more testing is complete. Thanks for the
> new examples.
>
> --
> Best Regards,
> -----------------------
> Bill Swartz
> InternetCad.com, Inc.
> 10880 Cassandra Way
> Dallas, TX 75228-2493
> email : Bill_Swartz@...
> fax : 972-613-1127
> http : http://www.internetcad.com (204.178.73.199)
> : www2.internetcad.com (204.0.6.171)
> *** numparam.h.old Thu May 21 14:04:30 2009
> --- numparam.h Tue May 19 03:15:04 2009
> ***************
> *** 68,73 ****
> --- 68,74 ----
> char **dynrefptr;
> // char category[Maxline]; /* category of each line */
> char *dyncategory;
> + int hspice_compatibility; /* allow hspice keywords */
> } tdico;
>
> void initdico(tdico * dico);
> *** xpressn.c.old Thu May 21 14:05:03 2009
> --- xpressn.c Tue May 19 03:27:09 2009
> ***************
> *** 154,159 ****
> --- 154,160 ----
> initdico (tdico * dico)
> {
> int i;
> + char *env_ptr;
> dico->nbd = 0;
> sini(dico->option,sizeof(dico->option)-4);
> sini(dico->srcfile,sizeof(dico->srcfile)-4);
> ***************
> *** 168,173 ****
> --- 169,186 ----
> dico->tos = 0;
> dico->stack[dico->tos] = 0; /* global data beneath */
> initkeys ();
> +
> + if ( ( env_ptr = getenv("NGSPICE_HSPICE_COMPATIBILITY_MODE") ) )
> + {
> + if( (strcmp(env_ptr, "0" ) == 0) ||
> + (strcasecmp(env_ptr,"no")==0) ||
> + (strcasecmp(env_ptr,"off")==0) ||
> + (strcasecmp(env_ptr,"false")==0) )
> + dico->hspice_compatibility = 0 ;
> + else
> + dico->hspice_compatibility = 1 ;
> + } else
> + dico->hspice_compatibility = 0 ;
> }
>
> /* local semantics for parameters inside a subckt */
> ***************
> *** 1724,1730 ****
> else
> {
> pscopy (t, s, i + 1, k - i - 1);
> ! err = evaluate (dico, q, t, 0);
> }
>
> i = k;
> --- 1737,1747 ----
> else
> {
> pscopy (t, s, i + 1, k - i - 1);
> ! if( dico->hspice_compatibility && (strcasecmp(t,"LAST")==0) ) {
> ! strcpy(q,"last") ;
> ! err=0;
> ! } else
> ! err = evaluate (dico, q, t, 0);
> }
>
> i = k;
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, &
> iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://www.creativitycat.com
> _______________________________________________
> Ngspice-devel mailing list
> Ngspice-devel@...
> https://lists.sourceforge.net/lists/listinfo/ngspice-devel
--
Best Regards,
-----------------------
Bill Swartz
InternetCad.com, Inc.
10880 Cassandra Way
Dallas, TX 75228-2493
email : Bill_Swartz@...
fax : 972-613-1127
http : http://www.internetcad.com (204.178.73.199)
: www2.internetcad.com (204.0.6.171)
|