Commit Graph

4438 Commits

Author SHA1 Message Date
rlar c25aea6815 GENmodel, GENinstance, change layout, #2/4, complete the change
fix the .xml files too
2018-02-17 11:53:03 +01:00
rlar 2dcb79d09c GENmodel, GENinstance, change layout, #1/4, coccinelle semantic patch 2018-02-17 11:53:01 +01:00
rlar 4748c92de9 DEVdestroy(), change API, #2/2, complete the change, inclusive CKTdestroy()
loop over DEVmodDelete() and DEVdelete() in CKTdestroy()
  instead of doing this business in the DEVdestroy() functions.

As a consequence, most DEVdestroy() functions
  collapse completely.
2018-02-17 11:52:59 +01:00
rlar 1befa488f6 DEVdestroy(), change API, #1/2, coccinelle semantic patch 2018-02-17 11:52:58 +01:00
rlar b29ad51a6c DEVdestroy(), move code over to DEVmodDelete() and DEVdelete()
This patch itself is not valid until all invokers of DEVdestroy()
  (currently this is CKTdestroy() exclusively)
  are rewritten to invoke DEVmodDelete() and DEVdelete()
2018-02-17 11:52:55 +01:00
rlar 3cd81295a8 DEVmodDelete(), change API, #2/2, complete the change
Instead of searching and then deleting a given device-model,
  just delete the given model.

The search shall be done somewhere else.

Don't free the model struct itself,
  this shall be done by the invoker himself.

Don't free the device instrance list,
  this shall be done by the invoker himself.

As a consequence, most DEVmodDelete() functions
  collapse almost completely.

This change is of no consequence,
  because DEVmodDelete() is currently nowhere used.
2018-02-17 11:52:53 +01:00
rlar b17ee71576 DEVmodDelete(), change API, #1/2, coccinelle semantic patch 2018-02-17 11:52:51 +01:00
rlar 50e9a8c3b6 DEVmodDelete(), extend ASRCdelete() and use it in ASRCmDelete()
rip instance specific cleanup business from the ASRCmDelete() function.
move this to ASRCdelete()
2018-02-17 11:52:49 +01:00
rlar c3ed42f486 DEVdelete(), change API, #2/2, complete the change
Instead of searching and then deleting a given device-instance,
  just delete the given instance.

The search shall be done somewhere else.

Don't free the instance struct itself,
  this shall be done by the invoker.

As a consequence most DEVdelete() functions
  collapse almost completely.

This change is of no consequence,
  because DEVdelete() is currently nowhere used.
2018-02-17 11:52:46 +01:00
rlar e0f1e5a3de DEVdelete(), change API, #1/2, coccinelle semantic patch 2018-02-17 11:52:44 +01:00
rlar a8e440eabe whitespace cleanup, comments cleanup, line wrap 2018-02-14 18:53:30 +01:00
rlar ec4b7ffecd adms/admst/ngspiceMODULE*.c.xml, drop "register" declaration 2018-02-12 17:56:00 +01:00
rlar 57f9804db6 devices/adms/admst/ngspiceMODULEdel.c.xml, bug fix, endless loop
A missing update of "prev" would cause endless looping
  when searching for a device instance.

