Commit Graph

5318 Commits

Author SHA1 Message Date
rlar b2621174d3 inpgmod.c, plug a memory hole
Reported and fixed by Marek Bielik in message:
  Subject: [Ngspice-devel] Memory leaks fix
  Date: Tue, 18 Apr 2017 16:16:21 +0000
2017-06-24 17:49:07 +02:00
h_vogt 7489a37973 inpgval.c, inpdpar.c, beautify the code 2017-06-06 17:05:22 +02:00
h_vogt fa6e21dd3a inpgval.c, INPgetValue(), use INPgetNetTok() instead of INPgetTok()
To fix a bug reported by Clyde Shappee in
  Subject: Problem with pole zero analysis and net names
  https://sourceforge.net/p/ngspice/discussion/127605/thread/14338e7e/

When using node names with a leading slash '/'
  on the "pz" analysis command line.
2017-06-06 16:51:32 +02:00
rlar a6a3d884ee fix commit "mifsetup.c, MIFunsetup(), #1/3 delete broken code"
which silently dropped the
  here->initialized = MIF_FALSE
aspect of the MIFunsetup() function

which caused segfault in testcase
  examples/memristor/memristor_x.sp
2017-06-06 16:42:32 +02:00
Tim Edwards 6ac19b03a3 examples/xspice/d_lut/mult4bit.spi, example for d_lut and d_genlut 2017-05-01 22:11:50 +02:00
Tim Edwards fd79197fc0 xspice/icm/digital, introduce d_genlut
a digital n-input x m-output look-up table gate
2017-05-01 22:11:24 +02:00
Tim Edwards 8ae3b84c7c xspice/icm/digital, introduce d_lut
a digital n-input look-up table gate
2017-05-01 22:11:04 +02:00
h_vogt 30aa5ec0b7 examples/xspice/table, examples for the table2d and table3d code models 2017-04-30 17:01:07 +02:00
h_vogt 37fe5308d3 xspice/icm/table, introduce table2d/table3d
which allows to model devices based upon linear interpolation
2017-04-30 17:00:15 +02:00
rlar 869c598589 Makefile.am, update EXTRA_DIST 2017-04-30 16:33:37 +02:00
rlar 6f7b68945d tests/regression/sens, fix test cases
which have been invalidated by commit:
ifparm, #4/16, missing IF_REDUNDANT for some aliases, introduce IOPAPR

before this commit, sensitivity to "capacitance" was published twice,
  once with name "c1"  (reference name of a CAP device)
  and as "c1_c" (reference name of a CAP concatenated with param name "c")
after said commit, sensitivity is no longer published as "c1_c"
  (because "c" is only an "alias"/IF_REDUNDANT of the main parameter
   which is named "capacitance", and "capacitance" is a IF_PRINCIPAL
   and thus avoids "concatenation" of the parameter name)
2017-04-21 18:52:43 +02:00
rlar a7cc37b2e2 ifparm, fix numdev too 2017-04-19 19:18:13 +02:00
h_vogt cc8fb86411 diotemp.c, set lower limit of saturation current 'is' to epsmin 2017-04-19 18:57:20 +02:00
h_vogt c82ee9d949 introduce option "epsmin"
To define a minimum argument for some log() function invocations.
(most notably for the diode saturation current 'is')
2017-04-19 18:56:00 +02:00
dwarning 78cc48575b prevent warnings for double declared variables 2017-04-17 20:53:30 +02:00
rlar 2f329bd8b4 N_MXVLNTH, drop noise variable name limitation 2017-04-15 17:21:24 +02:00
h_vogt 306ada7dd0 inpcom.c, get_model_type(), use gettok_noparens() to extract model type
Takes care of model descriptions in parentheses like
  d(...)
