Commit Graph

500 Commits

Author SHA1 Message Date
rlar 4ec2717079 struct card, #5/6, rewrite from type "card" to "struct card" 2018-02-17 19:15:53 +01:00
rlar 8c7d7051ae GENmodel, GENinstance, change layout, #4/4, complete the change
currently each and every device specific instance and model structure
  duplicates the memory layout of a struct GENmodel / GENinstance

further the first structure elements behind a GENinstance header
  are reinterpreted as a sort of a generic "node" array.

This business is very error prone, and makes it difficult to
  extend struct GENmodel / struct GENinstance.

This patch makes this business much more bearable.
2018-02-17 11:53:06 +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 9ddd1d7d40 fix commit: inp2q.c, #18/23, rewrite, combine two 'for' loop's
which replaced a INPgetNetTok() by INPgetTok()
causing a bug when handling special node names
for example this case
  q1 /c /c 0 npnmodel
2017-07-05 21:09:30 +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 c6896cf338 accept .para shortcut for .param 2017-04-09 15:37:46 +02:00
rlar f12ff5464e inpptree.c, PTdifferentiate(), cleanup, use a #define
to express the expressions arguments more readable
2017-03-19 21:06:49 +01:00
mhx efb8214945 fix spelling, "too much" versus "too many" 2017-03-18 20:49:28 +01:00
rlar 889aaebfd7 inp2m.c, #7/7, whitepace cleanup 2017-03-18 20:44:21 +01:00
rlar 576e522d38 inp2m.c, #6/7, reorder code 2017-03-18 20:44:13 +01:00
rlar 73e76fd88a inp2m.c, #5/7, drop nname[] 2017-03-18 20:44:04 +01:00
rlar 74145c53a6 inp2m.c, #4/7, move code up into the for loop 2017-03-18 20:43:55 +01:00
rlar 5a95487ad7 inp2m.c, #3/7, simpify, move code down into the for loop 2017-03-18 20:43:46 +01:00
rlar 788c8f7067 inp2m.c, #2/7, simplify, move code down into for loop 2017-03-18 20:43:38 +01:00
rlar bef3fd1dd5 inp2m.c, #1/7, insist on a valid model, don't default to something
Emit an error message when unable to identify a valid modelname token.

If a default model is needed, then create one explicitly:
  m1 1 2 3 4 mosdefault
  .model mosdefault mos1()
2017-03-18 20:43:19 +01:00
rlar 80ef8b308d inp2m.c, do not restrict binning to four nodes
until now, for unknown reasons,
  the search for binned modelnames was restricted to
  instances with less than five nodes.
2017-03-18 20:18:11 +01:00
rlar 50c0424225 inp2q.c, inp2m.c, plug a memory leak 2017-03-18 20:15:39 +01:00
rlar 3ea412e7cd bug fix for commit "inp2q.c, #17/23, rewrite, using a 'for' loop" 2017-03-12 17:57:27 +01:00
rlar ba6955a1aa inp2q.c, sanitise optional ports processing
Tie ports 4 and up to ground, iff not connected.

Actually, I think the model's DEVsetup routine should do this business,
  we should pass -1 to denote the fact of being unconnected
2017-03-11 21:11:32 +01:00
rlar 3ce3424a9c inp2q.c, #23/23, whitespace 2017-03-11 20:27:48 +01:00
rlar 9ad1a3033b inp2q.c, #22/23, drop #ifdef, model_numnodes() does care about this 2017-03-11 20:27:48 +01:00
rlar ac77e5b020 inp2q.c, #21/23, drop nname[] and model, use local 'token' instead 2017-03-11 20:27:47 +01:00
rlar 25fa9a4454 inp2q.c, #20/23, insist on a valid model, don't default to something
If a default model is needed, then create one explicitly:
 q1 1 2 3 npndefault
 .model npndefault npn()

Note:
  This code was buggy anyway because the last token,
    which turned out not to be a valid model name,
    was silently swallowed.
  Thus PARSECALL() didn't parse the whole thing.
2017-03-11 20:27:47 +01:00
rlar b85a07c62c inp2q.c, #19/23, rewrite, move code into the 'for' loop 2017-03-11 20:27:47 +01:00
rlar b1ccdd2184 inp2q.c, #18/23, rewrite, combine two 'for' loop's 2017-03-11 20:27:47 +01:00
rlar 807115c145 inp2q.c, #17/23, rewrite, using a 'for' loop 2017-03-11 20:27:47 +01:00
rlar 03d3e2ea12 inp2q.c, #16/23, emit a message and give up, if we couldn't find the modelname token
Thats a functional change of ngspice.

So far we did cook up a "default" model when we didn't find a model token.
But this was buggy anyway, because in such cases we silently dropped
  a token from beeing processed by PARSECALL()
Now, we emit a message, and skip this line alltogether.
2017-03-11 20:27:47 +01:00
rlar 83fb9353ef inp2q.c, #15/23, rewrite, fall into an empty 'else' body when !ADMS 2017-03-11 20:27:47 +01:00
rlar 0bf0021a63 inp2q.c, #14/23, rewrite, assign model a bit later when recognised 2017-03-11 20:27:47 +01:00
rlar ef37e92338 inp2q.c, #13/23, move code down 2017-03-11 20:27:47 +01:00
rlar d2d9bffed0 inp2q.c, #12/23, move code down
Note; here i==4 and nodeflag still was 4
2017-03-11 20:27:46 +01:00
rlar c8b1d18289 inp2q.c, #11/23, move code down
Note: here i==3 and nodeflag==4
2017-03-11 20:27:46 +01:00
rlar c5ce68728f inp2q.c, #10/23, use i to prepare for a loop 2017-03-11 20:27:46 +01:00
rlar a21a2fd1b0 inp2q.c, #9/23, drop some TRACE code 2017-03-11 20:27:46 +01:00
rlar 16c00730e4 inp2q.c, #8/23, use a 'for' loop
Note: the range of nodeflag still is {4,5}
2017-03-11 20:27:46 +01:00