20 changed files with 187 additions and 179 deletions
-
1AUTHORS
-
20TODO
-
1configure.in
-
3src/Makefile.am
-
3src/analysis/Makefile.am
-
47src/analysis/cktcrte.c
-
62src/analysis/cktinit.c
-
14src/analysis/dctran.c
-
18src/main.c
-
10src/spicelib/devices/Makefile.am
-
3src/spicelib/devices/README
-
32src/spicelib/devices/cktaccept.c
-
6src/spicelib/devices/cktaccept.h
-
53src/spicelib/devices/cktcrte.c
-
64src/spicelib/devices/cktinit.c
-
10src/spicelib/devices/dev.c
-
3src/spicelib/devices/dev.h
-
0src/spicelib/devices/devsup.c
-
6src/spicelib/devices/devsup/.cvsignore
-
10src/spicelib/devices/devsup/Makefile.am
@ -1,47 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
/* |
|
||||
*/ |
|
||||
|
|
||||
/* CKTcrtElement(ckt,type,inModPtr,inInstPtr,name,subname) |
|
||||
* Create a device of the specified type, with the given name, using |
|
||||
* the specified model in the named circuit. |
|
||||
*/ |
|
||||
|
|
||||
#include "ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ifsim.h" |
|
||||
#include "cktdefs.h" |
|
||||
#include "devdefs.h" |
|
||||
#include "sperror.h" |
|
||||
|
|
||||
|
|
||||
|
|
||||
/*ARGSUSED*/ |
|
||||
int |
|
||||
CKTcrtElt(void *ckt, void *inModPtr, void **inInstPtr, IFuid name) |
|
||||
{ |
|
||||
GENinstance *instPtr = NULL; |
|
||||
GENmodel *modPtr=(GENmodel*)inModPtr; |
|
||||
extern SPICEdev *DEVices[]; |
|
||||
int error; |
|
||||
int type; |
|
||||
|
|
||||
if((GENmodel *)modPtr==(GENmodel*)NULL) return(E_NOMOD); |
|
||||
type = ((GENmodel*)modPtr)->GENmodType; |
|
||||
error =CKTfndDev(ckt,&type,(void**)&instPtr,name,inModPtr,(char *)NULL ); |
|
||||
if (error== OK) { |
|
||||
if(inInstPtr) *inInstPtr=(void *)instPtr; |
|
||||
return(E_EXISTS); |
|
||||
} else if (error != E_NODEV) return(error); |
|
||||
instPtr = (GENinstance *)MALLOC(*DEVices[type]->DEVinstSize); |
|
||||
if(instPtr == (GENinstance *)NULL) return(E_NOMEM); |
|
||||
instPtr->GENname = name; |
|
||||
instPtr->GENmodPtr = modPtr; |
|
||||
instPtr->GENnextInstance = modPtr->GENinstances; |
|
||||
modPtr->GENinstances = instPtr; |
|
||||
if(inInstPtr != NULL) *inInstPtr = (void *)instPtr; |
|
||||
return(OK); |
|
||||
} |
|
||||
@ -1,62 +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 "const.h" |
|
||||
#include "sperror.h" |
|
||||
|
|
||||
|
|
||||
int |
|
||||
CKTinit(void **ckt) |
|
||||
/* new circuit to create */ |
|
||||
{ |
|
||||
int i; |
|
||||
CKTcircuit *sckt; |
|
||||
|
|
||||
sckt = (CKTcircuit *)( *ckt = (char *)MALLOC(sizeof(CKTcircuit)) ); |
|
||||
if(sckt == NULL) return(E_NOMEM); |
|
||||
for (i=0;i<DEVmaxnum;i++) { |
|
||||
(sckt)->CKThead[i] = (GENmodel *) NULL; |
|
||||
} |
|
||||
(sckt)->CKTmaxEqNum = 1; |
|
||||
(sckt)->CKTnodes = (CKTnode *)NULL; |
|
||||
(sckt)->CKTlastNode = (CKTnode *)NULL; |
|
||||
sckt->CKTmatrix = NULL; |
|
||||
|
|
||||
(sckt)->CKTgmin = 1e-12; |
|
||||
(sckt)->CKTabstol = 1e-12; |
|
||||
(sckt)->CKTreltol = 1e-3; |
|
||||
(sckt)->CKTchgtol = 1e-14; |
|
||||
(sckt)->CKTvoltTol = 1e-6; |
|
||||
(sckt)->CKTtrtol = 7; |
|
||||
(sckt)->CKTbypass = 1; |
|
||||
(sckt)->CKTisSetup = 0; |
|
||||
(sckt)->CKTtranMaxIter = 10; |
|
||||
(sckt)->CKTdcMaxIter = 100; |
|
||||
(sckt)->CKTdcTrcvMaxIter = 50; |
|
||||
(sckt)->CKTintegrateMethod = TRAPEZOIDAL; |
|
||||
(sckt)->CKTorder = 1; |
|
||||
(sckt)->CKTmaxOrder = 2; |
|
||||
(sckt)->CKTpivotAbsTol = 1e-13; |
|
||||
(sckt)->CKTpivotRelTol = 1e-3; |
|
||||
(sckt)->CKTtemp = 300.15; |
|
||||
(sckt)->CKTnomTemp = 300.15; |
|
||||
(sckt)->CKTdefaultMosL = 1e-4; |
|
||||
(sckt)->CKTdefaultMosW = 1e-4; |
|
||||
(sckt)->CKTdefaultMosAD = 0; |
|
||||
(sckt)->CKTdefaultMosAS = 0; |
|
||||
(sckt)->CKTsrcFact=1; |
|
||||
(sckt)->CKTdiagGmin=0; |
|
||||
(sckt)->CKTstat = (STATistics *)MALLOC(sizeof(STATistics)); |
|
||||
(sckt)->CKTtroubleNode = 0; |
|
||||
(sckt)->CKTtroubleElt = NULL; |
|
||||
(sckt)->CKTtimePoints = NULL; |
|
||||
if( (sckt)->CKTstat == (STATistics *)NULL) return(E_NOMEM); |
|
||||
|
|
||||
return(OK); |
|
||||
} |
|
||||
@ -0,0 +1,3 @@ |
|||||
|
The circuit builder. |
||||
|
|
||||
|
It takes a circuit description and builds a simulator from it. |
||||
@ -0,0 +1,6 @@ |
|||||
|
#ifndef _CKTACCEPT_H |
||||
|
#define _CKTACCEPT_H |
||||
|
|
||||
|
int CKTaccept(CKTcircuit *ckt); |
||||
|
|
||||
|
#endif |
||||
@ -0,0 +1,53 @@ |
|||||
|
/********** |
||||
|
Copyright 1990 Regents of the University of California. All rights reserved. |
||||
|
Author: 1985 Thomas L. Quarles |
||||
|
**********/ |
||||
|
|
||||
|
/* CKTcrtElement(ckt,type,inModPtr,inInstPtr,name,subname) |
||||
|
* |
||||
|
* Create a device of the specified type, with the given name, using |
||||
|
* the specified model in the named circuit. */ |
||||
|
|
||||
|
#include <config.h> |
||||
|
#include <devdefs.h> |
||||
|
#include <sperror.h> |
||||
|
|
||||
|
#include "dev.h" |
||||
|
|
||||
|
int |
||||
|
CKTcrtElt(void *ckt, void *inModPtr, void **inInstPtr, IFuid name) |
||||
|
{ |
||||
|
GENinstance *instPtr = NULL; |
||||
|
GENmodel *modPtr=(GENmodel*)inModPtr; |
||||
|
SPICEdev **DEVices; |
||||
|
int error; |
||||
|
int type; |
||||
|
|
||||
|
DEVices = devices(); |
||||
|
if((GENmodel *)modPtr==(GENmodel*)NULL) |
||||
|
return E_NOMOD; |
||||
|
type = ((GENmodel*)modPtr)->GENmodType; |
||||
|
|
||||
|
error = CKTfndDev(ckt, &type, (void**)&instPtr, name, inModPtr, |
||||
|
(char *)NULL ); |
||||
|
if (error == OK) { |
||||
|
if (inInstPtr) |
||||
|
*inInstPtr=(void *)instPtr; |
||||
|
return E_EXISTS; |
||||
|
} else if (error != E_NODEV) |
||||
|
return error; |
||||
|
|
||||
|
instPtr = (GENinstance *) tmalloc(*DEVices[type]->DEVinstSize); |
||||
|
if (instPtr == (GENinstance *)NULL) |
||||
|
return E_NOMEM; |
||||
|
|
||||
|
instPtr->GENname = name; |
||||
|
instPtr->GENmodPtr = modPtr; |
||||
|
instPtr->GENnextInstance = modPtr->GENinstances; |
||||
|
modPtr->GENinstances = instPtr; |
||||
|
|
||||
|
if(inInstPtr != NULL) |
||||
|
*inInstPtr = (void *)instPtr; |
||||
|
|
||||
|
return OK; |
||||
|
} |
||||
@ -0,0 +1,64 @@ |
|||||
|
/********** |
||||
|
Copyright 1990 Regents of the University of California. All rights reserved. |
||||
|
Author: 1985 Thomas L. Quarles |
||||
|
**********/ |
||||
|
|
||||
|
#include <config.h> |
||||
|
|
||||
|
#include <stdio.h> |
||||
|
|
||||
|
#include <cktdefs.h> |
||||
|
#include <sperror.h> |
||||
|
|
||||
|
|
||||
|
int |
||||
|
CKTinit(void **ckt) /* new circuit to create */ |
||||
|
{ |
||||
|
int i; |
||||
|
CKTcircuit *sckt; |
||||
|
|
||||
|
*ckt = (void *) tmalloc(sizeof(CKTcircuit)); |
||||
|
sckt = (CKTcircuit *)(*ckt); |
||||
|
if (sckt == NULL) |
||||
|
return(E_NOMEM); |
||||
|
for (i = 0; i < DEVmaxnum; i++) |
||||
|
sckt->CKThead[i] = (GENmodel *) NULL; |
||||
|
|
||||
|
sckt->CKTmaxEqNum = 1; |
||||
|
sckt->CKTnodes = (CKTnode *) NULL; |
||||
|
sckt->CKTlastNode = (CKTnode *) NULL; |
||||
|
sckt->CKTmatrix = NULL; |
||||
|
|
||||
|
sckt->CKTgmin = 1e-12; |
||||
|
sckt->CKTabstol = 1e-12; |
||||
|
sckt->CKTreltol = 1e-3; |
||||
|
sckt->CKTchgtol = 1e-14; |
||||
|
sckt->CKTvoltTol = 1e-6; |
||||
|
sckt->CKTtrtol = 7; |
||||
|
sckt->CKTbypass = 1; |
||||
|
sckt->CKTisSetup = 0; |
||||
|
sckt->CKTtranMaxIter = 10; |
||||
|
sckt->CKTdcMaxIter = 100; |
||||
|
sckt->CKTdcTrcvMaxIter = 50; |
||||
|
sckt->CKTintegrateMethod = TRAPEZOIDAL; |
||||
|
sckt->CKTorder = 1; |
||||
|
sckt->CKTmaxOrder = 2; |
||||
|
sckt->CKTpivotAbsTol = 1e-13; |
||||
|
sckt->CKTpivotRelTol = 1e-3; |
||||
|
sckt->CKTtemp = 300.15; |
||||
|
sckt->CKTnomTemp = 300.15; |
||||
|
sckt->CKTdefaultMosL = 1e-4; |
||||
|
sckt->CKTdefaultMosW = 1e-4; |
||||
|
sckt->CKTdefaultMosAD = 0; |
||||
|
sckt->CKTdefaultMosAS = 0; |
||||
|
sckt->CKTsrcFact=1; |
||||
|
sckt->CKTdiagGmin=0; |
||||
|
sckt->CKTstat = (STATistics *) tmalloc(sizeof(STATistics)); |
||||
|
sckt->CKTtroubleNode = 0; |
||||
|
sckt->CKTtroubleElt = NULL; |
||||
|
sckt->CKTtimePoints = NULL; |
||||
|
if (sckt->CKTstat == (STATistics *)NULL) |
||||
|
return E_NOMEM; |
||||
|
|
||||
|
return OK; |
||||
|
} |
||||
@ -1,10 +1,9 @@ |
|||||
#ifndef _DEV_H |
#ifndef _DEV_H |
||||
#define _DEV_H |
#define _DEV_H |
||||
|
|
||||
#include <ifsim.h> |
|
||||
|
|
||||
int num_devices(void); |
int num_devices(void); |
||||
IFdevice **devices_ptr(void); |
IFdevice **devices_ptr(void); |
||||
|
SPICEdev **devices(void); |
||||
|
|
||||
#endif |
#endif |
||||
|
|
||||
@ -1,6 +0,0 @@ |
|||||
Makefile.in |
|
||||
Makefile |
|
||||
.deps |
|
||||
.libs |
|
||||
*.lo |
|
||||
*.la |
|
||||
@ -1,10 +0,0 @@ |
|||||
## Process this file with automake to produce Makefile.in
|
|
||||
|
|
||||
pkglib_LTLIBRARIES = libdevsup.la |
|
||||
|
|
||||
libdevsup_la_SOURCES = devsup.c |
|
||||
|
|
||||
|
|
||||
|
|
||||
INCLUDES = -I$(top_srcdir)/src/include |
|
||||
MAINTAINERCLEANFILES = Makefile.in |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue