Merge branch 'master' for ngspice-42 into bt_dev

This commit is contained in:
Brian Taylor 2023-12-28 10:26:01 -08:00
commit f74d1e33ef
18 changed files with 743 additions and 685 deletions

8
NEWS
View File

@ -3,7 +3,7 @@ Ngspice-42, Dec 24th, 2023
- New features:
+ New optional matrix solver KLU (select by 'option klu')
+ improve error messages (more verbose, user centric)
+ Add variable wr_onspace to allow printing the vetor name with
+ Add variable wr_onspace to allow printing the vector name with
one space delimiter
+ Re-write of the code model PWM generator
+ Linked list modtab has been enhanced by a hash table
@ -18,9 +18,11 @@ Ngspice-42, Dec 24th, 2023
+ Add functions ngSpice_LockRealloc and ngSpice_UnlockRealloc
+ Add new code model function cm_irreversible().
+ Add XSPICE code model d_cosim, a generic adaptor for digital cosimulation.
+ Script 'vlnggen' may be used with Verilator and d_cosim to create
XSPICE code models controlled by HDL code.
+ New interpreter commands strstr, strslice, fopen, fread and fclose.
+ Recognise *ng_script_with_params"
+ Add a predifined variable 'skywaterpdk' to speed up circuit
+ Recognise *ng_script_with_params
+ Add a predefined variable 'skywaterpdk' to speed up circuit
loading and parsing.
+ Add scripts for running the paranoia tests in parallel on Linux with valgrind.

View File

@ -16,7 +16,7 @@
# problem to the user.
AC_PREREQ([2.59])
m4_define([ngspice_major_version], [41+])
m4_define([ngspice_major_version], [42])
m4_define([ngspice_minor_version], [0])
m4_define([ngspice_version],
[ngspice_major_version])
@ -117,8 +117,8 @@ LT_INIT([shared static])
# --> Set 'LT_NGSPICE_AGE' to 0.
LT_NGSPICE_CURRENT=0
LT_NGSPICE_REVISION=8
LT_NGSPICE_AGE=1
LT_NGSPICE_REVISION=9
LT_NGSPICE_AGE=2
LIBNGSPICE_SO_VERSION=$LT_NGSPICE_CURRENT.$LT_NGSPICE_REVISION.$LT_NGSPICE_AGE
# Announce the libtool version

View File

@ -4,8 +4,8 @@ To run the paranoia test suite in parallel on Linux with valgrind:
1. Download the paranoia tests (paranoia.7z) from the ngspice Quality web page.
2. p7zip -d paranoia.7z
Rename the unzipped directory to a name without spaces which would otherwise
confuse valgrind.
Rename the unzipped directory to a name without spaces which would
otherwise confuse valgrind.
3. cd into the renamed unzipped directory.

View File

@ -8165,6 +8165,9 @@ static void inp_meas_current(struct card *deck)
else if (ciprefix(".ends", curr_line)) {
subs--;
subc_start = subc_prev;
/* FIXME: just a hack, needs proper levelling */
if (subs == 0)
subc_start = NULL;
}
else
continue;

View File

