This commit is contained in:
stefanjones 2003-05-08 09:22:07 +00:00
parent 3e6cd21041
commit c191921453
74 changed files with 1877 additions and 424 deletions

View File

@ -1,3 +1,23 @@
2003-05-02 Stuart Brorson <sdb@cloud9.net>
* Added #define TRACE to main.c for use in debugging. Added lots
of printf's in the code which are turned on by defining TRACE.
This is used to help figure out what the program is doing at each
step . . . . .
* Added lots of comments all over the source tree. This should
help explain what the prog is doing for future hackers.
* Fixed parser to allow POLY attributes in dependent sources
(major changes in src/frontend/subckt.c, as well as move location
of call to ENHtranslate_poly in src/frontend/inp.c)
* Fixed bug in device init files (src/spicelib/devices/*init.c)
so that Deviceinfo structures operated with XSPICE.
* Fixed nasty malloc problem in src/xspice/mif/mifgetmod.c which
casuedfrequent segfaults (when compiled with XSPICE).
2003-04-14 Stefan Jones <stefan.jones@multigig.com> 2003-04-14 Stefan Jones <stefan.jones@multigig.com>
* configure.in: Made Tcl disable-shared and print info at end of configure * configure.in: Made Tcl disable-shared and print info at end of configure

View File

@ -1,4 +1,13 @@
2003.4.10 Stuart Brorson <sdb@cloud9.net> 2003-05-02 Stuart Brorson <SDB@cloud9.net>
* Major changes in subckt.c to handle POLY attributes in
dependent sources. Added new case to switch in "translate" to
handle E, F, G, H sources. Many other fixes.
* Moved location of call to ENHtranslate_poly in inp.c. This was
necessary to correctly process POLY attributes and the associated
netlists and voltage sources.
2003-04-10 Stuart Brorson <sdb@cloud9.net>
* modified inp_readall (inpcom.c) to ignore blank * modified inp_readall (inpcom.c) to ignore blank
lines terminated by \r\n *and * \n. This fixes problems lines terminated by \r\n *and * \n. This fixes problems
associated with importing files from Windozeland. associated with importing files from Windozeland.

View File

@ -50,7 +50,7 @@ com_listing(wordlist *wl)
bool expand = FALSE; bool expand = FALSE;
char *s; char *s;
if (ft_curckt) { if (ft_curckt) { /* if there is a current circuit . . . . */
while (wl) { while (wl) {
s = wl->wl_word; s = wl->wl_word;
switch (*s) { switch (*s) {
@ -285,9 +285,15 @@ line_free(struct line * deck, bool recurse) {
/* The routine to source a spice input deck. We read the deck in, take /* The routine to source a spice input deck. We read the deck in, take
* out the front-end commands, and create a CKT structure. Also we * out the front-end commands, and create a CKT structure. Also we
* filter out the following cards: .save, .width, .four, .print, and * filter out the following cards: .save, .width, .four, .print, and
* .plot, to perform after the run is over. */ * .plot, to perform after the run is over.
* Then, we run dodeck, which parses up the deck. */
void void
inp_spsource(FILE *fp, bool comfile, char *filename) inp_spsource(FILE *fp, bool comfile, char *filename)
/* arguments:
* *fp = pointer to the input file
* comfile = whether it is a command file. Values are TRUE/FALSE
* *filename =
*/
{ {
struct line *deck, *dd, *ld; struct line *deck, *dd, *ld;
struct line *realdeck, *options = NULL; struct line *realdeck, *options = NULL;
@ -298,8 +304,10 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
FILE *lastin, *lastout, *lasterr; FILE *lastin, *lastout, *lasterr;
char c; char c;
/* read in the deck from a file */
inp_readall(fp, &deck); inp_readall(fp, &deck);
/* if nothing came back from inp_readall, just close fp and return to caller */
if (!deck) { /* MW. We must close fp always when returning */ if (!deck) { /* MW. We must close fp always when returning */
fclose(fp); fclose(fp);
return; return;
@ -354,8 +362,10 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
/* tfree(dd->li_line); /* tfree(dd->li_line);
tfree(dd); */ tfree(dd); */
} }
} else { } /* end if(comfile) */
for (dd = deck->li_next; dd; dd = ld->li_next) {
else { /* must be regular deck . . . . */
for (dd = deck->li_next; dd; dd = ld->li_next) { /* loop through deck and handle control cards */
for (s = dd->li_line; (c = *s) && c <= ' '; s++) for (s = dd->li_line; (c = *s) && c <= ' '; s++)
; ;
if (c == '*' && (s != deck->li_line || s[1] != '#')) { if (c == '*' && (s != deck->li_line || s[1] != '#')) {
@ -372,8 +382,10 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
if (ciprefix(".control", dd->li_line)) { if (ciprefix(".control", dd->li_line)) {
ld->li_next = dd->li_next; ld->li_next = dd->li_next;
line_free(dd,FALSE); /* SJB - free this line's memory */ line_free(dd,FALSE); /* SJB - free this line's memory */
/* tfree(dd->li_line); /* tfree(dd->li_line);
tfree(dd); */ tfree(dd); */
if (commands) if (commands)
fprintf(cp_err, fprintf(cp_err,
"Warning: redundant .control card\n"); "Warning: redundant .control card\n");
@ -382,8 +394,10 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
} else if (ciprefix(".endc", dd->li_line)) { } else if (ciprefix(".endc", dd->li_line)) {
ld->li_next = dd->li_next; ld->li_next = dd->li_next;
line_free(dd,FALSE); /* SJB - free this line's memory */ line_free(dd,FALSE); /* SJB - free this line's memory */
/* tfree(dd->li_line); /* tfree(dd->li_line);
tfree(dd); */ tfree(dd); */
if (commands) if (commands)
commands = FALSE; commands = FALSE;
else else
@ -442,38 +456,61 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
} else } else
ld = dd; ld = dd;
} }
} } /* end for(dd=deck->li_next . . . . */
if (deck->li_next) {
/* we are done handling the control stuff. Now process remainder of deck */
if (deck->li_next) {
/* There is something left after the controls. */ /* There is something left after the controls. */
fprintf(cp_out, "\nCircuit: %s\n\n", tt); fprintf(cp_out, "\nCircuit: %s\n\n", tt);
/* Old location of ENHtranslate_poly. This didn't work, because it
* didn't handle models in .SUBCKTs correctly. Moved to new location below
* by SDB on 4.13.2003
*/
/* Now expand subcircuit macros. Note that we have to fix
* the case before we do this but after we deal with the
* commands. */
if (!cp_getvar("nosubckt", VT_BOOL, (char *) &nosubckts))
if( (deck->li_next = inp_subcktexpand(deck->li_next)) == NULL ){
line_free(realdeck,TRUE);
line_free(deck->li_actual, TRUE);
return;
} /* done expanding subcircuit macros */
/* Now handle translation of spice2c6 POLYs. */
/* New location of ENHtranslate_poly. This should handle .SUBCKTs better . . . .
* SDB 4.13.2003. Comments? mailto:sdb@cloud9.net
*/
#ifdef XSPICE #ifdef XSPICE
/* gtri - wbk - Translate all SPICE 2G6 polynomial type sources */ /* gtri - wbk - Translate all SPICE 2G6 polynomial type sources */
deck->li_next = ENHtranslate_poly(deck->li_next); deck->li_next = ENHtranslate_poly(deck->li_next);
/* gtri - end - Translate all SPICE 2G6 polynomial type sources */ /* gtri - end - Translate all SPICE 2G6 polynomial type sources */
#endif #endif
/* Now expand subcircuit macros. Note that we have to fix
* the case before we do this but after we deal with the
* commands. */
if (!cp_getvar("nosubckt", VT_BOOL, (char *) &nosubckts))
if((deck->li_next = inp_subcktexpand(deck->li_next)) == NULL){
line_free(realdeck,TRUE);
line_free(deck->li_actual, TRUE);
return;
}
line_free(deck->li_actual,FALSE); /* SJB - free memory used by old li_actual (if any) */ line_free(deck->li_actual,FALSE); /* SJB - free memory used by old li_actual (if any) */
deck->li_actual = realdeck; deck->li_actual = realdeck;
inp_dodeck(deck, tt, wl_first, FALSE, options, filename);
}
/* Now that the deck is loaded, do the commands */ /* now call inp_dodeck, which loads deck into ft_curckt -- the current circuit. */
if (controls) { inp_dodeck(deck, tt, wl_first, FALSE, options, filename);
} /* if (deck->li_next) */
#ifdef TRACE
/* SDB debug statement */
printf("In inp_spsource, done with dodeck.\n");
#endif
/* Now that the deck is loaded, do the commands if there are any */
if (controls) {
for (end = wl = wl_reverse(controls); wl; wl = wl->wl_next) for (end = wl = wl_reverse(controls); wl; wl = wl->wl_next)
cp_evloop(wl->wl_word); cp_evloop(wl->wl_word);
wl_free(end); wl_free(end);
} }
} }
/*saj, to process save commands always, not just in batch mode /*saj, to process save commands always, not just in batch mode
@ -495,9 +532,21 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
* follows also. End is the list of commands we execute when the job * follows also. End is the list of commands we execute when the job
* is finished: we only bother with this if we might be running in * is finished: we only bother with this if we might be running in
* batch mode, since it isn't much use otherwise. */ * batch mode, since it isn't much use otherwise. */
/*------------------------------------------------------------------
* It appears that inp_dodeck adds the circuit described by *deck
* to the current circuit (ft_curckt).
*-----------------------------------------------------------------*/
void void
inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse, inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse,
struct line *options, char *filename) struct line *options, char *filename)
/*fcn arguments:
* *deck = the spice deck
* *tt = the title of the deck
* *end = pointer to the wordlist
* reuse
* *options
* *filename
*/
{ {
struct circ *ct; struct circ *ct;
struct line *dd; struct line *dd;
@ -527,23 +576,39 @@ inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse,
ft_curckt = ct = alloc(struct circ); ft_curckt = ct = alloc(struct circ);
} }
cp_getvar("noparse", VT_BOOL, (char *) &noparse); cp_getvar("noparse", VT_BOOL, (char *) &noparse);
/*----------------------------------------------------
* Now assuming that we wanna parse this deck, we call
* if_inpdeck which takes the deck and returns a
* a pointer to the circuit ckt.
*---------------------------------------------------*/
if (!noparse) if (!noparse)
ckt = if_inpdeck(deck, &tab); ckt = if_inpdeck(deck, &tab);
else else
ckt = NULL; ckt = NULL;
out_init(); out_init();
/*----------------------------------------------------
* Now run throuh the deck and look to see if there are
* errors on any line.
*---------------------------------------------------*/
for (dd = deck; dd; dd = dd->li_next) { for (dd = deck; dd; dd = dd->li_next) {
/* debug statement */ #ifdef TRACE
/* printf("In inp_dodeck, examining line %s . . . \n", dd->li_line); */ /* SDB debug statement */
printf("In inp_dodeck, looking for errors and examining line %s . . . \n", dd->li_line);
#endif
if (dd->li_error) { if (dd->li_error) {
char *p, *q; char *p, *q;
#ifdef XSPICE #ifdef XSPICE
/* gtri - modify - 12/12/90 - wbk - add setting of ipc syntax error flag */ g_ipc.syntax_error = IPC_TRUE; /* gtri - modify - 12/12/90 - wbk - add setting of ipc syntax error flag */
g_ipc.syntax_error = IPC_TRUE;
#endif #endif
/* gtri - end - 12/12/90 */ /* gtri - end - 12/12/90 */
p = dd->li_error; p = dd->li_error;
do { do {
q =strchr(p, '\n'); q =strchr(p, '\n');
@ -576,7 +641,7 @@ inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse,
cp_kwswitch(CT_NODENAMES, ft_curckt->ci_nodes); cp_kwswitch(CT_NODENAMES, ft_curckt->ci_nodes);
ft_newcirc(ct); ft_newcirc(ct);
/* Assign current circuit */ /* Assign current circuit */
ft_curckt = ct; ft_curckt = ct;
} }
ct->ci_name = tt; ct->ci_name = tt;
ct->ci_deck = deck; ct->ci_deck = deck;
@ -585,7 +650,7 @@ inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse,
ct->ci_origdeck = deck->li_actual; ct->ci_origdeck = deck->li_actual;
else else
ct->ci_origdeck = ct->ci_deck; ct->ci_origdeck = ct->ci_deck;
ct->ci_ckt = ckt; ct->ci_ckt = ckt; /* attach the input ckt to the list of circuits */
ct->ci_symtab = tab; ct->ci_symtab = tab;
ct->ci_inprogress = FALSE; ct->ci_inprogress = FALSE;
ct->ci_runonce = FALSE; ct->ci_runonce = FALSE;
@ -616,24 +681,24 @@ inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse,
static int one = 1; static int one = 1;
switch (eev->va_type) { switch (eev->va_type) {
case VT_BOOL: case VT_BOOL:
if_option(ct->ci_ckt, eev->va_name, if_option(ct->ci_ckt, eev->va_name,
eev->va_type, &one); eev->va_type, &one);
break; break;
case VT_NUM: case VT_NUM:
if_option(ct->ci_ckt, eev->va_name, if_option(ct->ci_ckt, eev->va_name,
eev->va_type, (char *) &eev->va_num); eev->va_type, (char *) &eev->va_num);
break; break;
case VT_REAL: case VT_REAL:
if_option(ct->ci_ckt, eev->va_name, if_option(ct->ci_ckt, eev->va_name,
eev->va_type, (char *) &eev->va_real); eev->va_type, (char *) &eev->va_real);
break; break;
case VT_STRING: case VT_STRING:
if_option(ct->ci_ckt, eev->va_name, if_option(ct->ci_ckt, eev->va_name,
eev->va_type, eev->va_string); eev->va_type, eev->va_string);
break; break;
} } /* switch . . . */
} }
} } /* if (!noparse) . . . */
cp_addkword(CT_CKTNAMES, tt); cp_addkword(CT_CKTNAMES, tt);
return; return;

View File

@ -174,8 +174,10 @@ inp_readall(FILE *fp, struct line **data)
while ((buffer = readline(fp))) { while ((buffer = readline(fp))) {
#endif #endif
/* debug statement */ #ifdef TRACE
/* printf ("in inp_readall, just read %s . . .\n", buffer); */ /* SDB debug statement */
printf ("in inp_readall, just read %s . . .\n", buffer);
#endif
/* OK -- now we have loaded the next line into 'buffer'. Process it. */ /* OK -- now we have loaded the next line into 'buffer'. Process it. */
/* If input line is blank, ignore it & continue looping. */ /* If input line is blank, ignore it & continue looping. */
@ -199,8 +201,9 @@ inp_readall(FILE *fp, struct line **data)
fprintf(cp_err, "Warning: premature EOF\n"); fprintf(cp_err, "Warning: premature EOF\n");
} }
*s = '\0'; /* Zap the newline. */ *s = '\0'; /* Zap the newline. */
if ( s > buffer && s[-1] == '\r') /* Zap the carriage return under windows */
s[-1] = '\0'; if(*(s-1) == '\r') /* Zop the carriage return under windows */
*(s-1) = '\0';
/* now handle .include statements */ /* now handle .include statements */
if (ciprefix(".include", buffer)) { if (ciprefix(".include", buffer)) {
@ -304,8 +307,10 @@ inp_readall(FILE *fp, struct line **data)
for (s = working->li_line; (c = *s) && c <= ' '; s++) for (s = working->li_line; (c = *s) && c <= ' '; s++)
; ;
/* debug statement */ #ifdef TRACE
/* printf("Now processing linked list, at s = %s . . . \n", s); */ /* SDB debug statement */
printf("In inp_readall, processing linked list element s = %s . . . \n", s);
#endif
switch (c) { switch (c) {
case '#': case '#':

View File

@ -326,6 +326,7 @@ baseaddr(void)
if (getenv("SPICE_NO_DATASEG_CHECK")) if (getenv("SPICE_NO_DATASEG_CHECK"))
return 0; return 0;
low = 0; low = 0;
high = (char *) ((unsigned long) sbrk(0) & ~((1 << LOG2_PAGESIZE) - 1)); high = (char *) ((unsigned long) sbrk(0) & ~((1 << LOG2_PAGESIZE) - 1));

View File

@ -110,12 +110,8 @@ if_inpdeck(struct line *deck, INPtables **tab)
ft_curckt->ci_curTask = ft_curckt->ci_defTask; ft_curckt->ci_curTask = ft_curckt->ci_defTask;
/* Debug statement */
/* printf("In if_inpdeck, about to call INPpas1. . . \n"); */
INPpas1((void *) ckt, (card *) deck->li_next,(INPtables *)*tab); INPpas1((void *) ckt, (card *) deck->li_next,(INPtables *)*tab);
/* Debug statement */
/* printf("In if_inpdeck, about to call INPpas2. . . \n"); */
INPpas2((void *) ckt, (card *) deck->li_next, INPpas2((void *) ckt, (card *) deck->li_next,
(INPtables *) *tab,ft_curckt->ci_defTask); (INPtables *) *tab,ft_curckt->ci_defTask);
INPkillMods(); INPkillMods();

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "inpdefs.h" #include "inpdefs.h"
/* This struct defines a linked list of lines from a SPICE file. */
struct line { struct line {
int li_linenum; int li_linenum;
char *li_line; char *li_line;

View File

@ -3,6 +3,18 @@
* 1999 E. Rouat * 1999 E. Rouat
************/ ************/
/* Uncomment this to get trace of program operation for
* debugging
*/
/* #define TRACE */
/* This was also added by SDB to aid in
* debugging. Remove when finished.
*/
/* #include "memwatch.h"
#define MEMWATCH */
/* /*
* This file will eventually replace spice.h and lots of other * This file will eventually replace spice.h and lots of other
* files in src/include * files in src/include

View File

@ -5,6 +5,7 @@
Author: 1985 Wayne A. Christopher Author: 1985 Wayne A. Christopher
The main routine for ngspice */ The main routine for ngspice */
#include <ngspice.h> #include <ngspice.h>
#include <stdio.h> #include <stdio.h>
@ -326,6 +327,22 @@ main(int argc, char **argv)
FILE *circuit_file; FILE *circuit_file;
#ifdef TRACE
/* this is used to detect memory leaks during debugging */
/* added by SDB during debug . . . . */
/* mtrace(); */
#endif
#ifdef TRACE
/* this is also used for memory leak plugging . . . */
/* added by SDB during debug . . . . */
/* mwDoFlush(1); */
#endif
/* MFB tends to jump to 0 on errors. This tends to catch it. */ /* MFB tends to jump to 0 on errors. This tends to catch it. */
if (started) { if (started) {
fprintf(cp_err, "main: Internal Error: jump to zero\n"); fprintf(cp_err, "main: Internal Error: jump to zero\n");

View File

@ -159,6 +159,76 @@ gettok(char **s)
return (copy(buf)); return (copy(buf));
} }
/*-------------------------------------------------------------------------*
* gettok_noparens was added by SDB on 4.21.2003.
* It acts like gettok, except that it stops parsing when it hits a paren
* (i.e. it treats parens like whitespace). It is used in translate (subckt.c)
* while looking for the POLY token.
*-------------------------------------------------------------------------*/
char *
gettok_noparens(char **s)
{
char buf[BSIZE_SP];
int i = 0;
char c;
while (isspace(**s))
(*s)++;
if (!**s)
return (NULL);
while ((c = **s) && !isspace(c) &&
( **s != '(' ) && ( **s != ')' ) ) {
buf[i++] = *(*s)++;
}
buf[i] = '\0';
while (isspace(**s))
(*s)++;
return (copy(buf));
}
/*-------------------------------------------------------------------------*
* get_l_paren iterates the pointer forward in a string until it hits
* the position after the next left paren "(". It returns 0 if it found a left
* paren, and 1 if no left paren is found.
*-------------------------------------------------------------------------*/
int
get_l_paren(char **s)
{
while (**s && ( **s != '(' ) )
(*s)++;
if (!**s)
return (1);
(*s)++;
if (!**s)
return (1);
else
return 0;
}
/*-------------------------------------------------------------------------*
* get_r_paren iterates the pointer forward in a string until it hits
* the position after the next right paren ")". It returns 0 if it found a right
* paren, and 1 if no right paren is found.
*-------------------------------------------------------------------------*/
int
get_r_paren(char **s)
{
while (**s && ( **s != ')' ) )
(*s)++;
if (!**s)
return (1);
(*s)++;
if (!**s)
return (1);
else
return 0;
}
#ifndef HAVE_BCOPY #ifndef HAVE_BCOPY

View File

@ -27,7 +27,7 @@ CKTmodCrt(void *ckt, int type, void **modfast, IFuid name)
error = CKTfndMod(ckt,&type,(void**)&mymodfast,name); error = CKTfndMod(ckt,&type,(void**)&mymodfast,name);
if(error == E_NOMOD) { if(error == E_NOMOD) {
mymodfast = (GENmodel *)MALLOC(*DEVices[type]->DEVmodSize); mymodfast = (GENmodel *)MALLOC(*(DEVices[type]->DEVmodSize));
if(mymodfast == (GENmodel *)NULL) return(E_NOMEM); if(mymodfast == (GENmodel *)NULL) return(E_NOMEM);
mymodfast->GENmodType = type; mymodfast->GENmodType = type;
mymodfast->GENmodName = name; mymodfast->GENmodName = name;

View File

@ -71,7 +71,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
int (*fn)( ); int (*fn)( );
static int is_dc; static int is_dc;
int k, j, n; int k, j, n;
int num_vars, branch_eq; int num_vars, branch_eq=0;
char *sen_data=NULL; char *sen_data=NULL;
char namebuf[513]; char namebuf[513];
IFuid *output_names, freq_name; IFuid *output_names, freq_name;
@ -601,7 +601,7 @@ inc_freq(double freq, int type, double step_size)
double double
next_freq(int type, double freq, double stepsize) next_freq(int type, double freq, double stepsize)
{ {
double s; double s=0;
switch (type) { switch (type) {
case SENS_DC: case SENS_DC:

View File

@ -20,7 +20,7 @@ CKTterr(int qcap, CKTcircuit *ckt, double *timeStep)
double del; double del;
double diff[8]; double diff[8];
double deltmp[8]; double deltmp[8];
double factor; double factor=0;
int i; int i;
int j; int j;
static double gearCoeff[] = { static double gearCoeff[] = {

View File

@ -1,3 +1,8 @@
5.2.2003 -- Stuart Brorson <SDB@cloud9.net)
* Added stuff to all deviceinit.c files to make deviceinfo
structure line up with the def of the structure when XSPICE is
enabled. This fixed a major bug with XSPICE operation.
2000-08-28 Arno W. Peters <A.W.Peters@ieee.org> 2000-08-28 Arno W. Peters <A.W.Peters@ieee.org>
* asrc/asrcset.c, bjt/bjtsetup.c, bsim1/b1set.c, bsim2/b2set.c, * asrc/asrcset.c, bjt/bjtsetup.c, bsim1/b1set.c, bsim2/b2set.c,

View File

@ -21,6 +21,23 @@ SPICEdev ASRCinfo = {
0, 0,
NULL, NULL,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -24,21 +24,21 @@ BJTdisto(int mode, GENmodel *genmodel, CKTcircuit *ckt)
DISTOAN* job = (DISTOAN*) ckt->CKTcurJob; DISTOAN* job = (DISTOAN*) ckt->CKTcurJob;
double td; double td;
DpassStr pass; DpassStr pass;
double r1h1x,i1h1x; double r1h1x = 0, i1h1x = 0;
double r1h1y,i1h1y; double r1h1y = 0, i1h1y = 0;
double r1h1z, i1h1z; double r1h1z = 0, i1h1z = 0;
double r1h2x, i1h2x; double r1h2x = 0, i1h2x = 0;
double r1h2y, i1h2y; double r1h2y = 0, i1h2y = 0;
double r1h2z, i1h2z; double r1h2z = 0, i1h2z = 0;
double r1hm2x,i1hm2x; double r1hm2x = 0, i1hm2x = 0;
double r1hm2y,i1hm2y; double r1hm2y = 0, i1hm2y = 0;
double r1hm2z, i1hm2z; double r1hm2z = 0, i1hm2z = 0;
double r2h11x,i2h11x; double r2h11x = 0, i2h11x = 0;
double r2h11y,i2h11y; double r2h11y = 0, i2h11y = 0;
double r2h11z, i2h11z; double r2h11z = 0, i2h11z = 0;
double r2h1m2x,i2h1m2x; double r2h1m2x = 0, i2h1m2x = 0;
double r2h1m2y,i2h1m2y; double r2h1m2y = 0, i2h1m2y = 0;
double r2h1m2z, i2h1m2z; double r2h1m2z = 0, i2h1m2z = 0;
double temp, itemp; double temp, itemp;
BJTinstance *here; BJTinstance *here;
#ifdef DISTODEBUG #ifdef DISTODEBUG

View File

@ -28,9 +28,9 @@ BJTdSetup(GENmodel *inModel, CKTcircuit *ckt)
double arg; double arg;
double c2; double c2;
double c4; double c4;
double lcapbe1,lcapbe2,lcapbe3; double lcapbe1, lcapbe2, lcapbe3;
double lcapbx1,lcapbx2,lcapbx3; double lcapbx1, lcapbx2, lcapbx3;
double cb; double cb = 0;
double cbc; double cbc;
double cbcn; double cbcn;
double cbe; double cbe;
@ -54,16 +54,16 @@ BJTdSetup(GENmodel *inModel, CKTcircuit *ckt)
double f3; double f3;
double fcpc; double fcpc;
double fcpe; double fcpe;
double gbb1; double gbb1 = 0;
double gbc; double gbc;
double gbcn; double gbcn;
double gbe; double gbe;
double gbe2,gbe3; double gbe2, gbe3;
double gbc2,gbc3; double gbc2,gbc3;
double gben2,gben3; double gben2,gben3;
double gbcn2,gbcn3; double gbcn2,gbcn3;
double gben; double gben;
double gbb2, gbb3; double gbb2 = 0, gbb3 = 0;
double oik; double oik;
double oikr; double oikr;
double ovtf; double ovtf;

View File

@ -7,23 +7,39 @@
#include "bjtinit.h" #include "bjtinit.h"
SPICEdev BJTinfo = { SPICEdev BJTinfo = { /* description from struct IFdevice */
{ {
"BJT", "BJT", /* char *name */
"Bipolar Junction Transistor", "Bipolar Junction Transistor", /* char *description */
&BJTnSize, /* int *terms */
&BJTnSize, /* int *numNames */
BJTnames, /* char **termnames */
&BJTpTSize, /* int *numInstanceparms */
BJTpTable, /* IFparm *instanceParms */
&BJTmPTSize, /* int *numModelparms */
BJTmPTable, /* IFparm *modelParms */
&BJTnSize, #ifdef XSPICE
&BJTnSize, /*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
BJTnames, NULL, /* This is a SPICE device, it has no MIF info data */
&BJTpTSize, 0, /* This is a SPICE device, it has no MIF info data */
BJTpTable, NULL, /* This is a SPICE device, it has no MIF info data */
&BJTmPTSize, 0, /* This is a SPICE device, it has no MIF info data */
BJTmPTable, NULL, /* This is a SPICE device, it has no MIF info data */
DEV_DEFAULT
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT /* int flags */
}, },
DEVparam : BJTparam, DEVparam : BJTparam,
DEVmodParam : BJTmParam, DEVmodParam : BJTmParam,
DEVload : BJTload, DEVload : BJTload,

View File

@ -114,9 +114,9 @@ BJTload(inModel,ckt)
double tr; double tr;
double vbc; double vbc;
double vbe; double vbe;
double vbx; double vbx=0;
double vce; double vce;
double vcs; double vcs=0;
double vt; double vt;
double vtc; double vtc;
double vte; double vte;

View File

@ -21,6 +21,22 @@ SPICEdev B1info = {
&B1mPTSize, &B1mPTSize,
B1mPTable, B1mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev B2info = {
&B2mPTSize, &B2mPTSize,
B2mPTable, B2mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -20,6 +20,22 @@ SPICEdev BSIM3info = {
&BSIM3mPTSize, &BSIM3mPTSize,
BSIM3mPTable, BSIM3mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -19,6 +19,22 @@ SPICEdev B3SOIDDinfo = {
&B3SOIDDmPTSize, &B3SOIDDmPTSize,
B3SOIDDmPTable, B3SOIDDmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT} DEV_DEFAULT}
, ,

View File

@ -19,6 +19,22 @@ SPICEdev B3SOIFDinfo = {
&B3SOIFDmPTSize, &B3SOIFDmPTSize,
B3SOIFDmPTable, B3SOIFDmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT} DEV_DEFAULT}
, ,

View File

@ -20,6 +20,22 @@ SPICEdev B3SOIPDinfo = {
&B3SOIPDmPTSize, &B3SOIPDmPTSize,
B3SOIPDmPTable, B3SOIPDmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT} DEV_DEFAULT}
, ,

View File

@ -21,6 +21,22 @@ SPICEdev BSIM3V1info = {
&BSIM3V1mPTSize, &BSIM3V1mPTSize,
BSIM3V1mPTable, BSIM3V1mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT, DEV_DEFAULT,
}, },

View File

@ -20,7 +20,23 @@ SPICEdev BSIM3V2info = {
&BSIM3V2mPTSize, &BSIM3V2mPTSize,
BSIM3V2mPTable, BSIM3V2mPTable,
DEV_DEFAULT
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT
}, },
DEVparam : BSIM3V2param, DEVparam : BSIM3V2param,

View File

@ -21,6 +21,22 @@ SPICEdev BSIM4info = {
&BSIM4mPTSize, &BSIM4mPTSize,
BSIM4mPTable, BSIM4mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -20,6 +20,22 @@ SPICEdev CAPinfo = {
&CAPmPTSize, &CAPmPTSize,
CAPmPTable, CAPmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0 0
}, },

View File

@ -20,6 +20,22 @@ SPICEdev CCCSinfo = {
0, 0,
NULL, NULL,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev CCVSinfo = {
0, 0,
NULL, NULL,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -17,16 +17,19 @@ Author: 1985 Thomas L. Quarles
int int
CKTcrtElt(void *ckt, void *inModPtr, void **inInstPtr, IFuid name) CKTcrtElt(void *ckt, void *inModPtr, void **inInstPtr, IFuid name)
{ {
GENinstance *instPtr = NULL; GENinstance *instPtr = NULL; /* instPtr points to the data struct for per-instance data */
GENmodel *modPtr=(GENmodel*)inModPtr; GENmodel *modPtr = (GENmodel*)inModPtr; /* modPtr points to the data struct for per-model data */
SPICEdev **DEVices; SPICEdev **DEVices;
int error; int error;
int type; int type;
DEVices = devices(); DEVices = devices();
if((GENmodel *)modPtr==(GENmodel*)NULL)
if( (GENmodel *)modPtr == (GENmodel*)NULL )
return E_NOMOD; return E_NOMOD;
type = ((GENmodel*)modPtr)->GENmodType;
type = ((GENmodel*)modPtr)->GENmodType;
error = CKTfndDev(ckt, &type, (void**)&instPtr, name, inModPtr, error = CKTfndDev(ckt, &type, (void**)&instPtr, name, inModPtr,
(char *)NULL ); (char *)NULL );
@ -37,13 +40,21 @@ CKTcrtElt(void *ckt, void *inModPtr, void **inInstPtr, IFuid name)
} else if (error != E_NODEV) } else if (error != E_NODEV)
return error; return error;
#ifdef TRACE
/*------ SDB debug statement -------*/
printf("about to tmalloc, type = %d. . . \n", type);
#endif
instPtr = (GENinstance *) tmalloc(*DEVices[type]->DEVinstSize); instPtr = (GENinstance *) tmalloc(*DEVices[type]->DEVinstSize);
if (instPtr == (GENinstance *)NULL) if (instPtr == (GENinstance *)NULL)
return E_NOMEM; return E_NOMEM;
instPtr->GENname = name; instPtr->GENname = name;
instPtr->GENmodPtr = modPtr;
instPtr->GENnextInstance = modPtr->GENinstances; instPtr->GENmodPtr = modPtr;
instPtr->GENnextInstance = modPtr->GENinstances;
modPtr->GENinstances = instPtr; modPtr->GENinstances = instPtr;
if(inInstPtr != NULL) if(inInstPtr != NULL)

View File

@ -20,6 +20,22 @@ SPICEdev CPLinfo = {
&CPLmPTSize, &CPLmPTSize,
CPLmPTable, CPLmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0 0
}, },

View File

@ -23,6 +23,22 @@ SPICEdev CSWinfo = {
&CSWmPTSize, &CSWmPTSize,
CSWmPTable, CSWmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0 0
}, },

View File

@ -23,6 +23,22 @@ SPICEdev DIOinfo = {
&DIOmPTSize, &DIOmPTSize,
DIOmPTable, DIOmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev HFETAinfo = {
&HFETAmPTSize, &HFETAmPTSize,
HFETAmPTable, HFETAmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev HFET2info = {
&HFET2mPTSize, &HFET2mPTSize,
HFET2mPTable, HFET2mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,21 @@ SPICEdev INDinfo = {
0, 0,
NULL, NULL,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0 0
}, },
@ -71,6 +86,22 @@ SPICEdev MUTinfo = {
0, 0,
NULL, NULL,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0 0
}, },

View File

@ -21,6 +21,22 @@ SPICEdev ISRCinfo = {
0, 0,
NULL, NULL,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev JFETinfo = {
&JFETmPTSize, &JFETmPTSize,
JFETmPTable, JFETmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev JFET2info = {
&JFET2mPTSize, &JFET2mPTSize,
JFET2mPTable, JFET2mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev LTRAinfo = {
&LTRAmPTSize, &LTRAmPTSize,
LTRAmPTable, LTRAmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0 0
}, },

View File

@ -21,6 +21,22 @@ SPICEdev MESinfo = {
&MESmPTSize, &MESmPTSize,
MESmPTable, MESmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev MESAinfo = {
&MESAmPTSize, &MESAmPTSize,
MESAmPTable, MESAmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev MOS1info = {
&MOS1mPTSize, &MOS1mPTSize,
MOS1mPTable, MOS1mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev MOS2info = {
&MOS2mPTSize, &MOS2mPTSize,
MOS2mPTable, MOS2mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev MOS3info = {
&MOS3mPTSize, &MOS3mPTSize,
MOS3mPTable, MOS3mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev MOS6info = {
&MOS6mPTSize, &MOS6mPTSize,
MOS6mPTable, MOS6mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev MOS9info = {
&MOS9mPTSize, &MOS9mPTSize,
MOS9mPTable, MOS9mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev RESinfo = {
&RESmPTSize, &RESmPTSize,
RESmPTable, RESmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0 0
}, },

View File

@ -21,6 +21,22 @@ SPICEdev SOI3info = {
&SOI3mPTSize, &SOI3mPTSize,
SOI3mPTable, SOI3mPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -22,6 +22,22 @@ SPICEdev SWinfo = {
&SWmPTSize, &SWmPTSize,
SWmPTable, SWmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0 0
}, },

View File

@ -21,6 +21,22 @@ SPICEdev TRAinfo = {
0, 0,
NULL, NULL,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0 0
}, },

View File

@ -26,6 +26,23 @@ SPICEdev TXLinfo = {
&TXLmPTSize, &TXLmPTSize,
TXLmPTable, TXLmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0
}, },
TXLparam, TXLparam,

View File

@ -21,6 +21,22 @@ SPICEdev URCinfo = {
&URCmPTSize, &URCmPTSize,
URCmPTable, URCmPTable,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
0 0
}, },

View File

@ -21,6 +21,22 @@ SPICEdev VCCSinfo = {
0, 0,
NULL, NULL,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev VCVSinfo = {
0, 0,
NULL, NULL,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -21,6 +21,22 @@ SPICEdev VSRCinfo = {
0, 0,
NULL, NULL,
#ifdef XSPICE
/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
0, /* This is a SPICE device, it has no MIF info data */
NULL, /* This is a SPICE device, it has no MIF info data */
/*--------------------------- End of SDB fix -------------------------*/
#endif
DEV_DEFAULT DEV_DEFAULT
}, },

View File

@ -83,6 +83,12 @@ void INP2Q(void *ckt, INPtables * tab, card * current, void *gnode)
} }
mdfast = tab->defQmod; mdfast = tab->defQmod;
} }
#ifdef TRACE
/* --- SDB debug statement --- */
printf ("In INP2Q, just about to dive into newInstance\n");
#endif
IFC(newInstance, (ckt, mdfast, &fast, name)); IFC(newInstance, (ckt, mdfast, &fast, name));
IFC(bindNode, (ckt, fast, 1, node1)); IFC(bindNode, (ckt, fast, 1, node1));
IFC(bindNode, (ckt, fast, 2, node2)); IFC(bindNode, (ckt, fast, 2, node2));

View File

@ -28,8 +28,10 @@ char *INPdomodel(void *ckt, card * image, INPtables * tab)
line = image->line; line = image->line;
/* debug statement */ #ifdef TRACE
/* printf("In INPdomodel, examining line %s . . . \n", line); */ /* SDB debug statement */
printf("In INPdomodel, examining line %s . . . \n", line);
#endif
INPgetTok(&line, &modname, 1); /* throw away '.model' */ INPgetTok(&line, &modname, 1); /* throw away '.model' */
INPgetTok(&line, &modname, 1); /* get model name */ INPgetTok(&line, &modname, 1); /* get model name */
@ -471,6 +473,21 @@ char *INPdomodel(void *ckt, card * image, INPtables * tab)
} }
/* type poly added by SDB . . . */
#ifdef XSPICE
/* -------- Check if model is a poly (specific to xspice) --------- */
else if (strcmp(typename, "poly") == 0) {
type = INPtypelook("POLY");
if (type < 0) {
err =
INPmkTemp
("Device type POLY not available in this binary\n");
}
INPmakeMod(modname, type, image);
}
#endif
/* -------- Default action --------- */ /* -------- Default action --------- */
else { else {
#ifndef XSPICE #ifndef XSPICE
@ -478,18 +495,35 @@ char *INPdomodel(void *ckt, card * image, INPtables * tab)
err = (char *) MALLOC(35 + strlen(typename)); err = (char *) MALLOC(35 + strlen(typename));
(void) sprintf(err, "unknown model type %s - ignored\n", typename); (void) sprintf(err, "unknown model type %s - ignored\n", typename);
#else #else
/* gtri - modify - wbk - 10/23/90 - modify to look for code models */ /* gtri - modify - wbk - 10/23/90 - modify to look for code models */
/* add new code */ #ifdef TRACE
/* SDB debug statement */
printf("In INPdomodel, found unknown model type, typename = %s . . .\n", typename);
#endif
/* look for this model type and put it in the table of models */ /* look for this model type and put it in the table of models */
type = INPtypelook(typename); type = INPtypelook(typename);
if(type < 0) { if(type < 0) {
err = (char *) MALLOC(35 + strlen(typename)); err = (char *) MALLOC(35 + strlen(typename));
sprintf(err,"Unknown model type %s - ignored\n",typename); sprintf(err,"Unknown model type %s - ignored\n",typename);
#ifdef TRACE
/* SDB debug statement */
printf("In INPdomodel, ignoring unknown model typ typename = %s . . .\n", typename);
#endif
} }
else else {
#ifdef TRACE
/* SDB debug statement */
printf("In INPdomodel, adding model typename = %s to model list. . .\n", typename);
#endif
INPmakeMod(modname,type,image); INPmakeMod(modname,type,image);
}
/* gtri - end - wbk - 10/23/90 */ /* gtri - end - wbk - 10/23/90 */
#endif #endif

View File

@ -20,7 +20,9 @@ char *INPfindLev(char *line, int *level)
{ {
char *where; char *where;
where = line; /*
*where = line;
*/
where = strstr(line, "level"); where = strstr(line, "level");
@ -58,7 +60,7 @@ char *INPfindLev(char *line, int *level)
else { /* no level on the line => default */ else { /* no level on the line => default */
*level = 1; *level = 1;
printf("Level not specified: Using level 1.\n"); printf("Warning -- Level not specified on line \"%s\"\nUsing level 1.\n", line);
return ((char *) NULL); return ((char *) NULL);
} }

View File

@ -24,21 +24,40 @@ char *INPgetMod(void *ckt, char *name, INPmodel ** model, INPtables * tab)
char *temp; char *temp;
int error; int error;
#ifdef TRACE
/* SDB debug statement */
printf("In INPgetMod, examining model %s . . . \n", name);
#endif
for (modtmp = modtab; modtmp != (INPmodel *) NULL; modtmp = for (modtmp = modtab; modtmp != (INPmodel *) NULL; modtmp =
((modtmp)->INPnextModel)) { ((modtmp)->INPnextModel)) {
#ifdef TRACE
/* SDB debug statement */
printf("In INPgetMod, comparing against stored model %s . . . \n", (modtmp)->INPmodName);
#endif
if (strcmp((modtmp)->INPmodName, name) == 0) { if (strcmp((modtmp)->INPmodName, name) == 0) {
/* found the model in question - now instantiate if necessary */ /* found the model in question - now instantiate if necessary */
/* and return an appropriate pointer to it */ /* and return an appropriate pointer to it */
if (modtmp->INPmodType < 0) {
if (modtmp->INPmodType < 0) { /* First check for illegal model type */
/* illegal device type, so can't handle */ /* illegal device type, so can't handle */
*model = (INPmodel *) NULL; *model = (INPmodel *) NULL;
err = (char *) MALLOC((35 + strlen(name)) * sizeof(char)); err = (char *) MALLOC((35 + strlen(name)) * sizeof(char));
(void) sprintf(err, (void) sprintf(err,
"Unknown device type for model %s \n", "Unknown device type for model %s \n",
name); name);
#ifdef TRACE
/* SDB debug statement */
printf("In INPgetMod, illegal device type for model %s . . . \n", name);
#endif
return (err); return (err);
} } /* end of checking for illegal model */
if (!((modtmp)->INPmodUsed)) {
if (!((modtmp)->INPmodUsed)) { /* Check if model is already defined */
/* not already defined, so create & give parameters */ /* not already defined, so create & give parameters */
error = (*(ft_sim->newModel)) (ckt, (modtmp)->INPmodType, error = (*(ft_sim->newModel)) (ckt, (modtmp)->INPmodType,
&((modtmp)->INPmodfast), &((modtmp)->INPmodfast),
@ -47,12 +66,20 @@ char *INPgetMod(void *ckt, char *name, INPmodel ** model, INPtables * tab)
return (INPerror(error)); return (INPerror(error));
/* parameter isolation, identification, binding */ /* parameter isolation, identification, binding */
line = ((modtmp)->INPmodLine)->line; line = ((modtmp)->INPmodLine)->line;
#ifdef TRACE
/* SDB debug statement */
printf("In INPgetMod, inserting new model into table. line = %s . . . \n", line);
#endif
INPgetTok(&line, &parm, 1); /* throw away '.model' */ INPgetTok(&line, &parm, 1); /* throw away '.model' */
INPgetTok(&line, &parm, 1); /* throw away 'modname' */ INPgetTok(&line, &parm, 1); /* throw away 'modname' */
while (*line != 0) { while (*line != 0) {
INPgetTok(&line, &parm, 1); INPgetTok(&line, &parm, 1);
if (!*parm) if (!*parm)
continue; continue;
for (j = 0; j < (* (*(ft_sim->devices)[(modtmp)->INPmodType]).numModelParms); j++) { for (j = 0; j < (* (*(ft_sim->devices)[(modtmp)->INPmodType]).numModelParms); j++) {
if (strcmp(parm, "txl") == 0) { if (strcmp(parm, "txl") == 0) {
@ -72,7 +99,8 @@ char *INPgetMod(void *ckt, char *name, INPmodel ** model, INPtables * tab)
return (INPerror(error)); return (INPerror(error));
break; break;
} }
} } /* end for(j = 0 . . .*/
if (strcmp(parm, "level") == 0) { if (strcmp(parm, "level") == 0) {
/* just grab the level number and throw away */ /* just grab the level number and throw away */
/* since we already have that info from pass1 */ /* since we already have that info from pass1 */
@ -104,5 +132,11 @@ char *INPgetMod(void *ckt, char *name, INPmodel ** model, INPtables * tab)
(void) sprintf(err, (void) sprintf(err,
" unable to find definition of model %s - default assumed \n", " unable to find definition of model %s - default assumed \n",
name); name);
#ifdef TRACE
/* SDB debug statement */
printf("In INPgetMod, didn't find model for %s, using default . . . \n", name);
#endif
return (err); return (err);
} }

View File

@ -117,8 +117,12 @@ int INPgetTok(char **line, char **token, int gobble)
continue; continue;
break; break;
} }
/* debug statement */
#ifdef TRACE
/* SDB debug statement */
/* printf("found generic token (%s) and rest of line (%s)\n", *token, *line); */ /* printf("found generic token (%s) and rest of line (%s)\n", *token, *line); */
#endif
return (OK); return (OK);
} }
@ -198,8 +202,12 @@ int INPgetNetTok(char **line, char **token, int gobble)
continue; continue;
break; break;
} }
/* debug statement */
#ifdef TRACE
/* SDB debug statement */
/* printf("found netname token (%s) and rest of line (%s)\n", *token, *line); */ /* printf("found netname token (%s) and rest of line (%s)\n", *token, *line); */
#endif
return (OK); return (OK);
} }
@ -313,7 +321,11 @@ int INPgetUTok(char **line, char **token, int gobble)
break; break;
} }
*line = point; *line = point;
/* debug statement */
#ifdef TRACE
/* SDB debug statement */
/* printf("found refdes token (%s) and rest of line (%s)\n",*token,*line); */ /* printf("found refdes token (%s) and rest of line (%s)\n",*token,*line); */
#endif
return (OK); return (OK);
} }

View File

@ -32,6 +32,12 @@ int INPmakeMod(char *token, int type, card * line)
/* Model name was not already in model table. Therefore stick /* Model name was not already in model table. Therefore stick
it in the model table. Then reutrn. */ it in the model table. Then reutrn. */
#ifdef TRACE
/* debug statement */
printf("In INPmakeMod, about to insert new model name = %s . . .\n", token);
#endif
*i = (INPmodel *) MALLOC(sizeof(INPmodel)); *i = (INPmodel *) MALLOC(sizeof(INPmodel));
if (*i == NULL) if (*i == NULL)
return (E_NOMEM); return (E_NOMEM);

View File

@ -32,8 +32,10 @@ void INPpas1(void *ckt, card * deck, INPtables * tab)
/* First check to see if model is multi-line. If so, /* First check to see if model is multi-line. If so,
read in all lines & stick them into tab. */ read in all lines & stick them into tab. */
/* debug statement */ #ifdef TRACE
/* printf("In INPpas1, about to call INPdomodel\n"); */ /* SDB debug statement */
printf("In INPpas1, handling line = %s \n", thisline);
#endif
/* Now invoke INPdomodel to stick model into model table. */ /* Now invoke INPdomodel to stick model into model table. */
temp = INPdomodel(ckt, current, tab); temp = INPdomodel(ckt, current, tab);

View File

@ -29,6 +29,11 @@ void INPpas2(void *ckt, card * data, INPtables * tab, void *task)
void *gnode; void *gnode;
int error; /* used by the macros defined above */ int error; /* used by the macros defined above */
#ifdef TRACE
/* SDB debug statement */
printf("Entered INPpas2 . . . .\n");
#endif
error = INPgetTok(&groundname, &gname, 1); error = INPgetTok(&groundname, &gname, 1);
if (error) if (error)
data->error = data->error =
@ -45,6 +50,11 @@ void INPpas2(void *ckt, card * data, INPtables * tab, void *task)
for (current = data; current != NULL; current = current->nextcard) { for (current = data; current != NULL; current = current->nextcard) {
#ifdef TRACE
/* SDB debug statement */
printf("In INPpas2, examining card %s . . .\n", current->line);
#endif
c = *(current->line); c = *(current->line);
c = islower(c) ? toupper(c) : c; c = islower(c) ? toupper(c) : c;

View File

@ -39,6 +39,11 @@ INPpas3(void *ckt, card *data, INPtables *tab, void *task,
int length; /* length of a name */ int length; /* length of a name */
void *node1; /* the first node's node pointer */ void *node1; /* the first node's node pointer */
#ifdef TRACE
/* SDB debug statement */
printf("In INPpas3 . . . \n");
#endif
for(current = data; current != NULL; current = current->nextcard) { for(current = data; current != NULL; current = current->nextcard) {
line = current->line; line = current->line;
INPgetTok(&line,&token,1); INPgetTok(&line,&token,1);

View File

@ -18,7 +18,19 @@ int INPtypelook(char *type)
{ {
int i; int i;
#ifdef TRACE
/* SDB debug statement */
/* printf("In INPtypelook, examining model type = %s . . .\n", type); */
#endif
for (i = 0; i < ft_sim->numDevices; i++) { for (i = 0; i < ft_sim->numDevices; i++) {
#ifdef TRACE
/* SDB debug statemnet */
/* printf("In INPtypelook, checking model against = %s . . .\n", (*(ft_sim->devices)[i]).name ); */
#endif
if (strcmp(type, (*(ft_sim->devices)[i]).name) == 0) { if (strcmp(type, (*(ft_sim->devices)[i]).name) == 0) {
/*found the device - return it */ /*found the device - return it */
return i; return i;

View File

@ -1,3 +1,9 @@
05/05/2003:
* Added latest patch from Stuart Brorson <sdb@cloud9.net>,
http://www.brorson.com/gEDA/ngspice/ngspice.html ;
Spice POLY works
Fixes XSPICE integration bugs
Comments in parser code and debug printfs
14/04/2003: 14/04/2003:
* loadsnap / savesnap commands added * loadsnap / savesnap commands added
* Improved spice Tcl GUI * Improved spice Tcl GUI

View File

@ -65,13 +65,10 @@ NON-STANDARD FEATURES
static int needs_translating(char *card); static int needs_translating(char *card);
static int count_tokens(char *card); static int count_tokens(char *card);
static char *translate(char *orig_card, char **inst_card, static char *two2three_translate(char *orig_card, char **inst_card,
char **mod_card); char **mod_card);
static int get_poly_dimension(char *card); static int get_poly_dimension(char *card);
// added as a quick bug fix, a lot of standard models have a linear poly(1) which
// fails in this code, Kevin Aylward April 15th 2000
char * (*FPConvertSpicePoly1ToBsource)(char *card); // this is so I can use the MFC class libary
/* /*
ENHtranslate_poly() ENHtranslate_poly()
@ -79,7 +76,14 @@ Translate all 2G6 style polynomial controlled sources in the deck
to new polynomial controlled source code model syntax. to new polynomial controlled source code model syntax.
*/ */
/*---------------------------------------------------------------------*/
/* ENHtranslate_poly takes (a pointer to) the SPICE deck as argument. */
/* It loops through the deck, and translates all POLY statements */
/* in dependent sources into a .model conformant with the needs of */
/* XSPICE. It splices the new statements in the deck, and comments */
/* out the old dependent source. */
/* It returns (a pointer to) the processed deck. */
/*---------------------------------------------------------------------*/
struct line * ENHtranslate_poly( struct line * ENHtranslate_poly(
struct line *deck) /* Linked list of lines in input deck */ struct line *deck) /* Linked list of lines in input deck */
{ {
@ -91,65 +95,65 @@ struct line * ENHtranslate_poly(
int poly_dimension; int poly_dimension;
char *buff; char *buff;
/* Iterate through each card in the deck and translate as needed */ /* Iterate through each card in the deck and translate as needed */
for(d = deck; d; d = d->li_next) for(d = deck; d; d = d->li_next)
{ {
/* If doesn't need to be translated, continue to next card */ #ifdef TRACE
if(! needs_translating(d->li_line)) /* SDB debug statement */
continue; printf("In ENHtranslate_poly, now examining card %s . . . \n", d->li_line);
#endif
// Start added as a quick fix to a xspice translation bug in poly(1) code /* If doesn't need to be translated, continue to next card */
// Kevin Aylward April 15th 2000, fuck knows where it is if(! needs_translating(d->li_line)) {
poly_dimension = get_poly_dimension(d->li_line);
if(poly_dimension == 1)// #ifdef TRACE
{ /* SDB debug statement */
buff = (FPConvertSpicePoly1ToBsource)(d->li_line); /* printf("Card doesn't need translating. Continuing . . . .\n"); */
#endif
if(buff) continue;
{ }
FREE(d->li_line);
d->li_line = buff; #ifdef TRACE
} /* SDB debug statement */
printf("Found a card to translate . . . .\n");
#endif
continue; /* Create two new line structs and splice into deck */
}
// End added as a quick fix to a xspice translation bug in poly(1) code
// Kevin Aylward April 15th 2000
/* Create two new line structs and splice into deck */
/* l1 = alloc(line); */ /* jgroves */ /* l1 = alloc(line); */ /* jgroves */
/* l2 = alloc(line); */ /* jgroves */ /* l2 = alloc(line); */ /* jgroves */
l1 = alloc(struct line); l1 = alloc(struct line);
l2 = alloc(struct line); l2 = alloc(struct line);
l2->li_next = d->li_next; l2->li_next = d->li_next;
l1->li_next = l2; l1->li_next = l2;
d->li_next = l1; d->li_next = l1;
/* Create the translated cards */
d->li_error = two2three_translate(d->li_line, &(l1->li_line), &(l2->li_line));
/* Comment out the original line */
card = (void *) MALLOC(strlen(d->li_line) + 2);
strcpy(card,"*");
strcat(card, d->li_line);
d->li_line = card;
/* Create the translated cards */ #ifdef TRACE
d->li_error = translate(d->li_line, &(l1->li_line), &(l2->li_line)); /* SDB debug statement */
printf("In ENHtranslate_poly, translated card = %s . . . \n", card);
#endif
/* Comment out the original line */ /* Advance deck pointer to last line added */
card = (void *) MALLOC(strlen(d->li_line) + 2); d = l2;
strcpy(card,"*");
strcat(card, d->li_line);
d->li_line = card;
/* Advance deck pointer to last line added */
d = l2;
} }
/* Return head of deck */ /* Return head of deck */
return(deck); return(deck);
} /* ENHtranslate_poly */ } /* ENHtranslate_poly */
/*---------------------------------------------------------------------*/
/* /*
needs_translating() needs_translating()
@ -160,9 +164,14 @@ a simple linear dependent source. Otherwise return false.
static int needs_translating( static int needs_translating(
char *card) /* the card text to check */ char *card) /* the card text to check */
{ {
#ifdef TRACE
/* SDB debug statement */
/* printf("In needs_translating, examining card %s . . . \n", card); */
#endif
switch(*card) { switch(*card) {
case 'e': case 'e':
@ -187,14 +196,12 @@ static int needs_translating(
/*---------------------------------------------------------------------*/
/* /*
count_tokens() count_tokens()
Count and return the number of tokens on the card. Count and return the number of tokens on the card.
*/ */
static int count_tokens( static int count_tokens(
char *card) /* the card text on which to count tokens */ char *card) /* the card text on which to count tokens */
{ {
@ -210,13 +217,19 @@ static int count_tokens(
/*--------------------------------------------------------------------*/
/* /*
translate() two2three_translate()
Do the syntax translation of the 2G6 source to the new code model syntax. Do the syntax translation of the 2G6 source to the new code model syntax.
Renamed by SDB to eliminate clash with translate fcn defined in subckt.c
4.17.2003 -- SDB
*/ */
static char *translate( static char *two2three_translate(
char *orig_card, /* the original untranslated card */ char *orig_card, /* the original untranslated card */
char **inst_card, /* the instance card created by the translation */ char **inst_card, /* the instance card created by the translation */
char **mod_card) /* the model card created by the translation */ char **mod_card) /* the model card created by the translation */
@ -241,6 +254,11 @@ static char *translate(
char *card; char *card;
#ifdef TRACE
/* SDB debug statement */
printf("In two2three_translate, card to translate = %s . . .\n", orig_card);
#endif
/* Get the first character into local storage for checking type */ /* Get the first character into local storage for checking type */
type = *orig_card; type = *orig_card;
@ -249,12 +267,16 @@ static char *translate(
/* Determine the dimension of the poly source */ /* Determine the dimension of the poly source */
dim = get_poly_dimension(orig_card); dim = get_poly_dimension(orig_card);
if(dim <= 0) if(dim <= 0) {
printf("ERROR in two2three_translate -- Argument to poly() is not an integer\n");
return("ERROR - Argument to poly() is not an integer\n"); return("ERROR - Argument to poly() is not an integer\n");
}
/* Compute number of input connections based on type and dimension */ /* Compute number of input connections based on type and dimension */
switch(type) { switch(type) {
case 'E':
case 'e': case 'e':
case 'G':
case 'g': case 'g':
num_conns = 2 * dim; num_conns = 2 * dim;
break; break;
@ -318,7 +340,8 @@ static char *translate(
strcpy(*inst_card, "a$poly$"); strcpy(*inst_card, "a$poly$");
sprintf(*inst_card + strlen(*inst_card), "%s ", name); sprintf(*inst_card + strlen(*inst_card), "%s ", name);
if((type == 'e') || (type == 'g')) if((type == 'e') || (type == 'g') ||
(type == 'E') || (type == 'G'))
sprintf(*inst_card + strlen(*inst_card), "%%vd [ "); sprintf(*inst_card + strlen(*inst_card), "%%vd [ ");
else else
sprintf(*inst_card + strlen(*inst_card), "%%vnam [ "); sprintf(*inst_card + strlen(*inst_card), "%%vnam [ ");
@ -328,7 +351,8 @@ static char *translate(
sprintf(*inst_card + strlen(*inst_card), "] "); sprintf(*inst_card + strlen(*inst_card), "] ");
if((type == 'e') || (type == 'h')) if((type == 'e') || (type == 'h') ||
(type == 'E') || (type == 'H'))
sprintf(*inst_card + strlen(*inst_card), "%%vd "); sprintf(*inst_card + strlen(*inst_card), "%%vd ");
else else
sprintf(*inst_card + strlen(*inst_card), "%%id "); sprintf(*inst_card + strlen(*inst_card), "%%id ");
@ -344,6 +368,10 @@ static char *translate(
sprintf(*mod_card + strlen(*mod_card), "%s ", coef[i]); sprintf(*mod_card + strlen(*mod_card), "%s ", coef[i]);
sprintf(*mod_card + strlen(*mod_card), "]"); sprintf(*mod_card + strlen(*mod_card), "]");
#ifdef TRACE
/* SDB debug statement */
printf("In two2three_translate, translated statements:\n%s \n%s \n", *inst_card, *mod_card);
#endif
/* Free the temporary space */ /* Free the temporary space */
FREE(name); FREE(name);
@ -352,30 +380,26 @@ static char *translate(
for(i = 0; i < 2; i++) for(i = 0; i < 2; i++)
{ {
FREE(out_conn[i]); FREE(out_conn[i]);
out_conn[i] = NULL;
out_conn[i] = NULL; }
}
FREE(out_conn); FREE(out_conn);
out_conn = NULL; out_conn = NULL;
for(i = 0; i < num_conns; i++) for(i = 0; i < num_conns; i++)
{ {
FREE(in_conn[i]); FREE(in_conn[i]);
in_conn[i] = NULL;
in_conn[i] = NULL; }
}
FREE(in_conn); FREE(in_conn);
in_conn = NULL; in_conn = NULL;
for(i = 0; i < num_coefs; i++) for(i = 0; i < num_coefs; i++)
{ {
FREE(coef[i]); FREE(coef[i]);
coef[i] = NULL; coef[i] = NULL;
} }
FREE(coef); FREE(coef);
@ -384,9 +408,11 @@ static char *translate(
/* Return NULL to indicate no error */ /* Return NULL to indicate no error */
return(NULL); return(NULL);
} /* translate */ } /* two2three_translate */
/*--------------------------------------------------------------------*/
/* /*
get_poly_dimension() get_poly_dimension()

View File

@ -94,6 +94,8 @@ void icm_poly (Mif_Private_t *private)
double *acgains; /* Static variable holding AC gains for AC analysis */ double *acgains; /* Static variable holding AC gains for AC analysis */
/* debug statement */
printf("In icm_poly!!! . . . .\n");
/* Get number of input values */ /* Get number of input values */

View File

@ -158,6 +158,10 @@ card *current; /* the card we are to parse */
Mif_Status_t status; /* return status */ Mif_Status_t status; /* return status */
Mif_Token_Type_t next_token_type; /* the type of the next token */ Mif_Token_Type_t next_token_type; /* the type of the next token */
#ifdef TRACE
/* SDB debug statement */
printf("In MIF_INP2A, line to process = %s . . . \n", current->line);
#endif
/* get the line text from the card struct */ /* get the line text from the card struct */
@ -169,7 +173,6 @@ card *current; /* the card we are to parse */
name = MIFgettok(&line); name = MIFgettok(&line);
INPinsert(&name, tab); INPinsert(&name, tab);
/* locate the last token on the line and put it into "model" */ /* locate the last token on the line and put it into "model" */
while(*line != '\0') while(*line != '\0')
@ -190,6 +193,13 @@ card *current; /* the card we are to parse */
return; return;
} }
#ifdef TRACE
/* SDB debug statement */
printf("In MIF_INP2A, after tokenizing, name = %s, model = %s\n",
name, model);
#endif
/* get the integer index into the DEVices data array for this */ /* get the integer index into the DEVices data array for this */
/* model */ /* model */
@ -883,3 +893,12 @@ MIFget_port(
*status = MIF_OK; *status = MIF_OK;
return; return;
} }

View File

@ -85,12 +85,14 @@ defaulted later by MIFsetup(). The function returns NULL when
successful, and an error string on failure. successful, and an error string on failure.
*/ */
/* char *MIFgetMod(ckt,name,model,tab) */ /* former buggy calling method */
char *MIFgetMod(ckt,name,model,tab) char *MIFgetMod(
void *ckt; /* The circuit structure */ void *ckt, /* The circuit structure */
char *name; /* The name of the model to look for */ char *name, /* The name of the model to look for */
INPmodel **model; /* The model found/created */ INPmodel **model, /* The model found/created */
INPtables *tab; /* Table of model info from first pass */ INPtables *tab /* Table of model info from first pass */
)
{ {
INPmodel *modtmp; INPmodel *modtmp;
IFvalue * val; IFvalue * val;
@ -111,6 +113,10 @@ char *MIFgetMod(ckt,name,model,tab)
/* locate the named model in the modtab list */ /* locate the named model in the modtab list */
#ifdef TRACE
/* SDB debug statement */
printf("In MIFgetMod, model name = %s . . .\n", name);
#endif
/* maschmann : remove : from name */ /* maschmann : remove : from name */
@ -120,6 +126,11 @@ char *MIFgetMod(ckt,name,model,tab)
for (modtmp = modtab; modtmp != NULL; modtmp = ((modtmp)->INPnextModel)) { for (modtmp = modtab; modtmp != NULL; modtmp = ((modtmp)->INPnextModel)) {
#ifdef TRACE
/* SDB debug statement */
printf("In MIFgetMod, checking model against stored model = %s . . .\n", (modtmp)->INPmodName );
#endif
if (strcmp((modtmp)->INPmodName,name) == 0) { if (strcmp((modtmp)->INPmodName,name) == 0) {
@ -131,7 +142,12 @@ char *MIFgetMod(ckt,name,model,tab)
if(modtmp->INPmodType<0) { if(modtmp->INPmodType<0) {
/* illegal device type, so can't handle */ /* illegal device type, so can't handle */
*model = NULL; *model = NULL;
err = (char *)tmalloc((35+strlen(name)) * sizeof(char));
/* fixed by SDB -- magic number is 39, not 35.
* Also needed parens to correctly compute # of bytes to malloc
*/
err = (char *)tmalloc( (39+strlen(name)) * sizeof(char) );
sprintf(err, "MIF: Unknown device type for model %s \n",name); sprintf(err, "MIF: Unknown device type for model %s \n",name);
return(err); return(err);
} }
@ -233,3 +249,4 @@ char *MIFgetMod(ckt,name,model,tab)
return(err); return(err);
} }