* AUTHORS TODO: Small updates.

* src/devices/dev.c src/devices/dev.h: Small updates.

	* src/devices/README: Short description of the purpose of the
	devices directory.

	* src/analysis/cktaccpt.c src/analysis/cktcrte.c
	src/analysis/cktinit.c: Moved these files into src/devices.

	* src/analysis/dctran.c: Updates to ease the move.

	* src/analysis/Makefile.am src/devices/Makefile.am: Updates

	* src/Makefile.am: Library loading reordered.

	* src/main.c: Small updates.

	* src/devices/devsup/devsup.c: Moved this file into src/devices.

	* src/devices/devsup/.cvsignore
	src/devices/devsup/Makefile.am: Superfluous files, removed

	* configure.in: Removed src/devices/devsup/Makefile.
This commit is contained in:
arno 2000-06-17 22:54:26 +00:00
parent 5cb17f3efc
commit d7ad0ee10c
20 changed files with 187 additions and 179 deletions

View File

@ -17,6 +17,7 @@ Min-Chie Jeng
Kenneth H. Keller Kenneth H. Keller
Mathew Lew Mathew Lew
Weidong Liu Weidong Liu
Richard D. McRoberts
Gary W. Ng Gary W. Ng
Hong June Park Hong June Park
Thomas L. Quarles Thomas L. Quarles

20
TODO
View File

@ -6,9 +6,9 @@ Standards conformance
--------------------- ---------------------
Add proper copyright headers to every source, header, documentation Add proper copyright headers to every source, header, documentation
and other files and other files.
Fix all compiler warnings Fix all compiler warnings.
Remove smktemp() in favor of tmpfile() or other ANSI C equivalent; Remove smktemp() in favor of tmpfile() or other ANSI C equivalent;
Note: different symantics! Note: different symantics!
@ -20,8 +20,8 @@ available.
Usability issues Usability issues
------------------ ------------------
Plug all memory leaks (use debauch from Plug all memory leaks; use debauch (http://quorum.tamu.edu/jon/gnu/)
http://quorum.tamu.edu/jon/gnu/ to find them) or another memory checker to find them.
Either get help program functioning again; OR interface to webbrowser, Either get help program functioning again; OR interface to webbrowser,
info reader and get rid of all help-related code. Option 2 is the info reader and get rid of all help-related code. Option 2 is the
@ -31,15 +31,17 @@ most appealing.
Refactorings Refactorings
------------ ------------
Make devices dynamically loadable (perhaps use framework from glib) Make devices dynamically loadable (perhaps use framework from glib).
Separate out circuit builder from the analysis code and put it in a Separate out circuit builder from the analysis code and put it in the
separate src/builder directory devices directory (rename devices directory to simbuilder at some
point). [PARTIAL]
Separate ngspice and nutmeg; i.e., no more SIMULATOR define Separate ngspice and nutmeg; i.e., no more SIMULATOR define. Dispose
of nutmeg all together once the devices are plugins.
Integrate bsim3, bsim3v1, bsim3v2 to use a single codebase instead of Integrate bsim3, bsim3v1, bsim3v2 to use a single codebase instead of
three only slighty differing implementations three only slighty differing implementations.
Separate frontend commands from supporting code. Command files Separate frontend commands from supporting code. Command files
start with com_*. [PARTIAL] start with com_*. [PARTIAL]

View File

@ -212,7 +212,6 @@ src/devices/cap/Makefile \
src/devices/cccs/Makefile \ src/devices/cccs/Makefile \
src/devices/ccvs/Makefile \ src/devices/ccvs/Makefile \
src/devices/csw/Makefile \ src/devices/csw/Makefile \
src/devices/devsup/Makefile \
src/devices/dio/Makefile \ src/devices/dio/Makefile \
src/devices/ind/Makefile \ src/devices/ind/Makefile \
src/devices/isrc/Makefile \ src/devices/isrc/Makefile \

View File

@ -26,7 +26,6 @@ DYNAMIC_DEVICELIBS = \
devices/ccvs/libccvs.la \ devices/ccvs/libccvs.la \
devices/ccvs/libccvs.la \ devices/ccvs/libccvs.la \
devices/csw/libcsw.la \ devices/csw/libcsw.la \
devices/devsup/libdevsup.la \
devices/dio/libdio.la \ devices/dio/libdio.la \
devices/ind/libind.la \ devices/ind/libind.la \
devices/isrc/libisrc.la \ devices/isrc/libisrc.la \
@ -57,9 +56,9 @@ ngspice_LDADD = \
spice.o \ spice.o \
frontend/libfte.a \ frontend/libfte.a \
frontend/plotting/libplotting.a \ frontend/plotting/libplotting.a \
devices/libdev.a \
$(DYNAMIC_DEVICELIBS) \ $(DYNAMIC_DEVICELIBS) \
analysis/libckt.a \ analysis/libckt.a \
devices/libdev.a \
parser/libparser.a \ parser/libparser.a \
hlp/libhlp.a \ hlp/libhlp.a \
circuit/libinp.a \ circuit/libinp.a \

View File

@ -6,7 +6,6 @@ libckt_a_SOURCES = \
acan.c \ acan.c \
acaskq.c \ acaskq.c \
acsetp.c \ acsetp.c \
cktaccpt.c \
cktacct.c \ cktacct.c \
cktacdum.c \ cktacdum.c \
cktask.c \ cktask.c \
@ -15,7 +14,6 @@ libckt_a_SOURCES = \
cktbindn.c \ cktbindn.c \
cktbkdum.c \ cktbkdum.c \
cktclrbk.c \ cktclrbk.c \
cktcrte.c \
cktdelt.c \ cktdelt.c \
cktdest.c \ cktdest.c \
cktdisto.c \ cktdisto.c \
@ -33,7 +31,6 @@ libckt_a_SOURCES = \
cktgrnd.c \ cktgrnd.c \
ckti2nod.c \ ckti2nod.c \
cktic.c \ cktic.c \
cktinit.c \
cktlnkeq.c \ cktlnkeq.c \
cktload.c \ cktload.c \
cktmapn.c \ cktmapn.c \

View File

@ -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);
}

View File

@ -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);
}

View File

@ -6,15 +6,15 @@ Author: 1985 Thomas L. Quarles
/* subroutine to do DC TRANSIENT analysis /* subroutine to do DC TRANSIENT analysis
--- ONLY, unlike spice2 routine with the same name! */ --- ONLY, unlike spice2 routine with the same name! */
#include "ngspice.h" #include <config.h>
#include <stdio.h> #include <cktdefs.h>
#include "trandefs.h" #include <cktaccept.h>
#include "cktdefs.h" #include <trandefs.h>
#include "sperror.h" #include <sperror.h>
int int
DCtran(CKTcircuit *ckt, int restart) DCtran(CKTcircuit *ckt,
/* restart: forced restart flag */ int restart) /* forced restart flag */
{ {
int i; int i;
double olddelta; double olddelta;

View File

@ -5,6 +5,8 @@
Author: 1985 Wayne A. Christopher Author: 1985 Wayne A. Christopher
The main routine for ngspice */ The main routine for ngspice */
#include <ngspice.h>
#include <stdio.h> #include <stdio.h>
#include <setjmp.h> #include <setjmp.h>
#include <signal.h> #include <signal.h>
@ -14,16 +16,12 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <getopt.h> #include <getopt.h>
#include "ngspice.h" #include <iferrmsg.h>
#include "ifsim.h" #include <ftedefs.h>
#include "inpdefs.h" #include <devdefs.h>
#include "iferrmsg.h" #include <devices/dev.h>
#include "cpdefs.h" #include <misc/ivars.h>
#include "ftedefs.h" #include <frontend/resource.h>
#include "ftedev.h"
#include "ftedebug.h"
#include "const.h"
#include "devices/dev.h"
#ifdef HAVE_PWD_H #ifdef HAVE_PWD_H
#include <pwd.h> #include <pwd.h>

View File

@ -13,7 +13,6 @@ SUBDIRS = \
cccs \ cccs \
ccvs \ ccvs \
csw \ csw \
devsup \
dio \ dio \
ind \ ind \
isrc \ isrc \
@ -37,7 +36,12 @@ lib_LIBRARIES = libdev.a
libdev_a_SOURCES = \ libdev_a_SOURCES = \
dev.c \ dev.c \
dev.h dev.h \
devsup.c \
cktaccept.c \
cktaccept.h \
cktcrte.c \
cktinit.c
INCLUDES = -I$(top_srcdir)/src/include INCLUDES = -I$(top_srcdir)/src/include

View File

@ -0,0 +1,3 @@
The circuit builder.
It takes a circuit description and builds a simulator from it.

View File

@ -4,31 +4,31 @@ Author: 1985 Thomas L. Quarles
**********/ **********/
/* CKTaccept(ckt) /* CKTaccept(ckt)
* this is a driver program to iterate through all the various *
* accept functions provided for the circuit elements in the * this is a driver program to iterate through all the various accept
* given circuit * functions provided for the circuit elements in the given circuit */
*/
#include "ngspice.h" #include <config.h>
#include <stdio.h> #include <devdefs.h>
#include "smpdefs.h" #include <sperror.h>
#include "cktdefs.h" #include <ifsim.h>
#include "devdefs.h" #include <devdefs.h>
#include "sperror.h"
#include "dev.h"
int int
CKTaccept(CKTcircuit *ckt) CKTaccept(CKTcircuit *ckt)
{ {
extern SPICEdev *DEVices[];
int i; int i;
int error; int error;
SPICEdev **devs;
devs = devices();
for (i = 0; i < DEVmaxnum; i++) { for (i = 0; i < DEVmaxnum; i++) {
if ( ((*DEVices[i]).DEVaccept != NULL) && (ckt->CKThead[i] != NULL) ){ if ( ((*devs[i]).DEVaccept != NULL) && (ckt->CKThead[i] != NULL) ){
error = (*((*DEVices[i]).DEVaccept))(ckt,ckt->CKThead[i]); error = (*((*devs[i]).DEVaccept))(ckt,ckt->CKThead[i]);
if(error) return(error); if (error)
return(error);
} }
} }
#ifdef PREDICTOR #ifdef PREDICTOR

View File

@ -0,0 +1,6 @@
#ifndef _CKTACCEPT_H
#define _CKTACCEPT_H
int CKTaccept(CKTcircuit *ckt);
#endif

View File

@ -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;
}

View File

@ -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;
}

View File

@ -29,8 +29,10 @@
#include <config.h> #include <config.h>
#include <devdefs.h>
#include <ifsim.h>
#include "dev.h" #include "dev.h"
#include "devdefs.h"
/* Enable the following devices */ /* Enable the following devices */
#define DEV_asrc #define DEV_asrc
@ -161,3 +163,9 @@ devices_ptr(void)
{ {
return (IFdevice **) DEVices; return (IFdevice **) DEVices;
} }
SPICEdev **
devices(void)
{
return DEVices;
}

View File

@ -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

View File

@ -1,6 +0,0 @@
Makefile.in
Makefile
.deps
.libs
*.lo
*.la

View File

@ -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