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/frontend/miscvars.c b/src/frontend/miscvars.c index 9c4287f3d..af5376279 100644 --- a/src/frontend/miscvars.c +++ b/src/frontend/miscvars.c @@ -116,6 +116,8 @@ char *ft_setkwords[] = { "subend", "subinvoke", "substart", + "lxt2waves" /* holmes: adding switch to write lxt2 waveform database */ + "swapendian" /* holmes: adding switch to write raw file in opposite endianness of OS */ "term", "ticmarks", "tnom", diff --git a/src/frontend/outitf.c b/src/frontend/outitf.c index 3f47b3720..ba4355ecf 100644 --- a/src/frontend/outitf.c +++ b/src/frontend/outitf.c @@ -209,15 +209,18 @@ beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analNam /* Pass 1. */ if (numsaves && !saveall) { - for (i = 0; i < numsaves; i++) + for (i = 0; i < numsaves; i++) { + printf("saves[%d].name(%s)\n",i,saves[i].name); if (!savesused[i]) for (j = 0; j < numNames; j++) if (name_eq(saves[i].name, dataNames[j])) { + printf("saves[%d].name(%s) dataNames[%d](%s)\n",i,saves[i].name,j,dataNames[j]); /* holmes: looking for missing digital signals */ addDataDesc(run, dataNames[j], dataType, j); savesused[i] = TRUE; saves[i].used = 1; break; } + } } else { for (i = 0; i < numNames; i++) if (!refName || !name_eq(dataNames[i], refName)) @@ -912,6 +915,9 @@ static void fileEndPoint(FILE *fp, bool bin) { /* write row buffer to file */ + + printf("fileEndPoint: flushing binary data to raw file.\n"); /* holmes: Is this used in dctran? */ + /* otherwise the data has already been written */ if (bin) diff --git a/src/frontend/outitf.h b/src/frontend/outitf.h index c3446b4e3..31e55ffc8 100644 --- a/src/frontend/outitf.h +++ b/src/frontend/outitf.h @@ -36,6 +36,7 @@ struct runDesc { bool writeOut; bool windowed; bool binary; + bool swapendian; struct plot *runPlot; FILE *fp; long pointPos; /* where to write pointCount */ diff --git a/src/frontend/plotting/plotcurv.c b/src/frontend/plotting/plotcurv.c index f04ddb65f..a1ec4278c 100644 --- a/src/frontend/plotting/plotcurv.c +++ b/src/frontend/plotting/plotcurv.c @@ -137,7 +137,7 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart) dy = isreal(v) ? v->v_realdata[i] : realpart(v->v_compdata[i]); if ((i == 0 || (dir > 0 ? lx > dx : dir < 0 ? lx < dx : 0)) && - xs->v_plot && xs->v_plot->pl_scale == xs) + xs->v_plot && xs->v_plot->pl_scale && xs->v_plot->pl_scale == xs) { gr_point(v, dx, dy, lx, ly, 0); } else { diff --git a/src/frontend/postcoms.c b/src/frontend/postcoms.c index 99a957cfb..e2698c282 100644 --- a/src/frontend/postcoms.c +++ b/src/frontend/postcoms.c @@ -474,14 +474,20 @@ com_write(wordlist *wl) scalefound = FALSE; for (d = newplot.pl_dvecs; d; d = d->v_next) { if (d->v_scale) { - for (vv = newplot.pl_dvecs; vv; vv = vv->v_next) - if (vec_eq(vv, d->v_scale)) + for (vv = newplot.pl_dvecs; vv; vv = vv->v_next) { + if (vec_eq(vv, d->v_scale)) { break; + } + } /* We have to grab it... */ + if(vv && d->v_scale && vec_eq(vv, d->v_scale)) { /* holmes: */ + } /* holmes: */ + else { /* holmes: */ vv = vec_copy(d->v_scale); vv->v_next = newplot.pl_dvecs; newplot.pl_dvecs = vv; scalefound = TRUE; + } /* holmes: */ } } diff --git a/src/include/ngspice/cktdefs.h b/src/include/ngspice/cktdefs.h index 5e907fb41..feeb8c5f5 100644 --- a/src/include/ngspice/cktdefs.h +++ b/src/include/ngspice/cktdefs.h @@ -16,6 +16,13 @@ #endif /* gtri - evt - wbk - 5/20/91 - add event-driven and enhancements data */ +/* holmes lxt2 */ +#define LXT2 +#ifdef LXT2 +/* #define LXT2_DEBUG */ +#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 +295,12 @@ struct CKTcircuit { NGHASHPTR DEVnameHash; NGHASHPTR MODnameHash; + +/* holmes: adding XLT2 waveforms 5/18/2011 */ +#ifdef LXT2 + lxt2_t lxt2; +#endif + }; diff --git a/src/include/ngspice/evt.h b/src/include/ngspice/evt.h index 546abb6fe..a67fbc658 100644 --- a/src/include/ngspice/evt.h +++ b/src/include/ngspice/evt.h @@ -48,6 +48,11 @@ NON-STANDARD FEATURES #include "ngspice/miftypes.h" +/* +#ifdef LXT2 +#include "ngspice/lxt2_write.h" +#endif +*/ /* ************** */ /* Info structure */ diff --git a/src/include/ngspice/evtproto.h b/src/include/ngspice/evtproto.h index 28ce5b871..35f8c0ce7 100644 --- a/src/include/ngspice/evtproto.h +++ b/src/include/ngspice/evtproto.h @@ -123,4 +123,11 @@ void EVTaccept( struct dvec *EVTfindvec(char *node); +/*#ifdef LXT2*/ +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*/ + #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/cktnames.c b/src/spicelib/analysis/cktnames.c index 9fc145310..25988799c 100644 --- a/src/spicelib/analysis/cktnames.c +++ b/src/spicelib/analysis/cktnames.c @@ -24,9 +24,13 @@ CKTnames(CKTcircuit *ckt, int *numNames, IFuid **nameList) *nameList = TMALLOC(IFuid, *numNames); if ((*nameList) == NULL) return(E_NOMEM); i=0; + printf("Analog Nodes:\n");/* holmes : tracking down node name origins. */ + printf("-------------\n");/* holmes : tracking down node name origins. */ for (here = ckt->CKTnodes->next; here; here = here->next) { + printf("%s\n",here->name); /* holmes : tracking down node name origins. */ (*nameList) [i++] = here->name; } + printf("-------------\n\n");/* holmes : tracking down node name origins. */ return(OK); } diff --git a/src/spicelib/analysis/dctran.c b/src/spicelib/analysis/dctran.c index 5de78d172..efe6b7715 100644 --- a/src/spicelib/analysis/dctran.c +++ b/src/spicelib/analysis/dctran.c @@ -200,6 +200,13 @@ DCtran(CKTcircuit *ckt, } #ifdef XSPICE +#ifdef LXT2 +#ifdef LXT2_DEBUG + printf("LXT2 dctran: calling lxt2_init.\n"); + printf("job->JOBname(%s)\n", job->JOBname); +#endif + 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 +481,15 @@ DCtran(CKTcircuit *ckt, #ifdef CLUSTER CLUoutput(ckt); #endif - if(ckt->CKTtime >= ckt->CKTinitTime) + if(ckt->CKTtime >= ckt->CKTinitTime) { +#ifdef LXT2_DEBUG + printf("dctran CKTdump TIME(%g)\n",ckt->CKTtime); /* holmes: this is where dctran actually saves data to an array or to ascii file. */ +#endif 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 +506,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/evtinit.c b/src/xspice/evt/evtinit.c index 960159d9c..bf20fb1e9 100644 --- a/src/xspice/evt/evtinit.c +++ b/src/xspice/evt/evtinit.c @@ -207,14 +207,19 @@ static int EVTcheck_nodes( CKTnode *analog_node; Evt_Node_Info_t *event_node; + int evtNodeIsTested; + static char *err_prefix = "ERROR - node "; static char *err_collide = " cannot be both analog and digital"; /* Report error if any analog node name matches any event node name */ event_node = ckt->evt->info.node_list; + printf("Event Driven Nodes:\n"); /* holmes : would like these listed a tran init with their types and values */ + printf("-------------------\n"); /* holmes : would like these listed a tran init with their types and values */ while(event_node) { analog_node = ckt->CKTnodes; + evtNodeIsTested = 0; while(analog_node) { if(strcmp(event_node->name, analog_node->name) == 0) { errMsg = TMALLOC(char, strlen(err_prefix) + strlen(event_node->name) + strlen(err_collide) + 1); @@ -223,11 +228,15 @@ static int EVTcheck_nodes( err_collide); fprintf(stdout, "%s\n", errMsg); return(E_PRIVATE); + evtNodeIsTested = 1; } analog_node = analog_node->next; } + if (evtNodeIsTested == 0) printf("%s\n", event_node->name); /* holmes : would like these listed after DCOP/TRAN init with their types and values */ event_node = event_node->next; } + printf("-------------------\n\n"); /* holmes : would like these listed a tran init with their types and values */ + /* Return */ return(OK); diff --git a/src/xspice/evt/evtiter.c b/src/xspice/evt/evtiter.c index ee774225f..9dc167e71 100644 --- a/src/xspice/evt/evtiter.c +++ b/src/xspice/evt/evtiter.c @@ -232,6 +232,12 @@ int EVTiter( /* resolved node value has not changed */ if(g_mif_info.circuit.anal_type == MIF_TRAN) { +#ifdef LXT2 +#ifdef LXT2_DEBUG + printf("LXT2 evtiter.c: EVTemitlxt2\n"); +#endif + 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));