2017-04-12 22:00:07 +02:00
h_vogt 1ffb957e6c inpcom.c, inp_fix_subckt_multiplier(), cleanup, using strchr() 2017-04-12 21:48:13 +02:00
rlar 2f1219811e src/spicelib/devices/*/*set.c, XXXunsetup(), reset local node variables unconditionally
and use a more robust test for local node numbers.

That is, transform this pattern :
  if (here->Node && ...) {
     CKTdltNNum(ckt, here->Node);
     here->Node = 0;
  }
into this :
  if (here->Node > 0 && ...)
     CKTdltNNum(ckt, here->Node);
  here->Node = 0;

The change of "!= 0" ==> "> 0" accounts for rare cases where "Node"
   might have been set to -1, (meaning "unconnected")
The unconditional execution of the zero assignment is for those cases
  where "Node" might have been assigned to some external or other local Node.
If so, the variable would not be set to zero, confusing the "guarding" if's
  in the corresponding XXXsetup() routine.

The Pattern to follow is:
  1) unset and delete *all* local Nodes in XXXunsetup()
  2) allocate all of them again in a re-invocation of XXXsetup(),
       exactly the same way as in the very first invocation.
2017-04-12 21:34:05 +02:00
rlar 00c743c37d src/spicelib/devices/*/*def*.h, declare external node variables const
for almost all other external nodes (notable exception "txl")
src/spicelib/devices/*/*def*.h, declare external node variables const

1) The compiler shall emit an error message if we still mess around
     with external node numbers.
2) To mark which elements of the instance struct are meant to be set
     externally when parsing the netlist

These "external" node variables are exclusively set via the
  overlay struct GENinstance, member GENnode[]

We shall not mess around with these "external" node variables
  because it would get rather difficult to avoid bugs considering
  re-invocation of the XXXsetup() routine.
This gets interesting for devices with optional ports,
  which get copied around depending on the amount of connected ports.
2017-04-12 21:34:02 +02:00
rlar 0e9576cb34 src/spicelib/devices/*/*set.c, missing CKTdltNNum() invocations, complex cases
All locally created nodes (CKTmk..() invocations in XXXsetup())
  must be deleted in XXXunsetup()

Otherwise CKTmk..() invocations during a following CKTsetup()
  will re-emit still used node numbers,
  thus accidentally shorting nodes.

This patch fixes the complex cases,
  which are external node variables (ports of the instance),
  which might be moved over to other external node variables
  to cope with optional port connections.
This is fixed by copying the node numbers to local shadow variables
  to avoid messing with the external nodes.
Otherwise a following CKTsetup() might again meddle with the external
  node variables, at least causing considerable confusion, probably causing
  hard to find bugs.
2017-04-12 21:34:00 +02:00
rlar c0921250b7 src/spicelib/devices/*/*set.c, missing CKTdltNNum() invocations, medium cases
All locally created nodes (CKTmk..() invocations in XXXsetup())
  must be deleted in XXXunsetup()

Otherwise CKTmk..() invocations during a following CKTsetup()
  will re-emit still used node numbers,
  thus accidentally shorting nodes.

This patch fixes a little bit more complex cases,
  which are local node variables which will start with value 0
  and eventually be set with the result of a CKTmk..() invocations,
  but might as well receive a node number from another node variable.
Here CKTdltNNum() must not be invoked if the node number is merely
  a copy from another node variable.
2017-04-12 21:33:59 +02:00
rlar 1fd14fa2ee src/spicelib/devices/*/*set.c, missing CKTdltNNum() invocations, simple cases
All locally created nodes (CKTmk..() invocations in XXXsetup())
  must be deleted in XXXunsetup()

Otherwise CKTmk..() invocations during a following CKTsetup()
  will re-emit still used node numbers,
  thus accidentally shorting nodes.

This patch fixes the simple cases,
  which are local node variables which will start with value 0
  and eventually be set with the result of a CKTmk..() invocation.
More complex cases evolve, if such a local variable might receive
  a node number which origins from another node, or the netlist itself.
