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

This commit is contained in:
pnenzi 2005-12-04 08:52:10 +00:00
parent 517e9e0afc
commit 5296cd51b8
14 changed files with 62 additions and 36 deletions

View File

@ -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>
* Added manual page for ngmultidec. The man page has been written

View File

@ -195,8 +195,8 @@ Func short freadstr(Pfile f, Pchar s, short max);
Func char freadc(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 absf(double x); /* abs */
Func long absi( long i);

View File

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

View File

@ -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(;;){
ckt->CKTnoncon=0;

View File

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

View File

@ -25,8 +25,10 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt)
double i_ctrl;
double previous_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 */
for( ; model != NULL; model = model->CSWnextModel ) {
@ -83,8 +85,11 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt)
current_state = REALLY_ON;
} else if (i_ctrl < (model->CSWiThreshold + model->CSWiHysteresis)) {
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)) {
current_state = previous_state;
} else if (previous_state == REALLY_ON) {
@ -116,8 +121,11 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt)
current_state = REALLY_ON;
} else if (i_ctrl < (model->CSWiThreshold + model->CSWiHysteresis)) {
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)) {
current_state = previous_state;
} else if (previous_state == REALLY_ON) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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