Browse Source

Partially applied Paul Reich patch (missing include and c++ style comments)

pre-master-46
pnenzi 21 years ago
parent
commit
5296cd51b8
  1. 15
      ChangeLog
  2. 4
      src/frontend/numparam/general.h
  3. 1
      src/maths/cmaths/test_cx_ph.c
  4. 2
      src/maths/ni/niiter.c
  5. 1
      src/maths/sparse/spconfig.h
  6. 20
      src/spicelib/devices/csw/cswload.c
  7. 2
      src/spicelib/devices/csw/cswmpar.c
  8. 15
      src/spicelib/devices/hfet1/hfetload.c
  9. 10
      src/spicelib/devices/hfet1/hfetsetup.c
  10. 18
      src/spicelib/devices/hfet2/hfet2load.c
  11. 4
      src/spicelib/devices/hfet2/hfet2setup.c
  12. 2
      src/spicelib/devices/hisim/hisim.h
  13. 2
      src/spicelib/devices/hisim/hsm1eval120.c
  14. 2
      src/spicelib/parser/ptfuncs.c

15
ChangeLog

@ -1,3 +1,18 @@
2005-12-02 Paolo Nenzi <p.nenzi@ieee.org>
* src/maths/cmaths/test_cx_ph.c: added a missing include
(patch by Paul Reich).
* src/maths/sparse/spconfig.h: removed include directive (ngspice.h).
* src/frontend/numparam/general.h, src/maths/ni/niiter.c,
src/spicelib/devices/csw/{cswload.c, cswmpar.c},
src/spicelib/devices/hfet1/{hfetload.c, hfetsetup.c},
src/spicelib/devices/hfet2/{hfet2load.c, hfet2setup.c},
src/spicelib/devices/hisim/hisim.h, src/spicelib/parser/ptfuncs.c:
partially applied Paul Reich patch that removed C++ style comments.
2005-11-27 Paolo Nenzi <p.nenzi@ieee.org> 2005-11-27 Paolo Nenzi <p.nenzi@ieee.org>
* Added manual page for ngmultidec. The man page has been written * Added manual page for ngmultidec. The man page has been written

4
src/frontend/numparam/general.h

@ -195,8 +195,8 @@ Func short freadstr(Pfile f, Pchar s, short max);
Func char freadc(Pfile f); Func char freadc(Pfile f);
Func long freadi(Pfile f); Func long freadi(Pfile f);
Func long np_round(double d); // sjb to avoid clash with round() in math.h
Func long np_trunc(double x); // sjb to avoid clash with trunc() in math.h
Func long np_round(double d); /* sjb to avoid clash with round() in math.h */
Func long np_trunc(double x); /* sjb to avoid clash with trunc() in math.h */
Func double sqr(double x); Func double sqr(double x);
Func double absf(double x); /* abs */ Func double absf(double x); /* abs */
Func long absi( long i); Func long absi( long i);

1
src/maths/cmaths/test_cx_ph.c

@ -7,6 +7,7 @@
#include <dvec.h> #include <dvec.h>
#include <complex.h> #include <complex.h>
#include "defines.h"
#include "cmath.h" #include "cmath.h"
#include "cmath1.h" #include "cmath1.h"

2
src/maths/ni/niiter.c