2017-04-12 21:33:58 +02:00
rlar 0c86adf9af src/spicelib/devices/*/*set.c, XXXunsetup(), sort CKTdltNNum() invocations
Invoke CKTdltNNum() in reverse order of local node creation in XXXsetup()

This fixes a bug at least in mesa and hfet1,
  where already destroyed node variables have still been accessed
  in the guarding 'if' of a later CKTdltNNum() stanza.
Invoking them in revers order easily prevents such bugs,
  and improves readability.
2017-04-12 21:33:50 +02:00
rlar 7afb798a6f check for illegal DEVsetup() DEVunsetup() patterns.
Consider the following silent contracts:
1)
 CKTsetup() invocations must be separated by a CKTunsetup() invocation
 But CKTsetup() has an internal flag,
   which will prevent re-invocation of DEVsetup()
 But DEVsetup() will be called during sensitivity analysis,
   bypassing this precaution. It is fatal if this will
   cause another node allocation (CKTmk..()).
   This commit tries to detect such cases.
   (Note: many DEVsetup routines (all ?) have their CKTmk..() invocations
      guarded to avoid reallocation of local nodes,
      see commit f7f454c0a1
        bug fix, fix the guard for device generated internal nodes (via CKTmkVolt())
   )
   FIXME:
     DEVsetup() is seriously obfuscated by these guards.
     If would be far better, if the sensitivity analysis
       wouldn't sidestep into DEVsetup()
     consider a device local variant of the CKTisSetup flag
2)
 DEVunsetup() must delete all, each and every,
   local allocated node in DEVsetup()
 Otherwise CKTmk..() invocations in a following CKTsetup() will
   return duplicate node numbers, effectively shorting device nodes.
 This commit tries to detect incomplete CKTdltNNum() invocations.
3)
  DEVunsetup() must not delete a netlist node.
  This can easily happen in those devices which have optional ports,
    which have code in DEVsetup() which copies node numbers to
    local node variables.
  This commit tries to detect such errors.
2017-04-12 21:32:51 +02:00
h_vogt 69b235531e sharedspice.c, introduce csh variable "sharedmode"
to reflect whether running as shared library
2017-04-12 21:22:22 +02:00
h_vogt 0bf381e01d cpitf.c, for Windows, introduce csh variable "win_console"
to reflect whether this .exe is a "console" build
2017-04-12 21:11:13 +02:00
h_vogt 670880086f cpitf.c, MS Visual Studio, introduce csh variable "pg_config"
reflecting .exe compilation for
  32/64 bit
  with/without NGDEBUG
2017-04-12 21:01:57 +02:00
h_vogt d7a1899210 runcoms.c, rawfile.c, include filename in the 'ASCII/binary raw file' printout 2017-04-12 20:45:51 +02:00
rlar 926ba4baaf xspice/icm/analog/file_source/cfunc.mod, use CALLBACK
to free() locally allocated memory and fclose() a local filestream
2017-04-12 20:14:47 +02:00
rlar 58874cc65e xspice, implement "CALLBACK"
Allow to register a callback function in the cfunc.mod files,
  which will be invoked in MIFdestroy.
Usefull to "free" memory which has been allocated locally in a cfunc.mod file.
2017-04-12 20:02:35 +02:00
mhx 5f0f54761a xspice, analog/file_source, bug fix
The source code did not consider the possibility
  of more than one "tran" analysis invocations.

see "Bewildering problem with filesource block while sweeping"
https://sourceforge.net/p/ngspice/discussion/133842/thread/52949e23/
2017-04-12 20:01:14 +02:00
rlar 4872580221 mifsetup.c, MIFunsetup(), #3/3 now invoke CKTdltNNum() 2017-04-12 18:41:07 +02:00
rlar 9154f83c37 mifsetup.c, MIFunsetup(), #2/3 copy paste from MIFsetup() 2017-04-12 18:38:26 +02:00
rlar c68a0313bd mifsetup.c, MIFunsetup(), #1/3 delete broken code 2017-04-12 18:38:25 +02:00
dwarning 48262e5c0a extend safe operation area check (SOA) to polarity check for mosfets by additional parameters 2017-04-11 21:31:54 +02:00
rlar 46ab21dca9 inpcom.c, is_a_modelname(), don't accept "1E2" 2017-04-09 20:19:35 +02:00
h_vogt 847a09fd37 inpcom.c, get_number_terminals(), ignore "save" and "print" when CIDER 2017-04-09 18:33:12 +02:00
h_vogt e5d70d0821 gnuplot.c, bug fix, allow gnuplot with MINGW 2017-04-09 17:53:40 +02:00
rlar ccfcc056ad inpcom.c, bug fix, allow leading '_' in parameter identifiers 2017-04-09 15:38:15 +02:00
rlar c6896cf338 accept .para shortcut for .param 2017-04-09 15:37:46 +02:00
rlar 900bed550d string.c, #6/6, use skip_ws() and skip_back_ws() 2017-04-09 15:35:44 +02:00
rlar 0da47c644b string.c, #5/6, cleanup 2017-04-09 15:35:41 +02:00
rlar 5b23b54769 string.c, #4/6, cleanup token fetching 2017-04-09 15:35:38 +02:00
rlar c6a3438408 string.c, #3/6, cleanup 'return' 2017-04-09 15:35:35 +02:00
rlar ed13e8a15a string.c, #2/7, drop 'register' 2017-04-09 15:35:32 +02:00
rlar d48bec757c string.c, #1/6, whitespace 2017-04-09 15:35:29 +02:00
rlar fb1c6fc123 ifparm, #16/16, isrc.c, non grouped alias entry, change "c" from IP to IOPPR 2017-04-09 15:29:44 +02:00
rlar 762314b893 ifparm, #15/16, ind.c, missing IF_AC|IF_PRINCIPAL in alias entry, use IOPAPR 2017-04-09 15:29:43 +02:00
rlar d32a32bdc8 ifparm, #14/16, res.c, missing IF_ORQUERY|IF_REDUNDANT, introduce IOPQOR 2017-04-09 15:29:42 +02:00