@ -1469,21 +1469,18 @@ InterpFileAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
if (run->refIndex != -1) {
/* Save first time step */
if (refValue->rValue == run->circuit->CKTinitTime) {
timeold = refValue->rValue;
fileStartPoint(run->fp, run->binary, run->pointCount);
fileAddRealValue(run->fp, run->binary, run->circuit->CKTinitTime);
interpolatenow = nodata = FALSE;
}
/* Save last time step */
else if (refValue->rValue == run->circuit->CKTfinalTime) {
timeold = refValue->rValue;
fileStartPoint(run->fp, run->binary, run->pointCount);
fileAddRealValue(run->fp, run->binary, run->circuit->CKTfinalTime);
interpolatenow = nodata = FALSE;
}
/* Save exact point */
else if (refValue->rValue == timestep) {
timeold = refValue->rValue;
fileStartPoint(run->fp, run->binary, run->pointCount);
fileAddRealValue(run->fp, run->binary, timestep);
timestep += run->circuit->CKTstep;
@ -1501,7 +1498,6 @@ InterpFileAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
else {
/* Do not save this step */
run->pointCount--;
timeold = refValue->rValue;
nodata = TRUE;
interpolatenow = FALSE;
}
@ -1542,7 +1538,6 @@ InterpFileAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
newval = (timestep - run->circuit->CKTstep - timeold)/(timenew - timeold) * (valuenew[i] - valueold[i]) + valueold[i];
fileAddRealValue(run->fp, run->binary, newval);
valueold[i] = valuenew[i];
timeold = refValue->rValue;
}
else if (nodata)
/* Just keep the transient output value corresponding to timeold,
@ -1574,7 +1569,6 @@ InterpFileAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
newval = (timestep - run->circuit->CKTstep - timeold)/(timenew - timeold) * (valuenew[i] - valueold[i]) + valueold[i];
fileAddRealValue(run->fp, run->binary, newval);
valueold[i] = valuenew[i];
timeold = refValue->rValue;
}
else if (nodata)
/* Just keep the transient output value corresponding to timeold,
@ -1587,7 +1581,7 @@ InterpFileAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
#endif
}
timeold = refValue->rValue;
fileEndPoint(run->fp, run->binary);
/* Check that the write to disk completed successfully, otherwise abort */
@ -1634,19 +1628,16 @@ InterpPlotAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
/* Save first time step */
if (refValue->rValue == run->circuit->CKTinitTime) {
timeold = refValue->rValue;
plotAddRealValue(&run->data[iscale], refValue->rValue);
interpolatenow = nodata = FALSE;
}
/* Save last time step */
else if (refValue->rValue == run->circuit->CKTfinalTime) {
timeold = refValue->rValue;
plotAddRealValue(&run->data[iscale], run->circuit->CKTfinalTime);
interpolatenow = nodata = FALSE;
}
/* Save exact point */
else if (refValue->rValue == timestep) {
timeold = refValue->rValue;
plotAddRealValue(&run->data[iscale], timestep);
timestep += run->circuit->CKTstep;
interpolatenow = nodata = FALSE;
@ -1662,7 +1653,6 @@ InterpPlotAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
else {
/* Do not save this step */
run->pointCount--;
timeold = refValue->rValue;
nodata = TRUE;
interpolatenow = FALSE;
}
@ -1707,7 +1697,6 @@ InterpPlotAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
newval = (timestep - run->circuit->CKTstep - timeold)/(timenew - timeold) * (valuenew[i] - valueold[i]) + valueold[i];
plotAddRealValue(&run->data[i], newval);
valueold[i] = valuenew[i];
timeold = refValue->rValue;
}
else if (nodata)
/* Just keep the transient output value corresponding to timeold,
@ -1730,7 +1719,6 @@ InterpPlotAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
newval = (timestep - run->circuit->CKTstep - timeold)/(timenew - timeold) * (valuenew[i] - valueold[i]) + valueold[i];
plotAddRealValue(&run->data[i], newval);
valueold[i] = valuenew[i];
timeold = refValue->rValue;
}
else if (nodata)
/* Just keep the transient output value corresponding to timeold,
@ -1744,7 +1732,7 @@ InterpPlotAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
#endif
}
timeold = refValue->rValue;
gr_iplot(run->runPlot);
if (ft_bpcheck(run->runPlot, run->pointCount) == FALSE)

View File

@ -3,8 +3,10 @@
noinst_HEADERS = \
tclspice.h \
acdefs.h \
amd.h \
bdrydefs.h \
bool.h \
btf.h \
carddefs.h \
ciderinp.h \
cidersupt.h \
@ -14,10 +16,12 @@ noinst_HEADERS = \
cm.h \
cmproto.h \
cmtypes.h \
colamd.h \
compatmode.h \
complex.h \
const.h \
contdefs.h \
cosim.h \
cpdefs.h \
cpextern.h \
cpstd.h \
@ -63,7 +67,9 @@ noinst_HEADERS = \
ipcproto.h \
ipctiein.h \
jobdefs.h \
logicexp.h \
klu.h \
klu-binding.h \
logicexp.h \
lsort.h \
macros.h \
material.h \
@ -123,6 +129,7 @@ noinst_HEADERS = \
twomesh.h \
typedefs.h \
udevices.h \
UFconfig.h \
wordlist.h \
1-f-code.h \
FastNorm3.h \

View File

@ -47,7 +47,10 @@ not modify them).
***************** If XSPICE is enabled *************************************
**
ngCM_Input_Path(const char*)
sets the input path for files loaded by code models.
Set the input path for files loaded by code models
like d_state, file_source, d_source.
Useful when netlist is sent by ngSpice_Circ and therefore
Infile_Path cannot be retrieved automatically.
If NULL is sent, return the current Infile_Path.
**
@ -82,6 +85,13 @@ char** ngSpice_AllVecs(char*);
returns to the caller a pointer to an array of vector names in the plot
named by the string in the argument.
**
int ngSpice_LockRealloc(void)
int ngSpice_UnlockRealloc(void)
Locking and unlocking the realloc of output vectors during simulation. May be set
during reading output vectors in the primary thread, while the simulation in the
background thread is moving on.
**
Additional basics:
No memory mallocing and freeing across the interface:
@ -97,7 +107,7 @@ are of type bool if sharedspice.h is used externally.
*/
#ifndef NGSPICE_PACKAGE_VERSION
#define NGSPICE_PACKAGE_VERSION "41+"
#define NGSPICE_PACKAGE_VERSION "42"
#endif
/* we have NG_BOOL instead of BOOL */
#ifndef HAS_NG_BOOL

View File

@ -1,7 +1,16 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = SuiteSparse.org
noinst_LTLIBRARIES = libKLU_real.la libKLU_complex.la libKLU.la
noinst_HEADERS = \
amd_internal.h \
btf_internal.h \
klu_internal.h \
klu_version.h
libKLU_real_la_SOURCES = \
klu.c \
klu_diagnostics.c \

View File

@ -2,6 +2,7 @@
noinst_LTLIBRARIES = libmisc.la
EXTRA_DIST = win_time.c
libmisc_la_SOURCES = \
getopt_long_bsd.c \

View File

@ -1102,13 +1102,15 @@ int ngSpice_Command(char* comexec)
return 1;
}
#ifdef XSPICE
/* Set the input path for files loaded by code models.
/* Set the input path for files loaded by code models
like d_state, file_source, d_source.
Useful when netlist is sent by ngSpice_Circ and therefore
Infile_Path cannot be retrieved automatically.
If NULL is sent, return the current Infile_Path. */
IMPEXP
char *ngCM_Input_Path(const char* path)
{
/* delete existing command memory */
/* override existing path */
if (path) {
txfree(Infile_Path);
Infile_Path = copy(path);
@ -1116,7 +1118,6 @@ char *ngCM_Input_Path(const char* path)
fprintf(stdout, "Note: Codel model file loading path is %s\n", Infile_Path);
return Infile_Path;
}
#endif
/* Return information about a vector to the caller */
IMPEXP
@ -1357,6 +1358,7 @@ int ngSpice_UnlockRealloc(void)
return 1;
}
/* add the preliminary breakpoints to the list.
called from dctran.c */
int