@ -69,7 +69,7 @@ NIiter(CKTcircuit *ckt, int maxIter)
} }
} }
// OldCKTstate0=(double *)MALLOC((ckt->CKTnumStates+1)*sizeof(double));
/* OldCKTstate0=(double *)MALLOC((ckt->CKTnumStates+1)*sizeof(double)); */
for(;;){ for(;;){
ckt->CKTnoncon=0; ckt->CKTnoncon=0;

1
src/maths/sparse/spconfig.h

@ -378,7 +378,6 @@
* Grab from Spice include files * Grab from Spice include files
*/ */
// #include "ngspice.h"
#define MACHINE_RESOLUTION DBL_EPSILON #define MACHINE_RESOLUTION DBL_EPSILON
#define LARGEST_REAL DBL_MAX #define LARGEST_REAL DBL_MAX
#define SMALLEST_REAL DBL_MIN #define SMALLEST_REAL DBL_MIN

20
src/spicelib/devices/csw/cswload.c

@ -25,8 +25,10 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt)
double i_ctrl; double i_ctrl;
double previous_state = -1; double previous_state = -1;
double current_state = -1, old_current_state = -1; double current_state = -1, old_current_state = -1;
double REALLY_OFF = 0, REALLY_ON = 1; // switch is on or off, not in hysteresis region.
double HYST_OFF = 2, HYST_ON = 3; // switch is on or off while control value is in hysteresis region.
double REALLY_OFF = 0, REALLY_ON = 1;
/* switch is on or off, not in hysteresis region. */
double HYST_OFF = 2, HYST_ON = 3;
/* switch is on or off while control value is in hysteresis region. */
/* loop through all the switch models */ /* loop through all the switch models */
for( ; model != NULL; model = model->CSWnextModel ) { for( ; model != NULL; model = model->CSWnextModel ) {
@ -83,8 +85,11 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt)
current_state = REALLY_ON; current_state = REALLY_ON;
} else if (i_ctrl < (model->CSWiThreshold + model->CSWiHysteresis)) { } else if (i_ctrl < (model->CSWiThreshold + model->CSWiHysteresis)) {
current_state = REALLY_OFF; current_state = REALLY_OFF;
} else { // in hysteresis... change value if going from low to hysteresis, or from hi to hysteresis.
// if previous state was in hysteresis, then don't change the state..
} else {
/* in hysteresis... change value if going from low to hysteresis,
* or from hi to hysteresis. */
/* if previous state was in hysteresis, then don't change the state.. */
if ((previous_state == HYST_OFF) || (previous_state == HYST_ON)) { if ((previous_state == HYST_OFF) || (previous_state == HYST_ON)) {
current_state = previous_state; current_state = previous_state;
} else if (previous_state == REALLY_ON) { } else if (previous_state == REALLY_ON) {
@ -116,8 +121,11 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt)
current_state = REALLY_ON; current_state = REALLY_ON;
} else if (i_ctrl < (model->CSWiThreshold + model->CSWiHysteresis)) { } else if (i_ctrl < (model->CSWiThreshold + model->CSWiHysteresis)) {
current_state = REALLY_OFF; current_state = REALLY_OFF;
} else { // in hysteresis... change value if going from low to hysteresis, or from hi to hysteresis.
// if previous state was in hysteresis, then don't change the state..
} else {
/* in hysteresis... change value if going from low to hysteresis,
* or from hi to hysteresis. */
/* if previous state was in hysteresis, then don't change the state.. */
if ((previous_state == HYST_OFF) || (previous_state == HYST_ON)) { if ((previous_state == HYST_OFF) || (previous_state == HYST_ON)) {
current_state = previous_state; current_state = previous_state;
} else if (previous_state == REALLY_ON) { } else if (previous_state == REALLY_ON) {

2
src/spicelib/devices/csw/cswmpar.c

@ -37,7 +37,7 @@ CSWmParam(int param, IFvalue *value, GENmodel *inModel)
break; break;
case CSW_IHYS: case CSW_IHYS:
/* take absolute value of hysteresis voltage */ /* take absolute value of hysteresis voltage */
// model->CSWiHysteresis = fabs(value->rValue);
/* model->CSWiHysteresis = fabs(value->rValue); */
model->CSWiHysteresis = value->rValue; model->CSWiHysteresis = value->rValue;
model->CSWhystGiven = TRUE; model->CSWhystGiven = TRUE;
break; break;

15
src/spicelib/devices/hfet1/hfetload.c

@ -16,7 +16,9 @@ Modified: Paolo Nenzi
#define false 0 #define false 0
*/ */
//#define PHIB 0.5
/*
#define PHIB 0.5
*/
double diode(double); double diode(double);
static void leak(double gmin, double vt, double v, double rs, double is1, static void leak(double gmin, double vt, double v, double rs, double is1,
@ -510,7 +512,7 @@ static void leak(double gmin, double vt, double v, double rs, double is1, double
dvdi0 = rs + vt1/(iaprox+is1) + vt2/(iaprox+is2); dvdi0 = rs + vt1/(iaprox+is1) + vt2/(iaprox+is2);
v0 = rs*iaprox; v0 = rs*iaprox;
v0 += vt1*log(iaprox/is1 + 1) + vt2*log(iaprox/is2 + 1); v0 += vt1*log(iaprox/is1 + 1) + vt2*log(iaprox/is2 + 1);
//*il = __max(-is1,iaprox + (v - v0)/dvdi0)*0.99999;
/* *il = __max(-is1,iaprox + (v - v0)/dvdi0)*0.99999; */
*il = MAX(-is1,iaprox + (v - v0)/dvdi0)*0.99999; *il = MAX(-is1,iaprox + (v - v0)/dvdi0)*0.99999;
*gl = 1./(rs + vt1/(*il+is1) + vt2/(*il+is2)); *gl = 1./(rs + vt1/(*il+is1) + vt2/(*il+is2));
} else { } else {
@ -529,7 +531,6 @@ static void hfeta(HFETAmodel *model, HFETAinstance *here, CKTcircuit *ckt,
double *gds, double *capgs, double *capgd, double *gds, double *capgs, double *capgd,
double *cgd, double *gmg, double *gmd, double *cgd, double *gmg, double *gmd,
double *cgs, double *ggs) double *cgs, double *ggs)
{ {
double vt; double vt;
@ -650,7 +651,7 @@ static void hfeta(HFETAmodel *model, HFETAinstance *here, CKTcircuit *ckt,
*gm = g*delvgtvgs; *gm = g*delvgtvgs;
*gds = delidvds + g*sigma; *gds = delidvds + g*sigma;
// Capacitance calculations
/* Capacitance calculations */
temp = ETA1*vt; temp = ETA1*vt;
cg1 = 1/(D1/EPSI+temp*exp(-(vgs-IN_VT1)/temp)); cg1 = 1/(D1/EPSI+temp*exp(-(vgs-IN_VT1)/temp));
cgc = W*L*(CHARGE*delnsnsm*delnsmvgt*delvgtvgs+cg1); cgc = W*L*(CHARGE*delnsnsm*delnsmvgt*delvgtvgs+cg1);
@ -676,7 +677,7 @@ static void hfeta(HFETAmodel *model, HFETAinstance *here, CKTcircuit *ckt,
cgd_calc: cgd_calc:
if(model->HFETAgatemod != 0) { if(model->HFETAgatemod != 0) {
// Gate-drain current calculation
/* Gate-drain current calculation */
double vkneet; double vkneet;
double vmax; double vmax;
double td; double td;
@ -726,7 +727,7 @@ cgd_calc:
} }
if(model->HFETAgatemod != 0) { if(model->HFETAgatemod != 0) {
// Gate-source current calculation
/* Gate-source current calculation */
double evgs; double evgs;
double vtn = vt*M2S; double vtn = vt*M2S;
double csat = ISO*TEMP*TEMP*exp(-PHIB/(CONSTboltz*TEMP)); double csat = ISO*TEMP*TEMP*exp(-PHIB/(CONSTboltz*TEMP));
@ -741,7 +742,7 @@ cgd_calc:
} }
if(model->HFETAgatemod != 0 && (A1 != 0.0 || A2 != 0.0)) { if(model->HFETAgatemod != 0 && (A1 != 0.0 || A2 != 0.0)) {
// Correction current calculations
/* Correction current calculations */
double vmax; double vmax;
double delvdsevmax; double delvdsevmax;
double delvdsevds; double delvdsevds;

10
src/spicelib/devices/hfet1/hfetsetup.c

@ -11,8 +11,10 @@ Modified: Paolo Nenzi
#include "sperror.h" #include "sperror.h"
#include "suffix.h" #include "suffix.h"
//#define HFETAphibGiven
//#define CHARGE 1.60219e-19
/*
#define HFETAphibGiven
#define CHARGE 1.60219e-19
*/
int int
HFETAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) HFETAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
@ -209,7 +211,7 @@ HFETAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
model->HFETAd2 = 0.2e-6; model->HFETAd2 = 0.2e-6;
} }
if(!model->HFETAvt2Given) { if(!model->HFETAvt2Given) {
// initialized in HFETAtemp
/* initialized in HFETAtemp */
model->HFETAvt2 = 0; model->HFETAvt2 = 0;
} }
@ -243,7 +245,7 @@ HFETAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
} }
here->HFETAstate = *states; here->HFETAstate = *states;
// *states += 24;
/* *states += 24; */
*states += HFETAnumStates; *states += HFETAnumStates;
matrixpointers: matrixpointers:

18
src/spicelib/devices/hfet2/hfet2load.c

@ -140,7 +140,7 @@ int HFET2load(GENmodel *inModel, CKTcircuit *ckt)
*(ckt->CKTstate0 + here->HFET2gds)*delvds - *(ckt->CKTstate0 + here->HFET2gds)*delvds -
*(ckt->CKTstate0 + here->HFET2ggd)*delvgd; *(ckt->CKTstate0 + here->HFET2ggd)*delvgd;
// bypass if solution has not changed
/* bypass if solution has not changed */
if((ckt->CKTbypass) && if((ckt->CKTbypass) &&
(!(ckt->CKTmode & MODEINITPRED)) && (!(ckt->CKTmode & MODEINITPRED)) &&
@ -173,7 +173,7 @@ int HFET2load(GENmodel *inModel, CKTcircuit *ckt)
goto load; goto load;
} }
// limit nonlinear branch voltages
/* limit nonlinear branch voltages */
ichk1=1; ichk1=1;
vgs = DEVpnjlim(vgs,*(ckt->CKTstate0 + here->HFET2vgs),CONSTvt0,vcrit, &icheck); vgs = DEVpnjlim(vgs,*(ckt->CKTstate0 + here->HFET2vgs),CONSTvt0,vcrit, &icheck);
@ -220,7 +220,7 @@ int HFET2load(GENmodel *inModel, CKTcircuit *ckt)
cd = cdrain - cgd; cd = cdrain - cgd;
if((ckt->CKTmode & (MODETRAN|MODEINITSMSIG)) || ((ckt->CKTmode & MODETRANOP) && if((ckt->CKTmode & (MODETRAN|MODEINITSMSIG)) || ((ckt->CKTmode & MODETRANOP) &&
(ckt->CKTmode & MODEUIC)) ){ (ckt->CKTmode & MODEUIC)) ){
// charge storage elements
/* charge storage elements */
vgs1 = *(ckt->CKTstate1 + here->HFET2vgs); vgs1 = *(ckt->CKTstate1 + here->HFET2vgs);
vgd1 = *(ckt->CKTstate1 + here->HFET2vgd); vgd1 = *(ckt->CKTstate1 + here->HFET2vgd);
@ -233,7 +233,7 @@ int HFET2load(GENmodel *inModel, CKTcircuit *ckt)
*(ckt->CKTstate0+here->HFET2qgd) = *(ckt->CKTstate1+here->HFET2qgd) *(ckt->CKTstate0+here->HFET2qgd) = *(ckt->CKTstate1+here->HFET2qgd)
+ capgd*(vgd-vgd1); + capgd*(vgd-vgd1);
// store small-signal parameters
/* store small-signal parameters */
if( (!(ckt->CKTmode & MODETRANOP)) || (!(ckt->CKTmode & MODEUIC)) ) { if( (!(ckt->CKTmode & MODETRANOP)) || (!(ckt->CKTmode & MODEUIC)) ) {
if(ckt->CKTmode & MODEINITSMSIG) { if(ckt->CKTmode & MODEINITSMSIG) {
@ -242,7 +242,7 @@ int HFET2load(GENmodel *inModel, CKTcircuit *ckt)
continue; /*go to 1000*/ continue; /*go to 1000*/
} }
// transient analysis
/* transient analysis */
if(ckt->CKTmode & MODEINITTRAN) { if(ckt->CKTmode & MODEINITTRAN) {
*(ckt->CKTstate1 + here->HFET2qgs) = *(ckt->CKTstate0 + here->HFET2qgs); *(ckt->CKTstate1 + here->HFET2qgs) = *(ckt->CKTstate0 + here->HFET2qgs);
@ -265,7 +265,7 @@ int HFET2load(GENmodel *inModel, CKTcircuit *ckt)
} }
} }
// check convergence
/* check convergence */
if( (!(ckt->CKTmode & MODEINITFIX)) | (!(ckt->CKTmode & MODEUIC))) { if( (!(ckt->CKTmode & MODEINITFIX)) | (!(ckt->CKTmode & MODEUIC))) {
if((icheck == 1) if((icheck == 1)
@ -287,7 +287,7 @@ int HFET2load(GENmodel *inModel, CKTcircuit *ckt)
*(ckt->CKTstate0 + here->HFET2ggs) = ggs; *(ckt->CKTstate0 + here->HFET2ggs) = ggs;
*(ckt->CKTstate0 + here->HFET2ggd) = ggd; *(ckt->CKTstate0 + here->HFET2ggd) = ggd;
// load current vector
/* load current vector */
load: load:
@ -300,7 +300,7 @@ load:
*(ckt->CKTrhs + here->HFET2drainPrimeNode) += m * (-cdreq+ceqgd); *(ckt->CKTrhs + here->HFET2drainPrimeNode) += m * (-cdreq+ceqgd);
*(ckt->CKTrhs + here->HFET2sourcePrimeNode) += m * (cdreq+ceqgs); *(ckt->CKTrhs + here->HFET2sourcePrimeNode) += m * (cdreq+ceqgs);
// load y matrix
/* load y matrix */
*(here->HFET2drainDrainPrimePtr) += m * (-gdpr); *(here->HFET2drainDrainPrimePtr) += m * (-gdpr);
*(here->HFET2gateDrainPrimePtr) += m * (-ggd); *(here->HFET2gateDrainPrimePtr) += m * (-ggd);
@ -449,7 +449,7 @@ static void hfeta2(HFET2model *model, HFET2instance *here, CKTcircuit *ckt,
*gm = g*delvgtvgs; *gm = g*delvgtvgs;
*gds = delidvds + g*sigma; *gds = delidvds + g*sigma;
// Capacitance calculations
/* Capacitance calculations */
temp = ETA1*vt; temp = ETA1*vt;
cg1 = 1/(D1/EPSI+temp*exp(-(vgs-HFET2_VT1)/temp)); cg1 = 1/(D1/EPSI+temp*exp(-(vgs-HFET2_VT1)/temp));
cgc = W*L*(CHARGE*delnsnsm*delnsmvgt*delvgtvgs+cg1); cgc = W*L*(CHARGE*delnsnsm*delnsmvgt*delvgtvgs+cg1);

4
src/spicelib/devices/hfet2/hfet2setup.c

@ -105,10 +105,10 @@ int HFET2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state
if(!model->HFET2vsigmatGiven) if(!model->HFET2vsigmatGiven)
VSIGMAT = 0.3; VSIGMAT = 0.3;
if(!model->HFET2vt1Given) if(!model->HFET2vt1Given)
// initialized in HFET2temp
/* initialized in HFET2temp */
HFET2_VT1 = 0; HFET2_VT1 = 0;
if(!model->HFET2vt2Given) if(!model->HFET2vt2Given)
// initialized in HFET2temp
/* initialized in HFET2temp */
VT2 = 0; VT2 = 0;
if(!model->HFET2vtoGiven) { if(!model->HFET2vtoGiven) {
if(model->HFET2type == NHFET) if(model->HFET2type == NHFET)

2
src/spicelib/devices/hisim/hisim.h

@ -12,7 +12,7 @@
#ifndef _HiSIM_H #ifndef _HiSIM_H
#define _HiSIM_H #define _HiSIM_H
/*#define HiSIM_TIME 0*/
/* #define HiSIM_TIME 0*/
/* return value */ /* return value */
#ifndef OK #ifndef OK

2
src/spicelib/devices/hisim/hsm1eval120.c

@ -68,7 +68,7 @@
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>
#ifdef __STDC__ #ifdef __STDC__
//# include <ieeefp.h>
/* # include <ieeefp.h> */
#endif #endif
/*-----------------------------------* /*-----------------------------------*

2
src/spicelib/parser/ptfuncs.c

@ -158,7 +158,7 @@ PTustep2(double arg)
return 0.0; return 0.0;
else if (arg <= 1.0) else if (arg <= 1.0)
return arg; return arg;
else //if (arg > 1.0)
else /* if (arg > 1.0) */
return 1.0; return 1.0;
} }

Loading…
Cancel
Save