Resolution of merge conflicts with pre-master.

This commit is contained in:
Jim Monte 2020-02-22 01:04:18 -05:00
commit 69c6fd72da
17 changed files with 225 additions and 61 deletions

View File

@ -62,7 +62,7 @@ c1 18 0 .1p
option xmu = 0.49
* set xmu=0.49
set num_threads=4
set num_threads=8
set noinit
run

View File

@ -1332,7 +1332,7 @@ devexpand(char *name)
if (strchr(name, '*') || strchr(name, '[') || strchr(name, '?')) {
devices = cp_cctowl(ft_curckt->ci_devices);
for (wl = NULL; devices; devices = devices->wl_next)
if (cp_globmatch(name, devices->wl_word))
if (!strcmp(name, devices->wl_word))
wl = wl_cons(devices->wl_word, wl);
} else if (cieq(name, "all")) {
wl = cp_cctowl(ft_curckt->ci_devices);

View File

@ -159,7 +159,7 @@ static void inp_add_series_resistor(struct card *deck);
static void subckt_params_to_param(struct card *deck);
static void inp_fix_temper_in_param(struct card *deck);
static void inp_fix_agauss_in_param(struct card *deck, char *fcn);
static void inp_vdmos_model(struct card *deck);
static int inp_vdmos_model(struct card *deck);
static void inp_check_syntax(struct card *deck);
static char *inp_spawn_brace(char *s);
@ -638,7 +638,9 @@ struct card *inp_readall(FILE *fp, const char *dir_name,
inp_remove_excess_ws(working);
inp_vdmos_model(working);
if(inp_vdmos_model(working))
return NULL;;
/* don't remove unused model if we have an .if clause, because we
cannot yet decide here which model we finally will need */
if (!has_if) {
@ -6892,13 +6894,14 @@ static void inp_quote_params(struct card *c, struct card *end_c,
Assemble all other tokens in a wordlist, and flatten it
to become the new .model line.
*/
static void inp_vdmos_model(struct card *deck)
static int inp_vdmos_model(struct card *deck)
{
struct card *card;
for (card = deck; card; card = card->nextcard) {
char *curr_line, *cut_line, *token, *new_line;
wordlist *wl = NULL, *wlb;
int i;
curr_line = cut_line = card->line;
@ -6933,7 +6936,22 @@ static void inp_vdmos_model(struct card *deck)
tfree(card->line);
card->line = new_line;
}
/* we have a VDMOS instance line with 'tnodeout' and thus need exactly 5 nodes
*/
else if (strstr(curr_line, "tnodeout")) {
for (i = 0; i < 7; i++)
curr_line = nexttok(curr_line);
if (!ciprefix("tnodeout", curr_line)) {
fprintf(cp_err,
"Error: We need exactly 5 nodes\n"
" drain, gate, source, tjunction, tcase\n"
" in VDMOS instance line\n"
" %s\n", card->line);
return 1;
}
}
}
return 0;
}

View File

@ -471,7 +471,7 @@ void free_pnode_x(struct pnode *t)
free_pnode(t->pn_right);
free_pnode(t->pn_next);
tfree(t->pn_name); /* va: it is a copy() of original string, can be free'd */
if (t->pn_value && !(t->pn_value->v_flags & VF_PERMANENT)) {
if (t->pn_use == 1 && t->pn_value && !(t->pn_value->v_flags & VF_PERMANENT)) {
vec_free(t->pn_value); /* patch by Stefan Jones */
}
txfree(t);

View File

@ -24,7 +24,7 @@ com_spec(wordlist *wl)
{
ngcomplex_t **fdvec = NULL;
double **tdvec = NULL;
double *win = NULL, *time, *dc = NULL;
double *freq, *win = NULL, *time, *dc = NULL;
double startf, stopf, stepf, span;
int fpts, i, j, k, tlen, ngood;
bool trace;
@ -209,6 +209,7 @@ com_spec(wordlist *wl)
VF_REAL | VF_PERMANENT | VF_PRINT,
fpts, NULL);
vec_new(f);
freq = f->v_realdata;
tdvec = TMALLOC(double *, ngood);
fdvec = TMALLOC(ngcomplex_t *, ngood);
@ -235,41 +236,38 @@ com_spec(wordlist *wl)
}
trace = cp_getvar("spectrace", CP_BOOL, NULL, 0);
{
double * const freq = f->v_realdata;
for (j = (startf == 0 ? 1 : 0); j < fpts; j++) {
freq[j] = startf + j*stepf;
if (trace) {
fprintf(cp_err, "spec: %e Hz: \r", freq[j]);
}
for (i = 0; i < ngood; i++) {
fdvec[i][j].cx_real = 0;
fdvec[i][j].cx_imag = 0;
}
for (k = 1; k < tlen; k++) {
double
amp = 2*win[k]/(tlen-1),
rad = 2*M_PI*time[k]*freq[j],
cosa = amp*cos(rad),
sina = amp*sin(rad);
for (i = 0; i < ngood; i++) {
double value = tdvec[i][k]-dc[i];
fdvec[i][j].cx_real += value*cosa;
fdvec[i][j].cx_imag += value*sina;
}
}
#ifdef HAS_PROGREP
SetAnalyse("spec", (int)(j * 1000./ fpts));
#endif
for (j = (startf == 0 ? 1 : 0); j < fpts; j++) {
freq[j] = startf + j*stepf;
if (trace) {
fprintf(cp_err, "spec: %e Hz: \r", freq[j]);
}
if (startf == 0) {
freq[0] = 0;
for (i = 0; i < ngood; i++) {
fdvec[i][j].cx_real = 0;
fdvec[i][j].cx_imag = 0;
}
for (k = 1; k < tlen; k++) {
double
amp = 2*win[k]/(tlen-1),
rad = 2*M_PI*time[k]*freq[j],
cosa = amp*cos(rad),
sina = amp*sin(rad);
for (i = 0; i < ngood; i++) {
fdvec[i][0].cx_real = dc[i];
fdvec[i][0].cx_imag = 0;
double value = tdvec[i][k]-dc[i];
fdvec[i][j].cx_real += value*cosa;
fdvec[i][j].cx_imag += value*sina;
}
}
#ifdef HAS_PROGREP
SetAnalyse("spec", (int)(j * 1000./ fpts));
#endif
}
if (startf == 0) {
freq[0] = 0;
for (i = 0; i < ngood; i++) {
fdvec[i][0].cx_real = dc[i];
fdvec[i][0].cx_imag = 0;
}
}
if (trace)

View File

@ -1628,7 +1628,7 @@ char* outstorage(char* wordin, bool write)
An update occurs only every DELTATIME milliseconds. */
#define DELTATIME 150
void SetAnalyse(
char * Analyse, /*in: analysis type */
const char * Analyse, /*in: analysis type */
int DecaPercent /*in: 10 times the progress [%]*/
/*HWND hwAnalyse, in: global handle to analysis window */
) {
@ -1995,7 +1995,6 @@ getvsrcval(double time, char *vname)
if (!wantvdat) {
fprintf(stderr, "Error: No callback supplied for source %s\n", vname);
shared_exit(EXIT_BAD);
return(EXIT_BAD);
}
else {
/* callback fcn */
@ -2013,7 +2012,6 @@ getisrcval(double time, char *iname)
if (!wantidat) {
fprintf(stderr, "Error: No callback supplied for source %s\n", iname);
shared_exit(EXIT_BAD);
return(EXIT_BAD);
}
else {
/* callback fcn */

View File

@ -89,10 +89,20 @@ IFparm VDMOSmPTable[] = { /* model parameters */
IOPR("bex", VDMOS_MOD_MU, IF_REAL, "Exponent of gain temperature dependency"),
IOP( "texp0", VDMOS_MOD_TEXP0, IF_REAL, "Drain resistance rd0 temperature exponent"),
IOP( "texp1", VDMOS_MOD_TEXP1, IF_REAL, "Drain resistance rd1 temperature exponent"),
IOP( "trd1", VDMOS_MOD_TRD1, IF_REAL, "Drain resistance linear temperature coefficient"),
IOP( "trd2", VDMOS_MOD_TRD2, IF_REAL, "Drain resistance quadratic temperature coefficient"),
IOP( "trg1", VDMOS_MOD_TRG1, IF_REAL, "Gate resistance linear temperature coefficient"),
IOP( "trg2", VDMOS_MOD_TRG2, IF_REAL, "Gate resistance quadratic temperature coefficient"),
IOP( "trs1", VDMOS_MOD_TRS1, IF_REAL, "Source resistance linear temperature coefficient"),
IOP( "trs2", VDMOS_MOD_TRS2, IF_REAL, "Source resistance quadratic temperature coefficient"),
IOP( "trb1", VDMOS_MOD_TRB1, IF_REAL, "Body resistance linear temperature coefficient"),
IOP( "trb2", VDMOS_MOD_TRB2, IF_REAL, "Body resistance quadratic temperature coefficient"),
/* weak inversion */
IOP("subshift", VDMOS_MOD_SUBSHIFT, IF_REAL, "Shift of weak inversion plot on the vgs axis"),
IOP("ksubthres", VDMOS_MOD_KSUBTHRES, IF_REAL, "Slope of weak inversion log current versus vgs"),
IOP("tksubthres1", VDMOS_MOD_TKSUBTHRES1, IF_REAL, "Linear temperature coefficient of ksubthres"),
IOP("tksubthres2", VDMOS_MOD_TKSUBTHRES2, IF_REAL, "Quadratic temperature coefficient of ksubthres"),
/* body diode */
IOP("bv", VDMOS_MOD_BV, IF_REAL, "Vds breakdown voltage"),

View File

@ -69,6 +69,7 @@ typedef struct sVDMOSinstance {
double VDMOStTransconductance; /* temperature corrected transconductance*/
double VDMOStPhi; /* temperature corrected Phi */
double VDMOStVth; /* temperature corrected Vth */
double VDMOStksubthres; /* temperature weak inversion slope */
double VDMOSicVDS; /* initial condition D-S voltage */
double VDMOSicVGS; /* initial condition G-S voltage */
@ -332,13 +333,23 @@ typedef struct sVDMOSmodel { /* model structure for a resistor */
double VDIOgradCoeffTemp1;
double VDIOgradCoeffTemp2;
double VDMOStcvth;
double VDMOSrthjc;
double VDMOSrthca;
double VDMOScthj;
double VDMOSmu;
double VDMOStexp0;
double VDMOStexp1;
double VDMOStcvth;
double VDMOStrd1;
double VDMOStrd2;
double VDMOStrg1;
double VDMOStrg2;
double VDMOStrs1;
double VDMOStrs2;
double VDMOStrb1;
double VDMOStrb2;
double VDMOStksubthres1;
double VDMOStksubthres2;
double VDMOSvgsMax;
double VDMOSvgdMax;
@ -385,13 +396,23 @@ typedef struct sVDMOSmodel { /* model structure for a resistor */
unsigned VDMOSegGiven :1;
unsigned VDMOSxtiGiven :1;
unsigned VDMOStcvthGiven :1;
unsigned VDMOSrthjcGiven :1;
unsigned VDMOSrthcaGiven :1;
unsigned VDMOScthjGiven :1;
unsigned VDMOSmuGiven :1;
unsigned VDMOStexp0Given :1;
unsigned VDMOStexp1Given :1;
unsigned VDMOStcvthGiven :1;
unsigned VDMOStrd1Given :1;
unsigned VDMOStrd2Given :1;
unsigned VDMOStrg1Given :1;
unsigned VDMOStrg2Given :1;
unsigned VDMOStrs1Given :1;
unsigned VDMOStrs2Given :1;
unsigned VDMOStrb1Given :1;
unsigned VDMOStrb2Given :1;
unsigned VDMOStksubthres1Given :1;
unsigned VDMOStksubthres2Given :1;
unsigned VDMOSvgsMaxGiven :1;
unsigned VDMOSvgdMaxGiven :1;
@ -462,13 +483,23 @@ enum {
VDMOS_MOD_TT,
VDMOS_MOD_EG,
VDMOS_MOD_XTI,
VDMOS_MOD_TCVTH,
VDMOS_MOD_RTHJC,
VDMOS_MOD_RTHCA,
VDMOS_MOD_CTHJ,
VDMOS_MOD_MU,
VDMOS_MOD_TEXP0,
VDMOS_MOD_TEXP1,
VDMOS_MOD_TCVTH,
VDMOS_MOD_TRD1,
VDMOS_MOD_TRD2,
VDMOS_MOD_TRG1,
VDMOS_MOD_TRG2,
VDMOS_MOD_TRS1,
VDMOS_MOD_TRS2,
VDMOS_MOD_TRB1,
VDMOS_MOD_TRB2,
VDMOS_MOD_TKSUBTHRES1,
VDMOS_MOD_TKSUBTHRES2,
VDMOS_MOD_VGS_MAX,
VDMOS_MOD_VGD_MAX,
VDMOS_MOD_VDS_MAX,

View File

@ -314,7 +314,7 @@ VDMOSload(GENmodel *inModel, CKTcircuit *ckt)
if (selfheat) {
double TempRatio = Temp / here->VDMOStemp;
Beta = here->VDMOStTransconductance * pow(TempRatio,model->VDMOSmu);
dBeta_dT = here->VDMOStTransconductance * model->VDMOSmu / (here->VDMOStemp * pow(TempRatio,1-model->VDMOSmu));
dBeta_dT = Beta * model->VDMOSmu / Temp;
rd0T = here->VDMOSdrainResistance * pow(TempRatio, model->VDMOStexp0);
drd0T_dT = rd0T * model->VDMOStexp0 / Temp;
rd1T = 0.0;
@ -372,7 +372,7 @@ VDMOSload(GENmodel *inModel, CKTcircuit *ckt)
* Scale the voltage overdrive vgst logarithmically in weak inversion.
* Best fits LTSPICE curves with shift=0
*/
double slope = model->VDMOSksubthres;
double slope = here->VDMOStksubthres;
double lambda = model->VDMOSlambda;
double theta = model->VDMOStheta;
double shift = model->VDMOSsubshift;

View File

@ -125,6 +125,9 @@ VDMOSmAsk(CKTcircuit *ckt, GENmodel *inst, int which, IFvalue *value)
case VDMOS_MOD_XTI:
value->rValue = model->VDMOSxti;
return(OK);
case VDMOS_MOD_TCVTH:
value->rValue = model->VDMOStcvth;
return(OK);
case VDMOS_MOD_RTHJC:
value->rValue = model->VDMOSrthjc;
return(OK);
@ -143,8 +146,35 @@ VDMOSmAsk(CKTcircuit *ckt, GENmodel *inst, int which, IFvalue *value)
case VDMOS_MOD_TEXP1:
value->rValue = model->VDMOStexp1;
return(OK);
case VDMOS_MOD_TCVTH:
value->rValue = model->VDMOStcvth;
case VDMOS_MOD_TRD1:
value->rValue = model->VDMOStrd1;
return(OK);
case VDMOS_MOD_TRD2:
value->rValue = model->VDMOStrd2;
return(OK);
case VDMOS_MOD_TRG1:
value->rValue = model->VDMOStrg1;
return(OK);
case VDMOS_MOD_TRG2:
value->rValue = model->VDMOStrg2;
return(OK);
case VDMOS_MOD_TRS1:
value->rValue = model->VDMOStrs1;
return(OK);
case VDMOS_MOD_TRS2:
value->rValue = model->VDMOStrs2;
return(OK);
case VDMOS_MOD_TRB1:
value->rValue = model->VDMOStrb1;
return(OK);
case VDMOS_MOD_TRB2:
value->rValue = model->VDMOStrb2;
return(OK);
case VDMOS_MOD_TKSUBTHRES1:
value->rValue = model->VDMOStksubthres1;
return(OK);
case VDMOS_MOD_TKSUBTHRES2:
value->rValue = model->VDMOStksubthres2;
return(OK);
case VDMOS_MOD_VGS_MAX:
value->rValue = model->VDMOSvgsMax;

View File

@ -174,6 +174,10 @@ VDMOSmParam(int param, IFvalue *value, GENmodel *inModel)
model->VDMOSxti = value->rValue;
model->VDMOSxtiGiven = TRUE;
break;
case VDMOS_MOD_TCVTH:
model->VDMOStcvth = value->rValue;
model->VDMOStcvthGiven = TRUE;
break;
case VDMOS_MOD_RTHJC:
model->VDMOSrthjc = value->rValue;
model->VDMOSrthjcGiven = TRUE;
@ -198,9 +202,45 @@ VDMOSmParam(int param, IFvalue *value, GENmodel *inModel)
model->VDMOStexp1 = value->rValue;
model->VDMOStexp1Given = TRUE;
break;
case VDMOS_MOD_TCVTH:
model->VDMOStcvth = value->rValue;
model->VDMOStcvthGiven = TRUE;
case VDMOS_MOD_TRD1:
model->VDMOStrd1 = value->rValue;
model->VDMOStrd1Given = TRUE;
break;
case VDMOS_MOD_TRD2:
model->VDMOStrd2 = value->rValue;
model->VDMOStrd2Given = TRUE;
break;
case VDMOS_MOD_TRG1:
model->VDMOStrg1 = value->rValue;
model->VDMOStrg1Given = TRUE;
break;
case VDMOS_MOD_TRG2:
model->VDMOStrg2 = value->rValue;
model->VDMOStrg2Given = TRUE;
break;
case VDMOS_MOD_TRS1:
model->VDMOStrs1 = value->rValue;
model->VDMOStrs1Given = TRUE;
break;
case VDMOS_MOD_TRS2:
model->VDMOStrs2 = value->rValue;
model->VDMOStrs2Given = TRUE;
break;
case VDMOS_MOD_TRB1:
model->VDMOStrb1 = value->rValue;
model->VDMOStrb1Given = TRUE;
break;
case VDMOS_MOD_TRB2:
model->VDMOStrb2 = value->rValue;
model->VDMOStrb2Given = TRUE;
break;
case VDMOS_MOD_TKSUBTHRES1:
model->VDMOStksubthres1 = value->rValue;
model->VDMOStksubthres1Given = TRUE;
break;
case VDMOS_MOD_TKSUBTHRES2:
model->VDMOStksubthres2 = value->rValue;
model->VDMOStksubthres2Given = TRUE;
break;
case VDMOS_MOD_VGS_MAX:
model->VDMOSvgsMax = value->rValue;

View File

@ -139,6 +139,36 @@ VDMOSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt,
if (!model->VDMOStexp1Given)
model->VDMOStexp1 = 0.3;
if (!model->VDMOStrd1Given)
model->VDMOStrd1 = 0.0;
if (!model->VDMOStrd2Given)
model->VDMOStrd2 = 0.0;
if (!model->VDMOStrg1Given)
model->VDMOStrg1 = 0.0;
if (!model->VDMOStrg2Given)
model->VDMOStrg2 = 0.0;
if (!model->VDMOStrs1Given)
model->VDMOStrs1 = 0.0;
if (!model->VDMOStrs2Given)
model->VDMOStrs2 = 0.0;
if (!model->VDMOStrb1Given)
model->VDMOStrb1 = 0.0;
if (!model->VDMOStrb2Given)
model->VDMOStrb2 = 0.0;
if (!model->VDMOStksubthres1Given)
model->VDMOStksubthres1 = 0.0;
if (!model->VDMOStksubthres2Given)
model->VDMOStksubthres2 = 0.0;
if (!model->VDMOSvgsMaxGiven)
model->VDMOSvgsMax = 1e99;

View File

@ -98,7 +98,16 @@ VDMOStemp(GENmodel *inModel, CKTcircuit *ckt)
here->VDMOStVth = model->VDMOSvth0 - model->VDMOStype * model->VDMOStcvth * dt;
here->VDMOSdrainResistance = model->VDMOSdrainResistance / here->VDMOSm * pow(ratio, model->VDMOStexp0);
here->VDMOStksubthres = model->VDMOSksubthres * (1.0 + (model->VDMOStksubthres1 * dt) + (model->VDMOStksubthres2 * dt * dt));
if (model->VDMOStexp0Given)
here->VDMOSdrainResistance = model->VDMOSdrainResistance / here->VDMOSm * pow(ratio, model->VDMOStexp0);
else
here->VDMOSdrainResistance = model->VDMOSdrainResistance / here->VDMOSm * (1.0 + (model->VDMOStrd1 * dt) + (model->VDMOStrd2 * dt * dt));
here->VDMOSgateConductance = here->VDMOSgateConductance / (1.0 + (model->VDMOStrg1 * dt) + (model->VDMOStrg2 * dt * dt));
here->VDMOSsourceConductance = here->VDMOSsourceConductance / (1.0 + (model->VDMOStrs1 * dt) + (model->VDMOStrs2 * dt * dt));
if (model->VDMOSqsGiven)
here->VDMOSqsResistance = model->VDMOSqsResistance / here->VDMOSm * pow(ratio, model->VDMOStexp1);
@ -206,8 +215,8 @@ VDMOStemp(GENmodel *inModel, CKTcircuit *ckt)
+ (model->VDIOtranTimeTemp2 * dt * dt);
here->VDIOtTransitTime = model->VDIOtransitTime * factor;
/* Series resistance temperature adjust (not implemented yet) */
here->VDIOtConductance = here->VDIOconductance;
/* Series resistance temperature adjust */
here->VDIOtConductance = here->VDIOconductance / (1.0 + (model->VDMOStrb1 * dt) + (model->VDMOStrb2 * dt * dt));
here->VDIOtF2 = exp((1 + here->VDIOtGradingCoeff)*xfc);
here->VDIOtF3 = 1 - model->VDIOdepletionCapCoeff*

View File

@ -43,8 +43,8 @@ clean:
#-----------------------------------------------------------------------------
NGSRCDIR = $(CURDIR)/../../../../src
COMPILE = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(VIS_CFLAGS)
NGSRCDIR = $(srcdir)/../../
dstring.o : $(NGSRCDIR)/misc/dstring.c $(NGSRCDIR)/include/ngspice/dstring.h
$(COMPILE) -I $(NGSRCDIR)/include -o $@ -c $<

View File

@ -551,7 +551,7 @@ static Table2_Data_t *init_local_data(const char *filename, int interporder)
interporder);
interporder = 2;
}
/* int interporder : interpolation order,
/* int order : interpolation order,
int n1, int n2 : data dimensions */
if ((loc->newtable = sf_eno2_init(
interporder, ix, iy)) == (sf_eno2) NULL) {

View File

@ -115,7 +115,7 @@ extern int findCrossOver(double arr[], int n, double x);
static void free_local_data(Table3_Data_t *loc);
static inline double get_local_diff(int n, double *col, int ind);
static Table3_Data_t *init_local_data(const char *filename, int interporder);
static Table3_Data_t *init_local_data(const char *filename, int order);
static void cm_table3D_callback(ARGS,
Mif_Callback_Reason_t reason)

View File

@ -1,3 +1,3 @@
#Directory Version
int 1
real 1
#Directory
int
real