9 changed files with 177 additions and 155 deletions
-
10ChangeLog
-
3TODO
-
2src/analysis/Makefile.am
-
54src/analysis/cktbindn.c
-
86src/analysis/cktfdev.c
-
3src/spicelib/devices/Makefile.am
-
24src/spicelib/devices/cktask.c
-
53src/spicelib/devices/cktbindnode.c
-
97src/spicelib/devices/cktfinddev.c
@ -1,54 +0,0 @@ |
|||
/********** |
|||
Copyright 1990 Regents of the University of California. All rights reserved. |
|||
Author: 1985 Thomas L. Quarles |
|||
**********/ |
|||
|
|||
/* CKTbindNode |
|||
* bind a node of the specified device of the given type to its place |
|||
* in the specified circuit. |
|||
*/ |
|||
|
|||
#include "ngspice.h" |
|||
#include <stdio.h> |
|||
#include "ifsim.h" |
|||
#include "smpdefs.h" |
|||
#include "cktdefs.h" |
|||
#include "devdefs.h" |
|||
#include "sperror.h" |
|||
|
|||
|
|||
extern SPICEdev *DEVices[]; |
|||
|
|||
/*ARGSUSED*/ |
|||
int |
|||
CKTbindNode(void *ckt, void *fast, int term, void *node) |
|||
{ |
|||
int mappednode; |
|||
int type = ((GENinstance *)fast)->GENmodPtr->GENmodType; |
|||
|
|||
mappednode = ((CKTnode *)node)->number; |
|||
|
|||
if(*((*DEVices[type]).DEVpublic.terms) >= term && term >0 ) { |
|||
switch(term) { |
|||
default: return(E_NOTERM); |
|||
case 1: |
|||
((GENinstance *)fast)->GENnode1 = mappednode; |
|||
break; |
|||
case 2: |
|||
((GENinstance *)fast)->GENnode2 = mappednode; |
|||
break; |
|||
case 3: |
|||
((GENinstance *)fast)->GENnode3 = mappednode; |
|||
break; |
|||
case 4: |
|||
((GENinstance *)fast)->GENnode4 = mappednode; |
|||
break; |
|||
case 5: |
|||
((GENinstance *)fast)->GENnode5 = mappednode; |
|||
break; |
|||
} |
|||
return(OK); |
|||
} else { |
|||
return(E_NOTERM); |
|||
} |
|||
} |
|||
@ -1,86 +0,0 @@ |
|||
/********** |
|||
Copyright 1990 Regents of the University of California. All rights reserved. |
|||
Author: 1985 Thomas L. Quarles |
|||
**********/ |
|||
|
|||
#include "ngspice.h" |
|||
#include <stdio.h> |
|||
#include "ifsim.h" |
|||
#include "cktdefs.h" |
|||
#include "sperror.h" |
|||
|
|||
|
|||
|
|||
int |
|||
CKTfndDev(void *Ckt, int *type, void **fast, IFuid name, void *modfast, IFuid modname) |
|||
{ |
|||
CKTcircuit *ckt=(CKTcircuit *)Ckt; |
|||
GENinstance *here; |
|||
GENmodel *mods; |
|||
|
|||
if((GENinstance **)fast != (GENinstance **)NULL && |
|||
*(GENinstance **)fast != (GENinstance *)NULL) { |
|||
/* already have fast, so nothing much to do */ |
|||
/* just get & set type */ |
|||
if(type) *type = (*((GENinstance**)fast))->GENmodPtr->GENmodType; |
|||
return(OK); |
|||
} |
|||
if(modfast) { |
|||
/* have model, just need device */ |
|||
mods = (GENmodel*)modfast; |
|||
for(here = mods->GENinstances ; here != NULL; |
|||
here = here->GENnextInstance) { |
|||
if (here->GENname == name) { |
|||
if(fast != NULL) *(GENinstance **)fast = here; |
|||
if(type) *type = mods->GENmodType; |
|||
return(OK); |
|||
} |
|||
} |
|||
return(E_NODEV); |
|||
} |
|||
if(*type >=0 && *type < DEVmaxnum) { |
|||
/* have device type, need to find model & device */ |
|||
/* look through all models */ |
|||
for(mods=(GENmodel *)ckt->CKThead[*type]; mods != NULL ; |
|||
mods = mods->GENnextModel) { |
|||
/* and all instances */ |
|||
if(modname == (char *)NULL || mods->GENmodName == modname) { |
|||
for(here = mods->GENinstances ; here != NULL; |
|||
here = here->GENnextInstance) { |
|||
if (here->GENname == name) { |
|||
if(fast != 0) *(GENinstance **)fast = here; |
|||
return(OK); |
|||
} |
|||
} |
|||
if(mods->GENmodName == modname) { |
|||
return(E_NODEV); |
|||
} |
|||
} |
|||
} |
|||
return(E_NOMOD); |
|||
} else if(*type == -1) { |
|||
/* look through all types (UGH - worst case - take forever) */ |
|||
for(*type = 0;*type <DEVmaxnum;(*type)++) { |
|||
/* need to find model & device */ |
|||
/* look through all models */ |
|||
for(mods=(GENmodel *)ckt->CKThead[*type];mods!=NULL; |
|||
mods = mods->GENnextModel) { |
|||
/* and all instances */ |
|||
if(modname == (char *)NULL || mods->GENmodName == modname) { |
|||
for(here = mods->GENinstances ; here != NULL; |
|||
here = here->GENnextInstance) { |
|||
if (here->GENname == name) { |
|||
if(fast != 0) *(GENinstance **)fast = here; |
|||
return(OK); |
|||
} |
|||
} |
|||
if(mods->GENmodName == modname) { |
|||
return(E_NODEV); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
*type = -1; |
|||
return(E_NODEV); |
|||
} else return(E_BADPARM); |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
/********** |
|||
Copyright 1990 Regents of the University of California. All rights reserved. |
|||
Author: 1985 Thomas L. Quarles |
|||
**********/ |
|||
|
|||
/* CKTbindNode |
|||
* |
|||
* bind a node of the specified device of the given type to its place |
|||
* in the specified circuit. */ |
|||
|
|||
#include <config.h> |
|||
#include <stdio.h> |
|||
#include <devdefs.h> |
|||
#include <sperror.h> |
|||
|
|||
#include "dev.h" |
|||
|
|||
int |
|||
CKTbindNode(void *ckt, void *fast, int term, void *node) |
|||
{ |
|||
int mappednode; |
|||
SPICEdev **devs; |
|||
GENinstance *instance = (GENinstance *) fast; |
|||
int type = instance->GENmodPtr->GENmodType; |
|||
|
|||
devs = devices(); |
|||
mappednode = ((CKTnode *)node)->number; |
|||
|
|||
if (*((*devs[type]).DEVpublic.terms) >= term && term >0 ) { |
|||
switch(term) { |
|||
default: |
|||
return E_NOTERM; |
|||
case 1: |
|||
instance->GENnode1 = mappednode; |
|||
break; |
|||
case 2: |
|||
instance->GENnode2 = mappednode; |
|||
break; |
|||
case 3: |
|||
instance->GENnode3 = mappednode; |
|||
break; |
|||
case 4: |
|||
instance->GENnode4 = mappednode; |
|||
break; |
|||
case 5: |
|||
instance->GENnode5 = mappednode; |
|||
break; |
|||
} |
|||
return OK; |
|||
} else { |
|||
return E_NOTERM; |
|||
} |
|||
} |
|||
@ -0,0 +1,97 @@ |
|||
/********** |
|||
Copyright 1990 Regents of the University of California. All rights reserved. |
|||
Author: 1985 Thomas L. Quarles |
|||
**********/ |
|||
|
|||
#include <config.h> |
|||
#include <cktdefs.h> |
|||
#include <sperror.h> |
|||
|
|||
|
|||
int |
|||
CKTfndDev(void *Ckt, int *type, void **fast, IFuid name, void *modfast, IFuid modname) |
|||
{ |
|||
CKTcircuit *ckt=(CKTcircuit *)Ckt; |
|||
GENinstance *here; |
|||
GENmodel *mods; |
|||
|
|||
if((GENinstance **)fast != (GENinstance **)NULL && |
|||
*(GENinstance **)fast != (GENinstance *)NULL) { |
|||
/* already have fast, so nothing much to do just get & set |
|||
type */ |
|||
if (type) |
|||
*type = (*((GENinstance**)fast))->GENmodPtr->GENmodType; |
|||
return(OK); |
|||
} |
|||
|
|||
if(modfast) { |
|||
/* have model, just need device */ |
|||
mods = (GENmodel*)modfast; |
|||
for (here = mods->GENinstances; |
|||
here != NULL; |
|||
here = here->GENnextInstance) { |
|||
if (here->GENname == name) { |
|||
if (fast != NULL) |
|||
*(GENinstance **)fast = here; |
|||
|
|||
if (type) |
|||
*type = mods->GENmodType; |
|||
|
|||
return OK; |
|||
} |
|||
} |
|||
return E_NODEV; |
|||
} |
|||
|
|||
if (*type >= 0 && *type < DEVmaxnum) { |
|||
/* have device type, need to find model & device */ |
|||
/* look through all models */ |
|||
for (mods = (GENmodel *)ckt->CKThead[*type]; |
|||
mods != NULL ; |
|||
mods = mods->GENnextModel) { |
|||
/* and all instances */ |
|||
if (modname == (char *)NULL || mods->GENmodName == modname) { |
|||
for (here = mods->GENinstances; |
|||
here != NULL; |
|||
here = here->GENnextInstance) { |
|||
if (here->GENname == name) { |
|||
if (fast != 0) |
|||
*(GENinstance **)fast = here; |
|||
return OK; |
|||
} |
|||
} |
|||
if(mods->GENmodName == modname) { |
|||
return E_NODEV; |
|||
} |
|||
} |
|||
} |
|||
return E_NOMOD; |
|||
} else if (*type == -1) { |
|||
/* look through all types (UGH - worst case - take forever) */ |
|||
for(*type = 0; *type < DEVmaxnum; (*type)++) { |
|||
/* need to find model & device */ |
|||
/* look through all models */ |
|||
for(mods=(GENmodel *)ckt->CKThead[*type];mods!=NULL; |
|||
mods = mods->GENnextModel) { |
|||
/* and all instances */ |
|||
if(modname == (char *)NULL || mods->GENmodName == modname) { |
|||
for (here = mods->GENinstances; |
|||
here != NULL; |
|||
here = here->GENnextInstance) { |
|||
if (here->GENname == name) { |
|||
if(fast != 0) |
|||
*(GENinstance **)fast = here; |
|||
return OK; |
|||
} |
|||
} |
|||
if(mods->GENmodName == modname) { |
|||
return E_NODEV; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
*type = -1; |
|||
return E_NODEV; |
|||
} else |
|||
return E_BADPARM; |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue