From 73455c42e77437fc9305991a77cd4adadabaf080 Mon Sep 17 00:00:00 2001 From: Jim Holmes Date: Sun, 26 Oct 2014 18:56:04 +0200 Subject: [PATCH] applied main changes to ngspice --- configure.ac | 7 +++++++ src/include/ngspice/cktdefs.h | 12 ++++++++++++ src/include/ngspice/evtproto.h | 5 +++++ src/include/ngspice/typedefs.h | 2 ++ src/main.c | 14 +++++++++++--- src/spicelib/analysis/Makefile.am | 3 +++ src/spicelib/analysis/dctran.c | 14 +++++++++++++- src/xspice/evt/Makefile.am | 1 + src/xspice/evt/evtiter.c | 3 +++ 9 files changed, 57 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 28c0d6cfc..5985126b9 100644 --- a/configure.ac +++ b/configure.ac @@ -720,6 +720,13 @@ AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], [AC_DEFINE([HAVE_LIBFFTW3], [], [Have fft routines in libfftw3]) LIBS="$LIBS -lfftw3"]) +AC_CHECK_LIB([z],[compress], + [LIBS="$LIBS -lz"], + [AC_MSG_ERROR([Couldn't find z compression libraries.])]) +AC_MSG_RESULT([LXT2 waveform database included]) +#AC_DEFINE([LXT2], [1], [The LXT2 waveform database]) +AC_CHECK_HEADERS([zlibdefs.h zlib.h malloc.h alloca.h inttypes.h]) + # Check for a few mathematical functions: AC_CHECK_FUNCS([erfc logb scalb scalbn asinh acosh atanh finite]) # According POSIX we should look for macros first diff --git a/src/include/ngspice/cktdefs.h b/src/include/ngspice/cktdefs.h index 5e907fb41..ff0151d14 100644 --- a/src/include/ngspice/cktdefs.h +++ b/src/include/ngspice/cktdefs.h @@ -16,6 +16,12 @@ #endif /* gtri - evt - wbk - 5/20/91 - add event-driven and enhancements data */ +#define LXT2 + +#ifdef LXT2 +#define LXT2_TIME_RESOLUTION_EXPONENT -12 +#include "ngspice/lxt2_write.h" +#endif #define MAXNUMDEVS 64 /* Max number of possible devices PN:XXX may cause toubles*/ #define MAXNUMDEVNODES 4 /* Max No. of nodes per device */ @@ -288,6 +294,11 @@ struct CKTcircuit { NGHASHPTR DEVnameHash; NGHASHPTR MODnameHash; + +#ifdef LXT2 + lxt2_t lxt2; +#endif + }; @@ -317,6 +328,7 @@ extern int CKTdltNNum(CKTcircuit *, int); extern int CKTdltNod(CKTcircuit *, CKTnode *); extern int CKTdoJob(CKTcircuit *, int , TSKtask *); extern void CKTdump(CKTcircuit *, double, void *); +extern void CKTemitlxt2(runDesc *); extern int CKTsoaInit(void); extern int CKTsoaCheck(CKTcircuit *); #ifdef CIDER diff --git a/src/include/ngspice/evtproto.h b/src/include/ngspice/evtproto.h index 28ce5b871..03d6b8cde 100644 --- a/src/include/ngspice/evtproto.h +++ b/src/include/ngspice/evtproto.h @@ -123,4 +123,9 @@ void EVTaccept( struct dvec *EVTfindvec(char *node); +void EVTemitlxt2( + CKTcircuit *ckt, /* The circuit structure */ + int node_index, /* The node index of lxt2 data stream */ + Evt_Node_t *from); /* Location to event node data to emit to lxt2 */ + #endif diff --git a/src/include/ngspice/typedefs.h b/src/include/ngspice/typedefs.h index 332017bc8..1447ba7fb 100644 --- a/src/include/ngspice/typedefs.h +++ b/src/include/ngspice/typedefs.h @@ -48,4 +48,6 @@ typedef struct SPICEanalysis SPICEanalysis; typedef struct runDesc runDesc; +typedef struct lxt2_s lxt2_t; + #endif diff --git a/src/main.c b/src/main.c index 0ea88cdc5..62d5e2052 100644 --- a/src/main.c +++ b/src/main.c @@ -691,13 +691,21 @@ show_help(void) static void show_version(void) { - printf("%s compiled from %s revision %s\n" + printf("%s compiled from %s revision(%s) branch(SMBV)\n" + "-----------------------------------------------------\n" "Written originally by Berkeley University\n" - "Currently maintained by the NGSpice Project\n\n" + "Developed and maintained by the Ngspice Project\n" + "Enhanced by Sherlock Model-Based Verification, L.L.C.\n" + "-----------------------------------------------------\n" "Copyright (C) 1985-1996," " The Regents of the University of California\n" "Copyright (C) 1999-2011," - " The NGSpice Project\n", cp_program, PACKAGE, VERSION); + " The NGSpice Project\n" + "Copyright (C) 2001-2012," + " Tony Bybell\n" + "Copyright (C) 2011-2014," + " Sherlock Model-Based Verification, L.L.C.\n", + cp_program, PACKAGE, VERSION); } #ifdef SIMULATOR diff --git a/src/spicelib/analysis/Makefile.am b/src/spicelib/analysis/Makefile.am index 86d6b7371..6eed1bd54 100644 --- a/src/spicelib/analysis/Makefile.am +++ b/src/spicelib/analysis/Makefile.am @@ -32,6 +32,7 @@ libckt_la_SOURCES = \ ckti2nod.c \ cktic.c \ cktlnkeq.c \ + cktlxt2.c \ cktload.c \ cktmapn.c \ cktmask.c \ @@ -79,6 +80,8 @@ libckt_la_SOURCES = \ dkerproc.c \ dloadfns.c \ dsetparm.c \ + lxt2_init.c \ + lxt2_write.c \ naskq.c \ nevalsrc.c \ ninteg.c \ diff --git a/src/spicelib/analysis/dctran.c b/src/spicelib/analysis/dctran.c index 5de78d172..4256a839a 100644 --- a/src/spicelib/analysis/dctran.c +++ b/src/spicelib/analysis/dctran.c @@ -200,6 +200,9 @@ DCtran(CKTcircuit *ckt, } #ifdef XSPICE +#ifdef LXT2 + lxt2_init(job->TRANplot); +#endif /* gtri - begin - wbk - set a breakpoint at end of supply ramping time */ /* must do this after CKTtime set to 0 above */ if(ckt->enh->ramp.ramptime > 0.0) @@ -474,8 +477,12 @@ DCtran(CKTcircuit *ckt, #ifdef CLUSTER CLUoutput(ckt); #endif - if(ckt->CKTtime >= ckt->CKTinitTime) + if (ckt->CKTtime >= ckt->CKTinitTime) { CKTdump(ckt, ckt->CKTtime, job->TRANplot); +#ifdef LXT2 + CKTemitlxt2(job->TRANplot); +#endif + } #ifdef XSPICE /* gtri - begin - wbk - Update event queues/data for accepted timepoint */ /* Note: this must be done AFTER sending results to SI so it can't */ @@ -492,6 +499,11 @@ DCtran(CKTcircuit *ckt, printf(" done: time is %g, final time is %g, and tol is %g\n", ckt->CKTtime, ckt->CKTfinalTime, ckt->CKTminBreak); #endif + +#ifdef LXT2 + lxt2_end(job->TRANplot); +#endif + SPfrontEnd->OUTendPlot (job->TRANplot); job->TRANplot = NULL; UPDATE_STATS(0); diff --git a/src/xspice/evt/Makefile.am b/src/xspice/evt/Makefile.am index 9eba09fe2..e9e184b4d 100644 --- a/src/xspice/evt/Makefile.am +++ b/src/xspice/evt/Makefile.am @@ -17,6 +17,7 @@ libevtxsp_la_SOURCES = \ evtdeque.c \ evtinit.c \ evtload.c \ + evtlxt2.c \ evtnode_copy.c \ evtplot.c \ evtqueue.c \ diff --git a/src/xspice/evt/evtiter.c b/src/xspice/evt/evtiter.c index ee774225f..16afd08f1 100644 --- a/src/xspice/evt/evtiter.c +++ b/src/xspice/evt/evtiter.c @@ -232,6 +232,9 @@ int EVTiter( /* resolved node value has not changed */ if(g_mif_info.circuit.anal_type == MIF_TRAN) { +#ifdef LXT2 + EVTemitlxt2(ckt, node_index, &(rhsold[node_index])); +#endif node = *(node_data->tail[node_index]); node_data->tail[node_index] = &(node->next); EVTnode_copy(ckt, node_index, &(rhsold[node_index]), &(node->next));