introduced in commit:
> commit 38e68869a2
> Date:   Wed Mar 1 14:30:24 2006 +0000
>
>     Added mdel, del and dest functions to interface.
2018-02-12 17:55:59 +01:00
rlar cd95ad62f2 devices/ndev/ndevdel.c, remove a redundant `return' 2018-02-12 17:55:58 +01:00
rlar efbb7badbc extend commit: spicelib/devcies/*dest.c, rewrite DEVdestroy() functions
rewrite admst/ngspiceMODULEdest.c.xml too, see commit

> commit 4d79617cf1
> Date:   Fri Jul 29 22:22:16 2016 +0200
>
>     spicelib/devcies/*dest.c, rewrite DEVdestroy() functions
2018-02-12 17:55:57 +01:00
rlar 88c50afcd9 parser/inpdpar.c, #6/6, cleanup, introduce find_instance_parameter() 2018-02-03 17:54:15 +01:00
rlar cf0c9eac06 parser/inpdpar.c, #5/6, cleanup, use a local `IFparm *' 2018-02-03 17:54:06 +01:00
rlar f88cfa5d55 parser/inpdpar.c, #4/6, cleanup, use a local `IFdevice *' 2018-02-03 17:53:57 +01:00
rlar 36f3263727 parser/inpdpar.c, #3/6, cleanup, whitespace 2018-02-03 17:53:48 +01:00
rlar 4140af6d29 parser/inpdpar.c, #2/6, cleanup, use a 'switch' 2018-02-03 17:53:38 +01:00
rlar eb86a66146 parser/inpdpar.c, #1/6, cleanup, search, break then process 2018-02-03 17:53:28 +01:00
rlar bdf6091da7 parser/inpgmod.c, #6/6, cleanup, introduce find_model_parameter() 2018-02-03 17:29:33 +01:00
rlar 45e98db44c parser/inpgmod.c, #5/6, cleanup, loop with a `IFparm *' 2018-02-03 17:29:32 +01:00
rlar b75aba17a4 parser/inpgmod.c, #4/6, cleanup, use a local `IFdevice *' 2018-02-03 17:29:32 +01:00
rlar 63df147cdb parser/inpgmod.c, #3/6, cleanup, local variables 2018-02-03 17:29:32 +01:00
rlar ac34d19c94 parser/inpgmod.c, #2/6, cleanup, fuse the if's 2018-02-03 17:29:32 +01:00
rlar edceabbb54 parser/inpgmod.c, #1/6, cleanup, search, break then process 2018-02-03 17:29:30 +01:00
rlar 6c71fef6f6 parser/inpgmod.c, create_model(), drop obfuscated 'txl' processing
Dependent on given R and L parameter values,
  "txl" models might be transformed to "cpl" models in INPdomodel().
This would cause a "unrecognized parameter" warning in create_model()
  when searching for the "txl" flag in the "cpl" model,
  which is avoided with some awkward extra processing in inpgmod.c

This commit removes this special processing
  by addition of an "alias" parameter "txl" to the
  "cpl" module parameter description CPLmPTable[] in "cpl.c"

Note,
  setModelParm() is a no-op for "cpl" and "txl"
  see case CPL_MOD_R in
    function CPLmParam()
  and case TXL_MOD_R in
    function TXLmParam()
2018-02-03 15:55:22 +01:00
rlar aa27c8969c parser/inpgmod.c, fix an almost bug, (level=...)
When 'level' is a valid model parameter,
  then it was processed like any other parameter,
but additionally the
  `if (strcmp(parm, "level") == 0)'
invoked INPgetValue() a second time.

This special processing is meant to allow "level" for all models
  whether they make use of it or not.

The excess invocation of INPgetValue() didn't cause harm,
  merely because the next token after the "level=number"
almost necessarily is a string (the beginning "name=" of the next assignment)
thus not a parse-able number,
thus the second INPgetValue() didn't modify the 'line' pointer.

To sanitise the code invoke the "level" skipping only if "level"
  is not recognised as a valid model parameter.
2018-02-03 15:39:20 +01:00
rlar 668123ae44 analysis/cktpname.c, #4/4, cleanup 2018-02-03 13:17:17 +01:00
rlar 30550370fb analysis/cktpname.c, #3/4, cleanup obfuscated loop termination 2018-02-03 13:16:40 +01:00
rlar d85ceb85cb analysis/cktpname.c, #2/4, cleanup, use a local `IFparm *' 2018-02-03 13:16:12 +01:00
rlar 1d60387617 analysis/cktpname.c, #1/4, cleanup, use a local `IFdevice *' 2018-02-03 13:16:01 +01:00
rlar fbc1f37b36 mif/mifdelete.c, fix commit: xspice, implement "CALLBACK"
MIFdelete() might be called with third arg being NULL,
  searching for the instance to be deleted by name only.
Need to invoke the callback in this case too.
2018-02-03 12:20:23 +01:00
rlar e311096429 gendef.h, get rid of awkward counted GENnode macros 2018-02-03 11:46:24 +01:00
rlar 018a2d0e2f devices/*, unify, add missing instance struct member 'GENstate'
to the generic part of all instance structs, even when actually unused.
see GENstate in "gendefs.h"
2018-02-03 11:46:24 +01:00
rlar 9f68d8cd68 devices/*, fix spelling of some struct members 2018-02-03 09:46:13 +01:00
rlar f53384da70 devices/*, USE_OMP, cleanup 'InstanceArray' usage
store 'InstanceArray' in the very first module only,
  NULL it in any other.

FREE() it in every module to treat them all the same in XXXdestroy()
2018-02-02 23:03:55 +01:00
rlar 93b62297d8 devices/mos6, add missing files mos6del.c and mos6mdel.c
this is a plain copy from mos3
2018-02-02 22:53:43 +01:00
rlar fb6b4adaa5 devices/bsimsoi/b4soidest.c, fix commit: "OpenMP for B4SOI version 4.3.1"
> commit 39c98ad798
> Date:   Fri Jul 2 09:35:05 2010 +0000
>
>     OpenMP for B4SOI version 4.3.1
2018-02-02 22:35:59 +01:00
rlar 3763f9914e devices/nbjt/nbjtdefs.h, fix commit: "mark end of struct GENmodel overlay"
> commit 3794c1eb20
> Date:   Sat Jun 22 18:40:48 2013 +0200
>
>     mark end of struct GENmodel overlay
2018-02-02 22:24:10 +01:00
rlar caf3115733 cleanup, emphasise CKTrhs being an array
when accessing slot [0]
2018-01-29 19:51:13 +01:00
Holger Vogt 560cb6e970 plotting/grid.c, bug fix, avoid string buffer overflow
Prevent a crash of example/FFT_test.cir.
Buffer 'buf' in function drawlingrid() has been too small.
Increase 'buf' size, and add some protection.

The example file examples/plot/test-small-plot.cir
shows the limits of plotting:
  difference in two numbers at digit 14 is plotted well.
                            at digit 15 is plotted with bugs.
                            at digit 16 is reduced to integer.

consider compiling with
  -O1 -D_FORTIFY_SOURCE=2
for gcc, and
  /GS
for visual studio.
2018-01-27 21:58:15 +01:00
rlar c892b2d460 analysis/acan.c, check for valid startfreq
an 'ac dec' or 'ac oct' can not have a startfreq <= 0
2018-01-20 10:55:26 +01:00
rlar c5d8ad792e analysis/acsetp.c, ac analysis, allow frequency=0 2018-01-15 19:04:52 +01:00
rlar 57a0a5dec0 devices/bjt/bjttemp.c, bug fix, capacity temperature dependency
Fix a very old bug in the implementation of the
  gummel-poon model formulas for the junction capacities.
  (already in spice3f4)
For unknown reasons, the same formulas in the
  diode mos1 mos2 mos6 jfet models
have been implemented correctly right from the beginning,
the typo was bjt specific.

Many Thanks for the concise and precise Bug Report
  provided by Schabo Rumanus on the ngspice-users mailing list
> To: ngspice-users@lists.sourceforge.net
> Subject: [Ngspice-users] Temperatursimulation von Sperrschichtkapazitäten

Many Thanks to Dietmar Warning for his thorough verification
  of this commit.
2017-12-20 18:02:13 +01:00
rlar f0159cbd0b numparam/spicenum.c, stripbraces(), bug fix
overwriting SPICE_DSTRING `dstr_p' may invalidate `s'

This bug was injected with the introduction of SPICE_DSTRING in :
> commit 76feebbbfa
> Date:   Thu Feb 25 21:43:03 2010 +0000
>     various bug fixes
2017-11-13 20:36:49 +01:00
rlar 84761c125f fix erfc() usage in cider
cider relied on our broken ngspice variant of erfc() which behaved as
  erfc_ngspice(x) = erfc(fabs(x))

Note:
  apart from cider, erfc is used in
    devices/ltra/ltramisc.c
      always with positive argument
  and
    src/frontend/spec.c
      again always with positive argument
Thus, the difference in implementation
 never mathered anywhere except in cider
2017-10-28 12:38:36 +02:00
rlar c900cc8824 drop ngspice internal implementation of erfc()
which these days is guaranteed to be provided by <math.h>

note,
  our own implementation was incorrect anyway.
  it evaluated to
    erfc_ngspice(x) = erfc(fabs(x))
2017-10-28 12:38:32 +02:00
rlar ca57447f6c fix commit "devices/bsim3v32: apply Area Calculation Method (ACM) to the bsim3v3.2.4 model"
which moved processing of several parameters into a new function
  ACM_SourceDrainResistances()
but did so incompletely.

As a consequence the matrix footprint was not correctly modified
 when source or drainresistance is zero

Thanks for the bug report by "Sto" in message
>  bug: mosfet models with deliberate NRD=0 (ngspice-27)
https://sourceforge.net/p/ngspice/discussion/133842/thread/fa39228d
2017-10-21 20:22:43 +02:00