Commit Graph

5283 Commits

Author SHA1 Message Date
rlar a51c1aba2c inpcom.c, inp_read(), #2/2, rewrite xx_new_line() insertion
using the fact
  end->li_next === NULL
2017-06-24 22:03:03 +02:00
rlar 5c3dac41d9 inpcom.c, inp_read(), #1/2, rewrite 'append' to 'end' 2017-06-24 22:01:03 +02:00
rlar ed39305da0 inpcom.c, inp_add_series_resistor(), simplify xx_new_line() insertion 2017-06-24 20:30:04 +02:00
rlar 9eddd1d80f inpcom.c, inp_add_control_section(), #2/2, rewrite xx_new_line() insertion 2017-06-24 20:15:02 +02:00
rlar 4ad53f0de8 inpcom.c, inp_add_control_section(), #1/2, emphasise two assertions 2017-06-24 20:12:55 +02:00
rlar 4ff9c0c166 inpcom.c, inp_chk_for_multi_in_vcvs(), #6/6, drop 'model_card' 2017-06-24 19:44:35 +02:00
rlar d773b73f76 inpcom.c, inp_chk_for_multi_in_vcvs(), #5/6, drop 'next_card', deploy its value temporarily in the new line's li_next slot 2017-06-24 19:44:11 +02:00
rlar 3b55d2af40 inpcom.c, inp_chk_for_multi_in_vcvs(), #4/6, drop 'a_card', reuse the unused 'c' instead 2017-06-24 19:43:34 +02:00
rlar 634b012492 inpcom.c, inp_chk_for_multi_in_vcvs(), #3/6, xx_new_line() shall fill the li_next slot 2017-06-24 19:40:48 +02:00
rlar e9e9e5d55e inpcom.c, inp_chk_for_multi_in_vcvs(), #2/6, move code downwards 2017-06-24 19:40:38 +02:00
rlar c83b0544de inpcom.c, inp_chk_for_multi_in_vcvs(), #1/6, skip lines 2017-06-24 19:40:27 +02:00
rlar e81560de1a inpcom.c, drop the local 'new_line' variable 2017-06-24 19:11:22 +02:00
rlar b21b4170b2 inpcom.c, simplify the insertion of new lines/decks quite a bit 2017-06-24 19:11:21 +02:00
rlar 2972953336 inpcom.c, reorder initialisation
initialise param_beg and param_end before they will be used,
  instead of "afterwards" in preparation for the next following usage.
and move the "comment out" up some lines, think that way:
  comment out original line, append new line, ...
2017-06-24 18:16:48 +02:00
h_vogt 5d82d1b04a misccoms.c, com_quit(), don't free memory, unless shared ngspice
Traversing all linked memory structures to free their memory
  can be a somewhat lengthy business, especially in xspice,
  which is not worth the effort when we simply want to exit()
Long delays have been reported in certain cases.

For developers and for the usage of such tools as valgrind,
  we still free all the memory if 'set ngdebug' is given.
2017-06-24 17:55:26 +02:00
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