View File

@ -30,7 +30,8 @@ CKTop (CKTcircuit *ckt, long int firstmode, long int continuemode,
int converged;
#ifdef HAS_PROGREP
if (!ckt->CKTnoOpIter || ckt->CKTnumGminSteps >= 1 || ckt->CKTnumSrcSteps >= 1)
/* If this is called from dc simulation, don't set "op" */
if (ckt->CKTcurJob->JOBtype != 2 && (!ckt->CKTnoOpIter || ckt->CKTnumGminSteps >= 1 || ckt->CKTnumSrcSteps >= 1))
SetAnalyse("op", 0);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -127,6 +127,7 @@ CKTsetup(CKTcircuit *ckt)
/* Allocate space for the matrix diagonal data */
if(num_nodes > 0) {
FREE(ckt->enh->rshunt_data.diag);
ckt->enh->rshunt_data.diag =
TMALLOC(double *, num_nodes);
}

View File

@ -9,7 +9,8 @@ Copyright 1991 Regents of the University of California. All rights reserved.
#include "ngspice/ifsim.h"
#include "ngspice/sensgen.h"
/* XXX */
/* Used by sensitivity code in cktsens.c */
extern char *Sfilter;
int set_model(sgen *);

View File

@ -14,6 +14,7 @@ Modified: 1999 Paolo Nenzi
#include "ngspice/const.h"
#include "ngspice/sperror.h"
#include "ngspice/fteext.h"
#include "ngspice/compatmode.h"
#ifdef XSPICE
#include "ngspice/evt.h"
@ -297,8 +298,8 @@ DCtrCurv(CKTcircuit *ckt, int restart)
if (ckt->evt->counts.num_insts == 0) {
/* If no event-driven instances, do what SPICE normally does */
#endif
converged = NIiter(ckt, ckt->CKTdcTrcvMaxIter);
if (converged != 0) {
if (newcompat.hs) {
converged = CKTop(ckt,
(ckt->CKTmode & MODEUIC) | MODEDCTRANCURVE | MODEINITJCT,
(ckt->CKTmode & MODEUIC) | MODEDCTRANCURVE | MODEINITFLOAT,
@ -306,6 +307,17 @@ DCtrCurv(CKTcircuit *ckt, int restart)
if (converged != 0)
return(converged);
}
else {
converged = NIiter(ckt, ckt->CKTdcTrcvMaxIter);
if (converged != 0) {
converged = CKTop(ckt,
(ckt->CKTmode & MODEUIC) | MODEDCTRANCURVE | MODEINITJCT,
(ckt->CKTmode & MODEUIC) | MODEDCTRANCURVE | MODEINITFLOAT,
ckt->CKTdcMaxIter);
if (converged != 0)
return(converged);
}
}
#ifdef XSPICE
}
else {

View File

@ -45,6 +45,7 @@ NON-STANDARD FEATURES
#include "ngspice/ngspice.h"
#include "ngspice/cktdefs.h"
#include "ngspice/mif.h"
#include "ngspice/evt.h"
#include "ngspice/evtproto.h"
@ -74,6 +75,12 @@ void EVTcall_hybrids(
/* Call EVTload for all hybrids */
for(i = 0; i < num_hybrids; i++)
for(i = 0; i < num_hybrids; i++) {
EVTload_with_event(ckt, hybrids[i], MIF_STEP_PENDING);
if (g_mif_info.breakpoint.current < ckt->CKTtime) {
/* An XSPICE instance rejected the time-step. */
break;
}
}
}

View File

@ -467,7 +467,7 @@ FILE *fopen_with_path(const char *path, const char *mode)
{
FILE *fp;
if((path[0] != '/') && (path[1] != ':')) { /* path absolue (probably) */
if((path[0] != '/') && (path[1] != ':')) { /* path is (probably) not absolute */
// const char *x = getenv("ngspice_vpath");
const char *x = cm_get_path();
if (x) {

View File

@ -15,7 +15,7 @@
#define PACKAGE "ngspice"
/* Version number of package */
#define VERSION "41+"
#define VERSION "42"
/* Define the directory for executables */
#define NGSPICEBINDIR "../bin"