Commit Graph

6867 Commits

Author SHA1 Message Date
Holger Vogt c8ed9590b7 Handle the case when control voltages on and off are equal.
Update the linear switch: add the limits to resistance ron, roff
Update the log switch: correct the resistance calculation for
von < voff
Add some examples for the pswitch.
2022-10-07 13:12:56 +02:00
Holger Vogt b94ef139dd Avoid an endless loop: Safeguard function
search_plain_identifier(char *str, const char *identifier)
against identifiers being an empty string.
2022-10-07 13:12:30 +02:00
Holger Vogt 5b0b328186 If a node name to be plotted ends by ':power', its type is set to POWER.
Thus 'settype power nodename(s)' in the examples is no longer necessary.
2022-10-07 13:12:04 +02:00
Holger Vogt fc0bf595f2 Update to .probe command:
If no .save or save command given by the user, add '.save all' internally.
To do so, check for .save or save.
Update to the .probe p command (power measurement)
Add probe_int_ to internal nodes and instance names, where appropriate.
These nodes will be disregarded when setting up the plot structure.
2022-10-07 13:11:42 +02:00
Holger Vogt 3da97fa277 Handle .if ... .else ... .endif before .csparam is executed,
thus allowing parameter entry to .control section being dependent
on .if
2022-10-07 13:10:31 +02:00
Giles Atkinson 8038021369 Remove some dead code in the dec_bridge code model. 2022-10-07 13:09:36 +02:00
Giles Atkinson 88d5e723ed Fix double free in XSPICE CALLBACK functions as desribed here:
https://sourceforge.net/p/ngspice/mailman/message/37677362/
and add missing CALLBACKs in models that use STATIC_VARs with
pointer values.
2022-10-07 13:09:15 +02:00
Giles Atkinson 10d3e1b754 Extend the output and partial derivatives of the output from the 2/3-D
table lookup models (XSPICE) continuously outside the defined
rectangle or cube, as it may help convergence and avoid ambiguity caused
by rounding at the boundaries.  See bug #591 "Wrong 2D table model output".
The value is that of the nearest point in the region while the reported
derivative is ramped to zero outside the boundaries.
Also fixes incorrect output at the upper limit in each dimension.
2022-10-07 13:09:00 +02:00
Giles Atkinson 8ef2d8dec8 Fix memory leak by moving the state transition table to a STATIC_VAR
whose memory can be recovered by a call back.  Also make cfunc.mod
less ugly.
2022-10-07 13:08:42 +02:00
Holger Vogt 0e885bc3a9 Function guess_type may yield the wrong type, because
it does not cover all of the the many, many options possible.
This commit fixes bug597, where [current] was interpreted as
capacitance.
2022-10-07 13:06:29 +02:00
Holger Vogt 7f65a68ad6 Improve (a little) the plotting of digital data with plot option digiplot:
Repair scaling on MS Windows:
Suppress y axis lettering and unit:
Allow or dis-allow grid.
2022-10-07 13:05:56 +02:00
Holger Vogt 9e290a3461 tabs to spaces 2022-10-07 13:05:30 +02:00
Holger Vogt 8a097c020e Make error message more verbose: Instead of only "no such parameter on this device",
give name of bad parameter and respective line in netlist.
2022-10-07 13:05:10 +02:00
Holger Vogt 73ee9e452d Prevent crash when ca or d are not defined. May happen when
.endc is missing.
2022-10-07 13:04:50 +02:00
Holger Vogt b9014068e7 WinGUI: Add a button 'Stop' to stop a simulation in intercative
or control mode. ngspice enters interactive mode and waits for user
commands. Simulation result vectors are available up to the
(time) point of stopping. Simulation may continue by command
'resume', however now in interactive mode, a control flow stays
interrupted.
2022-10-07 13:04:25 +02:00
Holger Vogt d1cbcb080c Re-format cktdojob.c 2022-10-07 13:03:35 +02:00
Holger Vogt 9e1eac0613 Correct comment: Command circbyline is not involved,
we are sending the netlist as an array.
2022-10-07 13:03:18 +02:00
Holger Vogt a597c6a295 Suppress I/O redirection for command 'circbyline'.
This enables sending commands like
circbyline btest testnode 0 v=((v(in1) - v(in2)) < 0.1 ? 0.111 : v(in1))
2022-10-07 13:02:39 +02:00
Holger Vogt f073fb5c05 Consecutive tran and ac simulation may lead to gross errors
when TC or scale is used on the instance line of C and L.
Reason is the missing reset when CKTtemp is called once during each
simulation command. TC or scale is then applied again and again,
a reset is missing.

This patch adds a reset, i.e. the capacitance or inductance is
reset to its instance value in a call to *temp. It fixes bug#594.

Command 'alter' has been tested.

Resistance has not been tackled by this bug, because the line
here->RESconduct = here->RESm / (here->RESresist * factor * here->RESscale);
differs from
here->CAPcapac = here->CAPcapac * factor * here->CAPscale;
in that there is no accumulation of correction factors with here->RESconduct
2022-10-07 13:02:12 +02:00
Holger Vogt c26e4c990a Move evaluation of statistical functions inside of a B source
to after numparam expansion, thus allow parameters in functions agauss etc.

Replace gettok by new gettok_np to ignore characters ( ) ,
which may be left over after parameter expansion.

This fixes bug 593.
2022-10-07 13:01:33 +02:00
Holger Vogt ab6e273a5e Remove inner couple {...} from {{...}} only when instance is not
a behavioral source which will be translated to a B source.
2022-10-07 13:01:07 +02:00
Holger Vogt 1329942865 Add a new function char* gettok_np(char** s)
which finds a token, while scanning over (), like
they were white spaces. It also proceeds with s while
still finding (), (which gettok_noparens does not do).
2022-10-07 13:00:44 +02:00
Holger Vogt d46b4030fb Avoid jump in phase when crossing 90° boundaries.
Code similar to cx_cph in cmath1.c
2022-10-07 13:00:02 +02:00
Brian Taylor b6db33f472 There needs to be 2 variants of d0_gff. One for d_dlatch, the other for d_srlatch. 2022-10-07 12:56:37 +02:00
Brian Taylor a8f103eebc Clean out dead code in model processing. 2022-10-07 12:56:14 +02:00
Brian Taylor 1a00a30f18 Add support for srff. 2022-10-07 12:55:59 +02:00
Brian Taylor 7f38ce4ebb Remove debug code. 2022-10-07 12:55:42 +02:00
Brian Taylor 648218d5a8 Remove invalid check. 2022-10-07 12:55:25 +02:00
Brian Taylor 6a067378cb Add optional debug code to check for name collisions. Connector nodes between gates now have a con_ prefix. 2022-10-07 12:55:06 +02:00
Brian Taylor 5b3862ebc7 Prevent multiple d_zero_inv99 models per subckt. 2022-10-07 12:54:54 +02:00
Brian Taylor 9361e9ae6c Follow convention, use eq() macro. Show replacement cards when ngdebug=TRUE. 2022-10-07 12:54:32 +02:00
Brian Taylor e38e1099b5 Create pin and port lists only when variable ps_pins_and_ports is set != 0. 2022-10-07 12:54:17 +02:00
Brian Taylor ac9559db76 Remove optional:, params:, text: before generating a ports list. 2022-10-07 12:54:03 +02:00
Brian Taylor 528c50dc46 Retain the param: section after removing the optional: section from a Pspice subckt declaration. 2022-10-07 12:53:41 +02:00
Brian Taylor 5a50868264 Add more comments. Move incompatible input name checks to add_..._inout_timing_model() functions for dff, jkff, dltch. 2022-10-07 12:53:22 +02:00
Brian Taylor e8dfd16cb2 Add counter test. Check for usage of $d_lo, $d_hi, $d_nc usage with dff, jkff, dltch which will not translate to Xspice. 2022-10-07 12:52:39 +02:00
Brian Taylor ecf4ea8978 Get rid of -Wpedantic warnings. 2022-10-07 12:52:04 +02:00
Brian Taylor 4ce9add137 Remove debugging asserts. 2022-10-07 12:51:51 +02:00
Brian Taylor bc8d67d5fa Generate lists of subckt ports indicating direction (in, out, inout.) 2022-10-07 12:51:33 +02:00
Brian Taylor 1fb533a3d4 Stopped memory leak in continuation cards when removing old cards. 2022-10-07 12:51:18 +02:00
Brian Taylor 89c698d4ea Slight cleanup. Some work ensuring that generated names do not collide may be necessary. 2022-10-07 12:51:03 +02:00
Brian Taylor 219ca23635 For debug tracing, list the cards before and after udevice replacements. 2022-10-07 12:50:51 +02:00
Brian Taylor 18e17cefdf Add pullup/down. Skip spurious '*' line. 2022-10-07 12:50:30 +02:00
Brian Taylor 813c73966d Add support for oa/oai compound gates. 2022-10-07 12:50:10 +02:00
Brian Taylor 7b5c780043 Fix a memory leak. Cleanup the code a bit. All-digital Pspice subckts with U* devices for most used gates/ff can be handled. More extensive test cases are necessary. Also, interfacing subckts with analog ports is not implemented. 2022-10-07 12:49:46 +02:00
Brian Taylor 96a1b528fd Replace Pspice U* and .model cards with their Xspice equivalent statements. There are still memory leaks which will be plugged next. The .subckts have only digital ports, which will need to addressed for mixed A/D designs. 2022-10-07 12:49:29 +02:00
Brian Taylor 2c3c632349 Add translation of ao/aoi compound gates. 2022-10-07 12:49:06 +02:00
Brian Taylor a2fd346b1a Trial run at scanning cards for Pspice U* devices and models. #define INTEGRATE_UDEVICES to turn it on. No new cards are created yet, just lots of debugging info. 2022-10-07 12:48:51 +02:00
Brian Taylor 9bbcf20584 Add brief usage notes and makefile. asserts will need to be removed after integration is complete. 2022-10-07 12:48:36 +02:00
Brian Taylor b367434c78 Add default zero delay models d0_gate, d0_eff, d0_gff, d0_tgate. Use tprintf. 2022-10-07 12:48:21 +02:00
Brian Taylor 620c15a981 Initial files for translating Pspice u.. instances and timing models into Xspice equivalents. Standard gates, tristate gates, dff, jkff, dlatch are supported. Compound gates and pullup/down are not done. Makefile and frontend/inpcom.c changes have not been finished. These modifications will be needed to complete integration. 2022-10-07 12:47:59 +02:00
Holger Vogt 564a3cb2f7 No error message when Optran returned 0 2022-10-07 12:40:49 +02:00
Holger Vogt d3a436b7dd re-format indmask.c 2022-10-07 12:39:49 +02:00
Holger Vogt 0387a95218 Add missing parameter retrival 2022-10-07 12:39:35 +02:00
Holger Vogt b4a2c85b54 Asl Lundin's correction only when suitable modelparameters are given. 2022-10-07 12:39:10 +02:00
Holger Vogt 360b7dc7ed Make warning message on missing init file more verbose. 2022-10-07 12:38:38 +02:00
Holger Vogt f1d944e4c4 remove typo 2022-10-07 12:38:02 +02:00
Holger Vogt f698ce6281 Write out the current in the old fashion
1	v1#branch	current
when keep#branch is set in .spiceinit.
To make the raw file compatible with ICCAP.
2022-10-07 11:39:18 +02:00
Holger Vogt 879030bbd8 Add a warning when Lundin's correction factor is not
calculated because the geometries are too small (< 1um).
2022-10-07 11:37:55 +02:00
Holger Vogt 500d72f270 Add coil diameter dia to the inductor parameters.
dia (diameter) takes preference over csect (cross section)
2022-10-07 11:37:37 +02:00
Holger Vogt 79ef586fef Add Lundin's geometry correction to the
inductance formula
2022-10-07 11:37:13 +02:00
Holger Vogt 4a96691b49 Fix a bug in the inductance formula. 2022-10-07 11:36:50 +02:00
Holger Vogt 6b83a57a18 Exit when executing the input fails,
if -o option (log file) is set and not in interactive mode.
Enables running the paranoia suite without hanging if
something goes wrong.
2022-10-07 11:36:31 +02:00
Holger Vogt c76efd47ed If the 'source' command fails, fall back to the input
only if in interactive mode. Otherwise exit.
2022-10-07 11:36:07 +02:00
Holger Vogt b46dd5effd Limit the number of messages 'Warning singular matrix: ...' to 6,
if not 'set ngdebug'
2022-10-07 11:35:38 +02:00
Holger Vogt f7c5c93635 Make error message more verbose:
State explicitely when transient op has failed.
2022-10-07 11:35:11 +02:00
Holger Vogt 1e304c6e53 Prevent a crash when line is empty 2022-10-07 11:34:39 +02:00
Holger Vogt e460b18f97 Allow 'nulltype', which returns NULL pointer.
Thus prevent a crash in cieq.
2022-10-07 11:34:25 +02:00
Holger Vogt fc83328952 Rename the internal circuit nodes generated by .probe
to probe_int_xxx to make it probe specific.
Don't save these nodes.
2022-10-07 11:34:04 +02:00
Holger Vogt 9619b52180 Don't save the internal device node collCX, added
for a new quasi-saturation model of bjt
2022-10-07 11:33:46 +02:00
Holger Vogt d93295136b When plotting the phase, standard now is "Radiant".
Only with 'set units=degrees" we plot with unit Degree.
2022-10-07 11:33:24 +02:00
Holger Vogt eb79e91175 This is a fix to bug report 589 by Bohdan Tkhir:
Remove only mfg=something, icrating=, vceo=, type=,
not any combination of text like net_type=... .
Restrict this removal to compatibility modes ps or lt.
2022-10-07 11:32:56 +02:00
Holger Vogt a2beac6741 not only de-allocate the vector, but also remove it from the list.
This is to prevent a crash when after simulating with a buggy input like:
save all @q1[nonesense] (non-existing parameter) a command 'print all'
is given.
2022-10-07 11:32:30 +02:00
Giles Atkinson aaa6798950 Fix bugs found while investigating Bug #585 (convergence failure only
on Linux).  In dctran.c make it impossible for a transient simulation
to run far past its end time and fix an infinite loop attempting to remove
the automatically-inserted ending breakpoint.  In outitf.c fix memory
corruption if the simulation does over-run (change suggested by Holger Vogt).
2022-10-07 11:32:02 +02:00
Holger Vogt e5c162f126 dc sweep fails after transient sim:
keep MODEDCTRANCURVE as provided by commit
7d8236766 ("b3ld.c, b4ld.c, b3v32ld.c: enable capacitance calculation during dc sweep", 2012-10-03)
Instead exclude current integration when MODEDCTRANCURVE is selected.
Unify setting ChargeComputationNeeded in b4vdld.c,
make it as in other b4xxld.c.
2022-10-07 11:31:06 +02:00
Holger Vogt 838ad2b10c Add multiplier flag 'm' to behavioral capacitor and inductor 2022-10-07 11:30:25 +02:00
Holger Vogt 4c8324f166 VIN 3 0 PULSE (-1 1 2NS 2NS 2NS 50 NS 100 NS) is now standard
(missing dc value).
So revert the warning message:
VIN 3 0 dc 0 PULSE (-1 1 2NS 2NS 2NS 50 NS 100 NS) yields
a note message (not a warning)
2022-10-07 11:29:53 +02:00
Holger Vogt 0faf386d45 We developing towards ngspice-38
The intermediate stage is named 37+
2022-06-23 08:33:01 +02:00
Holger Vogt 7e8e9ef001 Update copyright info to 2022 2022-05-14 16:32:01 +02:00
holger 6d3f92cec6 add new header spardefs.h to noinst_HEADERS 2022-05-12 17:35:16 +02:00
holger cf15e904e2 add *.h to the source files
to allow 'make dist' distributing them
2022-05-12 17:24:26 +02:00
Holger Vogt 303cf0c92b Prepare ngspice-37 2022-05-11 13:48:33 +02:00
Giles Atkinson 40c2419a43 Two memory leaks found interactively with valgrind with safe fixes. 2022-05-10 15:30:08 +02:00
Giles Atkinson 7511bef7d4 Fix memory leak found by valgrind/paranoia. 2022-05-10 15:29:59 +02:00
Giles Atkinson 8c7b7789d9 Suppress warning from gcc 10.2.1. 2022-05-10 15:29:43 +02:00
Giles Atkinson daad3fb3c5 Fix memory leaks found by valgrind in the paranoia script. 2022-05-09 10:08:06 +02:00
Giles Atkinson dbf4c16bc0 Fix XSPICE memory leaks found by valgrind. 2022-05-09 10:07:57 +02:00
Giles Atkinson 88481d4bfb Further change for #578 "Crash while plotting single complex vector".
Move the check on vector lengths to ensure all cases are covered.
2022-05-09 10:07:33 +02:00
Holger Vogt e80dad01fc Fix bug 581, reported by Adam Denton 2022-05-09 10:07:20 +02:00
dwarning 67508eab37 more logical setup for absurd parameter input 2022-05-09 10:07:05 +02:00
dwarning 720f29851a prevent crash for absurd parameter input 2022-05-09 10:06:55 +02:00
Holger Vogt 899cdbc281 Enable compiling the shared ngspice library with S-parameters enabled 2022-05-02 11:43:46 +02:00
Holger Vogt cc285741f5 Don't use bitwise operators, but logic operators 2022-05-01 10:30:18 +02:00
Holger Vogt ff3580d70f Avoid circular redundant function declaration.
Include vsrcext.h only via vsrcdefs.h, so VSRCinstance is defined.
2022-05-01 10:30:12 +02:00
Holger Vogt cb17062344 Remove unused (preliminary) 2022-05-01 10:30:02 +02:00
Holger Vogt be4df00678 add some missing prototypes 2022-05-01 10:29:52 +02:00
Giles Atkinson dc978a4193 Suppress warnings from function pointer casts seen with gcc 10.2.1. 2022-05-01 10:29:43 +02:00
dwarning d4f64da671 simplification of hicum2 model switches selfheat and nqs 2022-05-01 10:29:31 +02:00
dwarning 3d4d9b01d0 #bug 580: prevent crash in case of hicum2 default parameter set 2022-05-01 10:29:23 +02:00
dwarning 4038dd3a7f #bug 580: prevent crash in case of hicum2 default parameter set 2022-05-01 10:29:17 +02:00
Holger Vogt 0e46f6f8a1 remove numerous unsigned int vs. int warnings
by setting all variables to type int.
Remove redundant function declarations by remmoving some includes
in span.c and vsrcdefs.h
In tmalloc convert int to size_t
2022-05-01 10:29:08 +02:00
Holger Vogt d805674a94 Set {} to remove compiler warning (VS) 2022-05-01 10:28:51 +02:00
dwarning eaf67ac940 correct pnp type bipolar transistor current convention 2022-05-01 10:28:23 +02:00
Holger Vogt 3073d8c7d3 Fix a bug: remove excess ')' 2022-05-01 10:28:08 +02:00
Holger Vogt 8e80933cfa If XSPICE is not selected, still send CKTspDump(ckt, freq, spPlot),
but without ipc (spPlot instead of undefined acPlot)
2022-04-29 07:29:33 +02:00
Holger Vogt 764a651b73 Add a note that wrs2p currently is limited to two ports only. 2022-04-29 07:29:24 +02:00
Holger Vogt 129893b399 S-parameters: Replace S11 by S_1_1 etc. to avoid ambiguity
when more than 10 ports are measured.
Update to S-parameter script and command wr2sp
2022-04-29 07:29:14 +02:00
Holger Vogt 67726f7f8b Add new flags to command devhelp:
-type (show parameter types)
-flags (show parameter flags)
Patches provided by Mikolaj Wielgus
2022-04-28 09:29:02 +02:00
Giles Atkinson 41e48b954d Rename a variable so that it does not clash with one in outer scope. 2022-04-26 10:37:28 +02:00
Holger Vogt b6abcb0436 Searching for params: as plain identifier 2022-04-26 10:37:19 +02:00
Holger Vogt 6153f2c887 Remove the special handling of X... device names.
Subcircuit devices are saved with leading X in their names.
2022-04-26 10:37:03 +02:00
Giles Atkinson 519915202f Fix Bug #577 "Zooming iplot drops vectors" and three crashes when
the iplot window is closed during simulation.
2022-04-26 10:36:55 +02:00
Holger Vogt 0be163d8d8 Search for "off" token in device instance lines not with
C standard fcn strstr, but with search_plain_identifier().
Thus allow model names that contain "off" (like offset)
2022-04-26 10:36:24 +02:00
Holger Vogt 08a12b5355 Add a function itoa10 and use it
instead of non-standard itoa.
2022-04-26 10:36:10 +02:00
Holger Vogt d04445e085 When calculating power, we need to exclude thermal nodes
of devices like diodes (d) and MOS (m)
2022-04-26 10:35:56 +02:00
Holger Vogt 2fabc53f4f Add flag 'power' to fcn setallvsources()
Add code to calculate the power dissipation in a device
(top level instances, including X (subcircuit) invocations).
2022-04-26 10:35:44 +02:00
Holger Vogt a165556088 revert polarity of current mesurements:
current positive when flowing into device, e.g.
Ic, Ib of a positively biased npn.

Add current measurement for all nodes of a device,
e.g. .probe i(Q1) will measure Ic, Ib, Ie (and Is)
2022-04-26 10:35:29 +02:00
Giles Atkinson b3fd63ea88 Fix numerous gcc warnings of duplicate declarations. 2022-04-26 10:34:52 +02:00
Giles Atkinson 39b837a405 Fix Bug #402 "Crash related to aliases". Do not return freed pointer. 2022-04-26 10:34:45 +02:00
Holger Vogt 16f619818e Remove a conflict between the text variable substitution like
set text = "mytext"
set newtext = new.{$text}
echo $newtext
and the command circbyline, which may have to process strings
containing braces {...} without any change to the string.

Do not call cp_doglob() when command circbyline is executed.
2022-04-26 10:34:35 +02:00
Holger Vogt b798076415 make comment more verbose 2022-04-26 10:34:21 +02:00
Holger Vogt 597bc9edd0 Remove a typo: runable --> runnable 2022-04-26 10:34:11 +02:00
Holger Vogt 287406459a Make error message more verbose 2022-04-26 10:33:41 +02:00
Holger Vogt 2915f8e991 In case of resistor valuues r150 (r + integer number),
return 150
R2 n1 n2 r150

In case of r23mod return error = 1 and val = 0, so
r23mod may be read as a model, not an instance parameter
R3 n3 n4 r23mod
2022-04-26 10:33:31 +02:00
Giles Atkinson 9ac4dab81a Fix two crashes caused by trying to plot after circuit parsing failed. 2022-04-26 10:32:47 +02:00
Giles Atkinson c65155880c Make "nogrid" plotting option work. The deleted code was in the original
commit, so the reason for it can not be traced.
2022-04-26 10:32:39 +02:00
Holger Vogt 26c50de68b function deriv: This is just a preliminary fix: prevent a crash
when base > 0.

But when is base supposed to be > 0 ? More invetigation is needed.
2022-04-25 21:34:41 +02:00
Holger Vogt 321d53a4e9 Patch to avoid false reads and writes due to inconsitent
structs SPAN and NOISEAN.
Prevent using non-initialized variables.
2022-04-25 21:34:32 +02:00
Holger Vogt 61797c9317 Compile only when RFSPICE is selected in config.h 2022-04-25 21:33:37 +02:00
Holger Vogt 768e4870c6 Linking failed on openSUSE Linux gcc:
make the inline functions static to allow linking
2022-04-25 21:32:57 +02:00
Holger Vogt 32a707fd22 Provide access to the necessary structs like cplx 2022-04-25 21:32:43 +02:00
Holger Vogt d961c7c91d add missing noisesp.c 2022-04-25 21:32:10 +02:00
Holger Vogt 7c57c9adbd Patch suggested by Alessio Cacchiatori at
https://sourceforge.net/p/ngspice/discussion/127605/thread/7a2655c86f/
2022-04-25 21:31:49 +02:00
Alessio Cacciatori 4ebf4901b9 S-parameters in ngspice
With this commit the patch provided by Alessio Cacchiatori the S-parameter is completed:
Noise simulation added with C matrix output
Y and Z matrix output enabled

To allow compiling with gcc, the dense.h inline functions have been put into denseinlines.h
2022-04-25 21:31:28 +02:00
Holger Vogt b1e73370ed We start not at 0, but use the mean value (given in PARAM2) as
start value
2022-04-25 21:31:00 +02:00
Vadim Kuznetsov b73939e379 Patch allowing call to S parameter simulation also from .control section by using command 'sp' 2022-04-25 21:30:52 +02:00
Holger Vogt 99f2414caf Prevent a segfault when the parameter to command 'repeat' is given,
but cannot be evaluetd to a number.
2022-04-25 21:30:27 +02:00
Holger Vogt 56a3771d9a .probe: replace (all) by alli (we only measure all currents) 2022-04-25 21:29:39 +02:00
Holger Vogt 4cc6222230 Make function search_plain_identifier non-static
Declare info on the compatibility mode as a 'Note'.
2022-04-25 21:29:25 +02:00
Holger Vogt 696736b2b3 adding expressions in {} as pwl parameters
not complete, still requires caring about the FIXME above.
2022-04-25 21:28:52 +02:00
Holger Vogt 242a1d796a Remove the "type" declaration from a .model line 2022-04-25 21:28:32 +02:00
Holger Vogt a1eb0cc63d If XSPICE is not selected, still send CKTspDump(ckt, freq, spPlot),
but without ipc (spPlot instead of undefined acPlot)
2022-04-25 21:28:16 +02:00
Holger Vogt 36868e0b0f Use #ifdef XSPICE to exclude findvec_alle() if
XSPICE is not selected.
2022-04-25 21:28:03 +02:00
Holger Vogt ed2d48756c exclude 'type=xxx' from model declaration 2022-04-25 21:27:53 +02:00
dwarning 45d5d9a764 remove duplicate pointer allocation 2022-04-25 21:27:39 +02:00
Holger Vogt 246f9f5e9e d_pwm: Add a hybrid oscillator (analg control in, digital out) with PWM
(pulse width modulation) capability, oscillation frequency is a parameter.

The model has been derived from the d_osc example.
2022-04-25 21:27:26 +02:00
Holger Vogt f21255ef1b Fix regression bug #579
Accept numbers to ac statement in voltage (current) sources
also given as parameters.
2022-02-22 20:39:20 +01:00
Holger Vogt 20d5919e59 Terminal setting to X11 fails in macOS, and is not required
on Linux.
Setting terminal here is redundant, so remove this setting.
2022-02-22 15:22:21 +01:00
Holger Vogt 12a93c9fe6 Update to plotting of event nodes:
Distance is now 1.5, scaling and cutouts are possible
(with some lack of precision).

Still missing: y axis labeling (no numbers, but node names).
2022-02-21 20:19:56 +01:00
Holger Vogt 342a16d6e1 Add a flag 'alle' (all event nodes) to the plot command (and maybe others).
All event nodes with length greater than 1 are translated to vectors
with a common scale (named step) and are assembled in a new plot
named 'digital'. They may be plotted or otherwise used in a
.control section.
2022-02-21 20:16:20 +01:00
Holger Vogt 0557bc60bf Prevent crash if nsp is evaluated to 0 2022-02-21 16:56:16 +01:00
dwarning 20abe9ca38 white spaces 2022-02-20 14:55:10 +01:00
Holger Vogt 917dab9da7 new flag 'digitop' for the 'plot' command:
Plot digital (event nodes) vertically, separated by 0.1
The grid is adapted acordingly.
set xbrushwidth=3 will yield good results.
2022-02-19 17:25:57 +01:00
Holger Vogt 7130097710 Prevent crash when no simulation has been run and
asking for plotting an event node
2022-02-19 17:23:36 +01:00
Holger Vogt 954cc86e59 Add new or upgraded functions as of 01-09-22.
Add a function prototype for cmod.
Rename function conj to conju because conj
is already defined differently in complex.h
2022-02-17 15:49:53 +01:00
Holger Vogt 94a73ffef2 Add changes from 01-09-22, but without the extra extern calls,
which have led to a bunch of warnings when compiling with gcc.
2022-02-17 15:49:33 +01:00
Holger Vogt e99638c89f Remove int <--> unsigned int warning 2022-02-17 15:49:20 +01:00
Holger Vogt 4e1ae255f6 Inlude code into #ifdef RFSPICE ... #endif
to allow compiling without pre-processor flag RFSPICE.
2022-02-17 15:49:09 +01:00
Holger Vogt de572d2cdf Remove in <--> unsigned int mismatch 2022-02-17 15:48:52 +01:00
Holger Vogt c2d279a1ef Remove trailing spaces. 2022-02-17 15:48:31 +01:00
Holger Vogt 648ba396ff Add missing makefile.am in src/math/dense
and add src/math/dense to AC_CONFIG_FILES
in configure.ac
2022-02-17 15:48:25 +01:00
Holger Vogt 3b0eb41c74 Enable compiling with --enable-sp for RF SPICE
Set preprocessor flag RFSPICE
Add new files and directory 'dense' ('dense' is still buggy)
2022-02-17 15:48:19 +01:00
Holger Vogt 5b8ed0a84e Remove redundant declarations 2022-02-17 15:48:10 +01:00
Alessio Cacciatori 2c10c4aebd S parameter simulation
Command '.sp'
arbitrary number of ports
ports made with modified VSRC

Patch provided by Alessio Cacciatori
https://sourceforge.net/p/ngspice/discussion/127605/thread/7a2655c86f/
2022-02-17 15:48:00 +01:00
Brian Taylor b774d03162 Change the y-axis direction for a 2d Cider gnuplot. The device surface is at the top and downwards is into the material, which is the normal presentation. Note that the x/y mesh commands in a Cider model also affect the orientation. 2022-02-17 15:45:28 +01:00
Holger Vogt 62f326b9d0 Fix a bug from previous commit: min -> MIN 2022-02-07 22:39:27 +01:00
Holger Vogt 0eb272243f Enable RKM notation also for inductors (e.g. 1u2 for 1.2u) 2022-02-07 16:00:29 +01:00
Holger Vogt 640fa7e17b bug 578 crash when scale is too short
Warning message if scale and vector length do not match.
Restrict number of points plotted to the smaller of both.
2022-02-07 15:59:43 +01:00
Holger Vogt 4f82a24df2 Add parameter 'isgrid' to plotting of arcs.
Smithgrid and polar plots could not discern between xgridwidth and
xbrushwidth. This is now available, similar to straight line plotting.
Tested also for PS and SVG.
2022-02-01 12:23:29 +01:00
Giles Atkinson 16f586b65e Respect the "tstart" parameter when saving event node data (XSPICE).
Fixes Support Request #47: "XSpice memory usage (TRAN TSTART effect)".
2022-01-28 12:25:36 +01:00
Giles Atkinson 6494befb2f Request backing store for X11 plot windows. When supported by the X server
windows are redrawn vey quickly without replotting.
2022-01-28 12:24:58 +01:00
Giles Atkinson f4285384e7 Add code in graf.c to merge connected lines with the same slope before
plotting.  This speeds output and reduces file size when the vector
length is much larger than the number of pixels.  It should help with
Feature Request #58:
  "Graph plotting under windows redraw very slow and hard to work with",
but is not a full fix.
2022-01-28 12:24:51 +01:00
Holger Vogt ce9bc9fc64 The re-painting due to mouse-click under MS Windows is caused by line 561
of windisp.c. Upon left mouse button up the plot recangle is invalidated,
and a WM_PAINT message is generated (same on line 614 for right mouse
button up). If not re-pained, artifacts may be left on the canvas after
collecting coordinate data.

Shifting the command InvalidateRect to a place where it becomes active
only after the mouse has been moved, does the trick. Simple clicking
(right or left) will not cause a re-paint any more.
2022-01-28 12:11:39 +01:00
Kevin Zheng 857fbec985 Improve iteration limit options display 2022-01-17 12:06:35 +01:00
roman 74787f0c33 Fix EXTERNAL type in isrc 2022-01-17 11:32:01 +01:00
Holger Vogt ced2128f58 .measure results from batch mode may be saved in a file
(in addition to the printout)
Add command
set measoutfile=<path/filename>
to .spiceinit or to a .control section in the netlist
2022-01-15 23:28:06 +01:00
dwarning 0c34ac019f use total current for diffcap calculation 2022-01-15 16:22:42 +01:00
Holger Vogt 4ee0586cee Enable output redirection for meas command
replace printf("... by fprintf(mout, "...
mout is routinely set to cp_out, which then allows redirection by > and >>
2022-01-15 16:02:20 +01:00
Holger Vogt 018713cc43 Bug 572 Error message 'function 'xyz' currently not supported' was buggy.
xyz had not been set.
Copy function name to the heap and free accordingly.
2022-01-15 14:43:44 +01:00
Holger Vogt 46696a6aaa If function is not found, bail out if strict_errorhandling is set. 2022-01-15 14:09:50 +01:00
Holger Vogt 632f8c033d Make numoparam error messages more user friendly.
Add line number of netlist to the message.

Original line number added to new lines in inpcom.c.
Internal error messages only when 'ngdebug' is set
2022-01-15 13:43:26 +01:00
Brian Taylor 08bc3ccdd6 Remove compiler warnings (writ_ifs.c ipcsockets.c). 2022-01-13 14:54:16 +01:00
Holger Vogt 1558c5abcb Add a suitable error message and fallback to default temperature
if an error in the temperature entry is found.
2022-01-13 14:48:35 +01:00
Holger Vogt 5a065c1657 Originally only '.temp 125' had been accepted.
There has not been any error message if '=' was used,
the temperature just had been set to 0°C.
Now also '.temp=125' or .temp='param' are accepted.
2022-01-13 10:06:27 +01:00
Giles Atkinson 23e9df0181 Fix for ticket #570: Interactive prompting is always active.
Control prompting with variable "interactive" and stop setting it by default.
Add code in main.c to set it for an interactve session.
2022-01-12 15:22:19 +01:00
Holger Vogt c4e94cd59b safeguard against a crash when the s line is buggy 2022-01-12 15:16:06 +01:00
Holger Vogt 64dba93b93 We are now developing ngspice-36+ 2022-01-09 11:57:05 +01:00
Holger Vogt f0e9a35eb6 Add 'esave' command to save only specific event nodes.
Add a prompt for esave/eprint/eprvcd.
2022-01-09 10:58:38 +01:00
Holger Vogt 9308c6b077 Reuse memory for queued events.
Patch #109 - 2 provided by Giles Atkinson
2022-01-03 22:11:03 +01:00
Holger Vogt 0c59a77fc4 During op evaluation we might use source stepping.
Independent V and I sources are stepped, the B source however is not.

Add source stepping to B source.
2022-01-02 13:53:38 +01:00
Carsten Schoenert 486dd587d0 spelling: Fix misspelled word Instnace 2022-01-02 13:51:44 +01:00
Holger Vogt 8263e2a4da The AD and DA hybrid XSPICE bridges consume a lot of
memory (one state per time step added). Memory of
previous time steps is not recovered.

Patch #109 by Giles Atkinson reduces memory consumption
dramatically (> factor of 10).
2022-01-01 16:14:48 +01:00
Holger Vogt 1a6a9e6bb6 Add com_wr_ic.h to their makefile.am
to have them as part of make dist.
2021-12-30 15:23:22 +01:00
Holger Vogt 43f2182e56 Add com_optran.h and cplhash.h to their makefile.am
to have them as part of make dist.
2021-12-30 15:08:15 +01:00
Holger Vogt c7bc84943a plug a memory leak 2021-12-23 14:38:09 +01:00
Holger Vogt a8d8600faa plug a memory leak 2021-12-23 14:37:57 +01:00
Holger Vogt cb0d8f18dc Prepare for ngspice-36 2021-12-18 13:47:43 +01:00
Holger Vogt 4f73c27d86 Memory access error: don't free GENinst->GENname.
Use memcpy to overwrite old name by a (shorter) new name.
Compiler warnings are thus removed.
2021-12-16 08:04:54 +01:00
Holger Vogt 9be9f46f96 Remove unused function Evt_Data_destroy() 2021-12-16 08:04:44 +01:00
Holger Vogt 6ba484e5d2 Remove redundant redeclaration of ‘ft_getpnames_quotes’ 2021-12-16 08:04:34 +01:00
Holger Vogt 5adbfc1c86 Remove compiler warnings associated with snprintf()
Use memory allocated on the heap instead.
2021-12-16 08:04:20 +01:00
Holger Vogt b5b462506f add a function prototype for com_wric() 2021-12-16 08:03:59 +01:00
Holger Vogt 3bac1ffabe Allow adequate size for copying.
Add the missing character string to fprintf.
2021-12-13 22:31:19 +01:00
Holger Vogt b636017359 add function prototype
for insert_new_line()
2021-12-13 22:09:17 +01:00
Brian Taylor 8e75cad453 Fix missing initializer warning. 2021-12-13 21:50:30 +01:00
Holger Vogt 11117912f9 typos 2021-12-13 21:50:20 +01:00
Holger Vogt 1605d293d0 Add function integ to control language
Trapezoidal rule for integrating a vector.
2021-12-13 21:49:45 +01:00
dwarning 2eaf35f633 fix a double application of device multiplier for certain diode parameter 2021-12-13 21:49:33 +01:00
Holger Vogt 422719200e re-enable parameters in agauss function
fixes bug #564 reported by Stefan Schippers

If nested braces {..{  }...} have been created,
replace the inner { } by ( )
2021-12-13 21:49:18 +01:00
Holger Vogt a68cfefb28 hcopywidth and hcopyheight failed with SVG plot
cp_getvar read CP_NUM, not CP_STRING
Patch #108 contributed by Giles Atkinson

Add hcopywidth and hcopyheight to example nmos_out_BSIM330_svg.sp
2021-12-13 21:49:01 +01:00
Holger Vogt b749e62e31 Make error message more verbose 2021-12-13 21:48:29 +01:00
Holger Vogt aaf586ae83 .probe: Add more safeguards to prevent crashes
in case of wrong user input
due to obtain empty lines in shared ngspice
2021-12-13 21:48:21 +01:00
Holger Vogt bb9f1669f6 Enable math characters also in tokens like i(z/z) by
temporarily putting " around the token.

Improve error message on missing vector
2021-12-13 21:47:54 +01:00
Holger Vogt b59d2aabd1 .probe: Add function call to modprobenames()
Function resides in inpc_probe.c.
The function renames all current measurement instances
vcurr_instance:node#branch to instance:node#branch by
modifying the global instance table (tab).
2021-12-13 21:47:37 +01:00
Holger Vogt 9dff15507d .probe: Add call to function inp_probe() which resides
in inpc_probe.c.

Make function insert_new_line() non-static

Enable detecting the number of nodes in x-lines
(calls to subciruits) in function get_number_terminals()
2021-12-13 21:47:27 +01:00
Holger Vogt 7f1a3bea20 .probe: Add the new file inpc_probe.c to the VS project files
and makefile.am in ngspice/src/frontend
2021-12-13 21:47:11 +01:00
Holger Vogt 951be0ddb0 New dot command .probe:
Code to enable current measurements at all top level
device pins and to enable differential voltage measurements
between two (arbitrary, top level) device nodes.

Adds 0 V voltage sources for current measurements to selected or all
device nodes at top level (including X lines)

Adds an E source excited by two arbitrary nodes for differential
potential (aka voltage) measurements between these nodes

Function inp_probe() is called from inpcom.c
2021-12-13 21:46:57 +01:00
Holger Vogt 7f75b2a7b8 Update to previous commit: safeguard against no circuit loaded 2021-12-13 21:46:29 +01:00
Holger Vogt 54eb12de39 Fix a bug: Crash when 'settype @d1[id]' is given,
but simulation is not yet run.

Add a better check for having at least one simulation run
2021-12-13 21:46:15 +01:00
Holger Vogt 1ce0066d3b Update to previous commit: corrected and enhanced warning messages 2021-12-13 21:46:03 +01:00
Holger Vogt 16fd8749cf Fix a bug: Crash when 'settype @d1[id]' is given,
but simulation is not yet run.

Ask for the job before acknowledging settype on
a vector starting with @
2021-12-13 21:44:30 +01:00
Holger Vogt 2f98a5b305 evtprint: prevent a crash when eprint has been called
but there is no simulation run.
2021-12-13 21:44:02 +01:00
Holger Vogt bff90f1498 Put the gmin reversal into the comment 2021-12-13 21:43:50 +01:00
Holger Vogt 5424fd0d43 Reverse the sequence of dynamic-gmin and new-gmin.
The old method dynamic-gmin now comes first,
new-gmin will follow when the former has failed to converge.
2021-12-13 21:43:30 +01:00
Holger Vogt 79c71a4ec3 Enable math characters in vector (node) names for command fft
Replace ft_getpnames() by ft_getpnames_quotes().
2021-12-13 21:42:36 +01:00
Holger Vogt ccd9a217c3 Enable math characters in vector (node) names for logic comparison
Replace ft_getpnames() by ft_getpnames_quotes().
2021-12-13 21:42:25 +01:00
Holger Vogt 8895a6e633 Enable math characters in vector (node) names for command alter
Replace ft_getpnames() by ft_getpnames_quotes().
2021-12-13 21:42:12 +01:00
Holger Vogt ee2f3a72f4 Enable math characters in vector (node) names for command fourier
Replace ft_getpnames() by ft_getpnames_quotes().
2021-12-13 21:41:58 +01:00
Holger Vogt 98b7074287 Enable math characters in vector (node) names for command spectrum
Replace ft_getpnames() by ft_getpnames_quotes().
2021-12-13 21:41:48 +01:00
Holger Vogt c09839b209 Enable math characters in vector (node) names for commands
write and print
Replace ft_getpnames() by ft_getpnames_quotes().
2021-12-13 21:41:37 +01:00
Holger Vogt 57f6d41e69 Enable math characters in vector (node) names for plotting
Replace ft_getpnames() by ft_getpnames_quotes().
2021-12-13 21:41:28 +01:00
Holger Vogt e93a19e3e8 Allow math characters in node names
Add a function ft_getpnames_quotes()
It puts quotes " around tokens xxx, when these are enclosed as
V(xxx) and contain arithmetic characters. V(R*C) becomes
V("R*C"). After settig up the parse tree, the quotes are removed again.
Thus these math character remain part of the node name and are not
parsed as parts of an equation.
2021-12-13 21:41:16 +01:00
Holger Vogt d5dc757288 correct assignment of a variable value to a 1-bit-field
only by a logic comparison.
2021-12-13 21:40:57 +01:00
Holger Vogt 90377dcff9 struct TSKtask: group all single bit fields together 2021-12-13 21:40:38 +01:00
dwarning 26979079d4 prevent few compiler warnings 2021-12-13 21:40:15 +01:00
Holger Vogt 3f3936c728 Remove memory leaks 2021-12-13 21:34:07 +01:00
Holger Vogt 89eaf7739c Remove unused variables 2021-12-13 21:33:09 +01:00
Holger Vogt a420f58ef5 Plug a (potential) memory leak
Add missing memsaved
2021-12-13 21:32:46 +01:00
Holger Vogt 6b41ad433a Remove memory leak
Free some tokens generated by CNVget_token
Initialize reset and clk

Still missing: free 'states'
2021-12-13 21:32:15 +01:00
Holger Vogt 36fa47a8a0 Remove memory leak
Add callback function free_local_data
Free some tokens generated by CNVget_token
2021-12-13 21:31:49 +01:00
dwarning 8f9bf94a38 Aware of sscanf return value 2021-12-13 21:30:55 +01:00
dwarning ba6d8c871c white spaces 2021-12-13 21:30:32 +01:00
dwarning ba9f5be52c Prevent arithmetic overflow and reduce operations 2021-12-13 21:29:37 +01:00
Brian Taylor 38848259e4 With the ngspice gnuplot command, enable x/y contour plots for 2d Cider save file data. Usage: gnuplot <file> xycontour <expr>. xycontour is a new flag which is ignored if the plot data is not from 2d Cider. For contours, only a single plotarg <expr> is allowed. With <expr1> vs <expr2>, only <expr1> is plotted and <expr2> is ignored. 2021-10-30 13:21:32 +02:00
dwarning 550e9f1a81 correct some scaling rules 2021-10-30 11:03:26 +02:00
dwarning f638a63fba save few calculation effort in diode load routine 2021-10-30 11:03:05 +02:00
dwarning 62242a5538 save few calculation effort in bjt load routine 2021-10-30 11:02:54 +02:00
dwarning 133f9c46e7 prevent unwanted fallthrough 2021-10-30 11:02:25 +02:00
dwarning ae49043fe3 correct scaling for IBC parameter 2021-10-30 11:02:13 +02:00
dwarning b15c7d29f1 correct temp update for IBE and IBC parameter 2021-10-30 11:01:51 +02:00
dwarning 01fb0ac18b introduce IBE and IBC model parameter for more accurate current calculation 2021-10-30 11:01:36 +02:00
dwarning 231e6218a5 remove comment regarding ancient leakage current defaults 2021-10-30 11:01:24 +02:00
dwarning 5ff04ee85b c2 and c4 are now aliases for B-E and B-C leakage saturation currents 2021-10-30 11:01:09 +02:00
Holger Vogt fb98f7873b remove some compiler warnings 2021-10-30 10:46:39 +02:00
Holger Vogt f3cb69403a bug 497: Prevent a crash in CPL
Forbiddeb combination of model parameters.
Details are not yet available.
2021-10-30 10:44:44 +02:00
Holger Vogt 69e2903bf6 Update to Garbage Collector for cpl
Update some comments
Insert the deleting functions
Reset pool_vi and ndn_btree
Add an example with 20 call to cpl in sequence
2021-10-30 10:44:29 +02:00
Holger Vogt 041264df03 No more meory leaks with existing cpl examples:
Add cpldelete.c and cplmdel.c
Delete the model parameters.
Add 2 missing memsaved().
2021-10-30 10:44:07 +02:00
Holger Vogt 9ede9b80e0 Issue a warnong only when ngdebug is set. 2021-10-30 10:43:38 +02:00
Holger Vogt d2dd1950cb Add memsaved() to TMALLOC, calloc and replace CPLTFREE for tfree 2021-10-30 10:43:10 +02:00
Holger Vogt de00317e49 Add memsaved or memdelete to macros 2021-10-30 10:42:37 +02:00
Holger Vogt 8c5277a5e8 Re-format cplsetup.c 2021-10-30 10:42:09 +02:00
Holger Vogt 7dcb1b2a39 Add memsaved() to TMALLOC 2021-10-30 10:41:51 +02:00
Holger Vogt 1dddd6df8d Each TMALLOC is accompanied by fcn memsaved(). 2021-10-30 10:41:37 +02:00
Holger Vogt b142f2eb9d Add mem_init() and mem_delete() to setup and unsetup functions 2021-10-30 10:41:24 +02:00
Holger Vogt 3be7370fa8 Add header with extern function prototypes 2021-10-30 10:40:40 +02:00
Holger Vogt 677ec1a094 Update intro text 2021-10-30 10:40:04 +02:00
Holger Vogt 7c38699cd7 Add missing function nghash_delete_special(),
developed for branch gc-local
2021-10-30 10:39:19 +02:00
Holger Vogt b9afd2bd16 add missing headers 2021-10-30 10:38:23 +02:00
Holger Vogt 2f5a00f0a5 hash functions for cpl garbage collector 2021-10-30 10:37:42 +02:00
Holger Vogt 063665c374 Fix a bug in optran code:
devname will be used in the list of instances
2021-10-29 16:41:18 +02:00
Holger Vogt 01ed224896 A check to avoid multiple entries for the same node into the .save list
Scan the data base dbs (list of saves) before a new entry is generated.
2021-10-29 16:40:51 +02:00
Holger Vogt bde0639bc4 save within subcircuit
enable V(a,b) as v(a) v(b)
2021-10-29 16:40:34 +02:00
Holger Vogt e90b3e711b F.-request 85: save currents in subcircuits
Separate handling .ic/.nodeset and .save .
Add i(Vxx) to  address translation.
Vxx#branch is not supported.
2021-10-29 16:40:23 +02:00
Holger Vogt bd0113ea9a Feature request 85: Enable .save within subcircuits
inp.c: Add .save to wl_first only after subcircuit expansion
subckt.c: treat .save like .ic
2021-10-29 16:40:06 +02:00
Holger Vogt f9b743aa2a remove compiler warnings 2021-10-29 16:39:28 +02:00
Holger Vogt 7ce476c0ad Make optran standrad by calling com_optran during ngspice initialization. 2021-10-29 16:38:27 +02:00
Holger Vogt 36dd77f63e if step size in optran command is set to 0,
optran is deselected.
2021-10-29 16:38:08 +02:00
Holger Vogt 1eb15de584 remove optran command from spinit 2021-10-29 16:37:56 +02:00
Holger Vogt d6038ea43c Redo the transformation vswitch -> pswitch
Parsing takes default values into account, when
parameter is missing.
S vswitch --> pswitch code model
S_ST vswitch (with hysreresis) --> SW switch
S iswitch --> aswitch code model
S_ST iswitch (with hysreresis) --> CSW switch

Use string handling for replacements: allow parameter
equations in .model lines.
2021-10-29 16:37:19 +02:00
Holger Vogt bbccb4b63e Improved error message:
when argument out of range, name the term
2021-10-29 16:36:55 +02:00
Holger Vogt c895ca33f7 Pswitch: Fix a bug in resistance calculation when cntl_on < cntl_off
Correct setting of parens
2021-10-29 16:35:47 +02:00
Holger Vogt eee639d98d Rename the capacitor and inductor code models to capacitoric and inductoric
8e4db9109 ("adms bsimbulk and bsimcmg implementation based on work from Robert Larice", 2020-12-17)
changed inptypelk.c, line 37 from strcmp to strcasecmp.
Thus Capacitor (model for C) and code model capacitor are no longer
distinguished. Model parsing for the code models fails.

These code models are used very infrequently, thus renaming them
is a valid fix.
2021-10-29 16:28:25 +02:00
Holger Vogt 6b5bc9bcd8 There is no f (femto or Farad) in a resistor line 2021-10-05 18:07:32 +02:00
Holger Vogt a87b237bff is_a_modelname() to detect a model 1N4148, if compt LT is set.
Rewrite is_a_modelname(), when LT is set: only check element lines
beginning with r and c for RKM notation of a number.

So don't use a RKM number (e.g. 4k7) for naming a resistor model.
2021-10-05 18:01:53 +02:00
Holger Vogt 34c227815d RKM for C: Revert reading f, it is again femto
Examples files include expected results
2021-09-29 20:31:53 +02:00
Holger Vogt 7f981569d9 Update to RKM if ngbehavior=lt is set:
Reading C and R values follow the RKM convention with 2 exceptions:

    Upper case and lower case letters are not distinguished.

    Letters m, M denote milli (1e-3), letters Meg or meg denote 1e6.
2021-09-29 20:31:44 +02:00
Holger Vogt 6f6f2b8996 Remove double assigment to s[1]
Assignment Is either done in the loop or by *y = '\0';
2021-09-29 20:31:22 +02:00
Holger Vogt daa3609e58 Enable RKM notation for R and C, when ngbehavior LT is selected.
Add 2 evaluation functions specific for R and C respectively.
R has code letters L, R, K, M, G, T enabled. M here is Meg!
C has code letters p, n, u or µ, m, F. F here is unity, femto is
not available, m is still milli!
Two examples files show all cases.
2021-09-29 20:31:14 +02:00
Holger Vogt df5e7e36f6 When checking for µ, truncated the line, when shifted.
Enable R470, when newcompat LT is selected.
2021-09-29 20:30:53 +02:00
Holger Vogt 3dcc36c1c3 ngspice input deck may contain special characters like µ (mu).
Detect mu for ANSI and UTF-8 and translate it to u.
2021-09-29 20:30:35 +02:00
Holger Vogt 4ce4f52938 XSPICE d_source: prevent a crash when the input file is not found 2021-09-29 20:30:10 +02:00
Holger Vogt d4c559421e prevent crash if info.node_table has not been defined,
caused by some preceding error.
2021-09-29 20:29:54 +02:00
Holger Vogt 93f904fb0b Make 'speedcheck' also available in batch mode simulation. 2021-09-29 20:29:36 +02:00
Holger Vogt 5d116d1fb9 command listing: add option r (runable)
listing r > $inputdir/mycirc_runable.cir
will save the expanded netlist without line numbers,
ready to be sourced again and run in ngspice.
2021-09-29 20:29:26 +02:00
Keno Fischer 174f3d9cf9 Add missing rule for ngicon.rc 2021-09-29 20:29:13 +02:00
Brian Taylor 36313d59f3 Use the current point number as the single digit index for Cider 2D ascii save files. This conforms to the normal usage with other types of ascii rawfile. The numd parser table entry for ic.file now has the correct IF_STRING type. 2021-09-29 20:28:59 +02:00
Holger Vogt 3cf6857cfc Fix bug #557
Revise memory allocation for different analysis types
2021-09-29 20:28:43 +02:00
Holger Vogt 601287e949 Check V and I lines for dc and ac.
Allow ac without parameters, a default is set to ac ( 1 0 )
2021-09-29 20:28:15 +02:00
Brian Taylor 81df6ed772 Retaining the mixed case of Cider quoted string valued parameters. Limit searches for ic.file to D*, M*, and Q* device instantiation lines. Cider model (numos, numd, nbjt) detection is limited to .model lines. Continuation lines which do contain these tokens are not checked, but this should rarely happen. All of the examples/cider circuits meet these assumptions. Memory errors have been removed. 2021-09-29 20:27:29 +02:00
Holger Vogt 3599c189b6 re-enable lower-casing of tokens beginning with 'cd',
except for command 'cd' which is usually followed by a space.
2021-09-29 20:27:05 +02:00
Holger Vogt 0266bd5894 make PTparse error message more verbose:
include point in a line where parsing failed.
2021-09-29 20:26:42 +02:00
Brian Taylor abad190b38 Don't search for ic.file within comments. 2021-09-29 20:23:26 +02:00
Brian Taylor b3a99f0c6c Do not use non-portable strcasestr. 2021-09-29 20:23:08 +02:00
Brian Taylor 663a79dea8 Fix NAN error in numd2 area report and crashes when a doping file is missing. Update examples/cider so that the test circuits all run; add case sensitivity tests for rootfile and ic.file parameter strings enclosed in a single pair of double quotes. 2021-09-29 20:22:56 +02:00
Holger Vogt 68c5eb2d6b Add resistance sweep error message for failing optran 2021-09-29 20:22:34 +02:00
Holger Vogt 8708b6651b Optran may throw an error message while in temp sweep
and optran fails: message added (in addition prevent a crash)
2021-09-29 20:22:15 +02:00
Holger Vogt 1b3e192bfd errno needs to be nulled in Linux.
Its previous value will be returned after checking.
2021-09-29 20:21:39 +02:00
Holger Vogt e84c210876 'Option interp' and command 'stop' have been incompatible.
Allow both in a run.
Issue note (however not checked) that stop time data have to fit
the inpolated times.
2021-09-29 20:21:23 +02:00
Holger Vogt e35e3e3b33 prevent a crash, e.g. when incompatible 'option interp'
is set and 'stop' is called.
2021-09-29 20:20:52 +02:00
Holger Vogt a180eb60d5 command 'wrnodev'
Write current node voltages to file in format .ic=value
The file may be used to set initial conditions for another simulation,
e.g. ac at a specific time step of a transient simulation.
2021-09-29 20:20:27 +02:00
Holger Vogt 7f4fc2948b Add a line feed to make message more readable. 2021-09-29 20:20:00 +02:00
Holger Vogt fac1d3a79c ASRC (B-Source) error message is cryptic, as it does not tell
which B-Source failed.
Add a hint to the ASRC error message on the name of the
B-Source instance.
2021-09-29 20:19:38 +02:00
Holger Vogt 18478380ad Revise the SOA and add new parameters:
pd_max id_max idr_max te_max rth_ext derating
rth_ext is currently not used
2021-09-29 20:17:55 +02:00
Holger Vogt 3f322e1954 Add a check for sys/sysctrl.h, which has been declared deprecated,
and which may not be available (in the future) on some systems.
2021-09-29 20:17:23 +02:00
Holger Vogt 3b245ddd82 VDMOS, prepare SOA with new parameters
Model parameters pd_max, id_max, idr_max, and te_max
(power dissipated, drain current, drain reverse current, temperature)
2021-09-29 20:17:03 +02:00
Holger Vogt 4a1f7f950c spinit: add optran to the standard inits 2021-09-29 20:16:09 +02:00
Holger Vogt 7c84e3f993 SOA for bipolar
Replace pow_max by pd_max
2021-09-29 20:15:41 +02:00
Holger Vogt f06496c912 Enable command 'optran' in spinit or .spiceinit,
when the circuit is not yet loaded.
Then the optran data are stored in static variables,
until optran is called again with arg NULL from inp.c,
to set the data in ft_curckt->ci_defTask.
2021-09-29 20:15:13 +02:00
Holger Vogt a225ce2aaf List definition needs spaces between ( and next token,
and between token and )

Update to comment.
2021-09-29 20:14:45 +02:00
Holger Vogt 493cf73f7f optran is only selected when the 'optran' command has been processed.
If not, the call to the OPtran() function returns the previous
'converged' value.
2021-09-29 20:12:52 +02:00
Holger Vogt 7f1fdd3934 Don't do optran, if command optran is not given. 2021-09-29 20:12:31 +02:00
Holger Vogt 711157e85d Update comment: 0 is no initial iteration 2021-09-29 20:12:03 +02:00
Holger Vogt f0cb886af1 Add command 'write_ic'
Write out the right hand side status of the matrix in format
    .ic = V(node_xx)
    This may be possible at the end of a simulation or after a 'stop'
    of the simulation, which may be resumed again afterwars. This
    status may be used to start another simulation with these
    parameters by inluding into the netlist.
2021-09-29 20:11:45 +02:00
Holger Vogt 0e72287af7 Add command 'write_ic'
Write out the right hand side status of the matrix in format
.ic = V(node_xx)
This may be possible at the end of a simulation or after a 'stop'
of the simulation, which may be resumed again afterwars. This
status may be used to start another simulation with these
parameters by inluding into the netlist.
2021-09-29 20:11:13 +02:00
Holger Vogt 2ef3f66f96 if 'set ngdebug' print out transient initial conditions also with UIC set. 2021-09-29 20:10:25 +02:00
Holger Vogt 41ead284f3 make the error detection work properly 2021-09-29 20:10:02 +02:00
Holger Vogt 4e03efacb7 Use InpEvaluate() instead of strtod to enable ngspice numbers
with scale factors Meg k m u n p f etc.
2021-09-29 20:09:22 +02:00
Holger Vogt 3be5926f2c Reverse stepsize and finaltime in optran command,
stepsize first as in tran command.
2021-09-29 20:08:51 +02:00
Holger Vogt bca099ca29 prevent crash if first breakpoint is beyond optran max time 2021-09-29 20:08:28 +02:00
Holger Vogt b07a54b8e1 test of supply ramping 2021-09-29 20:07:42 +02:00
Holger Vogt 7de526237e upon finishing 'optran', restore old CKTstep
remove unused
2021-09-29 20:06:35 +02:00
Holger Vogt 0eafec254e safeguard command 'optran' against circuit no being loaded 2021-09-29 20:05:56 +02:00
Holger Vogt cf61e1e564 add missing header 2021-09-29 20:05:28 +02:00
Holger Vogt 83e223fafc header for optran 2021-09-29 20:05:08 +02:00
Holger Vogt a20afc54a5 When we sre ready, reset CKTmaxstep to its previous value 2021-09-29 20:04:26 +02:00
Holger Vogt 3956095484 set maxstepsize to stepsize 2021-09-29 20:04:08 +02:00
Holger Vogt ecdb3b9eb4 set the task values, not the ckt values,
because task is called only afterwards when
the simulation command is given.
2021-09-29 20:03:31 +02:00
Holger Vogt fd36eb552f set stepsize 2021-09-29 20:02:11 +02:00
Holger Vogt ab6224767b Add command 'optran' to set 6 flags for transient op 2021-09-29 20:01:44 +02:00
Holger Vogt df0792818f Transient op calculation added to the standard operating point code.
When standard iteration, gmin stepping and source stepping fail,
try a transient simulation (like tran with uic option) to
determine the op. Implemented for AC and Tran simulation.
2021-09-29 20:00:29 +02:00
Holger Vogt a08e6a0676 Add new SOA parameters (safe operating area) for BJT.
We now scan for max of Ic, Ib, power, taking into
account the max allowed temperature, using the thermal
resistance rth0 model parameter between juntion and ambient.

Two user options are there: If rth0 is given, we calculate
a derating of the max power allowed.
Without a constant max power according to model param pow_max
is assumed.

The new model parameters for the bipolar model are:
pow_max, ic_max, ib_max, te_max, and rth0, in addition
to the already existing vbe_max, vbc_max, adn vce_max.
2021-09-29 19:59:58 +02:00
Holger Vogt 1084b4205c Allow global .temp in addition to instance parameter 'temp'.
Update to comments.
2021-09-29 19:59:28 +02:00
Holger Vogt 9221df234c Patch to allow (and ignore) leading or trailing commas
when putting {} around tokens. Tested with PWL voltage source.

Patch has been suggested by Liqian Zhang
2021-09-29 19:58:36 +02:00
Holger Vogt 33571877dc Some update to SOA for a diode:
Limit output to four digits
Add power and temperature limits.
Derating with self-heating, or with fixed temperature,
or no derating at all, selectable by setting model parameters.
Example file: SOA plotted as frame, with diode current.
2021-09-29 19:58:11 +02:00
Holger Vogt 759f4f5f84 Make the output a little more verbose:
add terminal voltage to Id, Te, and Pd outputs.
Compare SOA data to terminal voltage, not (unknown) junction voltage.
2021-09-29 19:57:54 +02:00
Holger Vogt 9c8380a031 Enhance the SOA (safe operating area) operations
Parameters id_max, pd_max and te_max have been added
for current, power, and temperature to the already existing
fv_max and bv_max (max forward and backward volteges).
2021-09-29 19:57:34 +02:00
Holger Vogt e5fdb4c742 Patch sorts 1 byte vars in sequence,
to save some memory.
Patch #107 provided by Florian Ballenegger
2021-09-29 19:57:08 +02:00
Carsten Schoenert 2c2e21a80c Smal typo fixup s/currntly/currently 2021-08-08 11:56:30 +02:00
Holger Vogt 605f59b417 Fix a bug with the alter statement
lower case for device name, when sent from shared ngspice
or from interactive mode.
2021-08-08 10:21:22 +02:00
Holger Vogt 9a2d968577 When transferring boolean data over the ABI, keep them as boolean types, not integer
Replace the type of all boolean variables around the ABI by NG_BOOL.
NG_BOOL is typedefed to _Bool, when compiling shared ngspice. When
sharedspice.h is use externally NG_BOOL is typdefed to bool
2021-08-03 15:57:58 +02:00
Carsten Schoenert 61b5c0563b src/Makefile.am: Adopt used variables for lib versioning
A small adjustment so the configured ABI version from configure.ac will
get used for creating the libngspice library.
2021-08-03 15:56:02 +02:00
Holger Vogt 4258fe94b5 Add library versioning according to
https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html#Libtool-versioning
Add package versioning with m4 macros
2021-08-03 15:55:16 +02:00
Holger Vogt 6aac403ab0 XSPICE delay: add some more safeguards 2021-08-03 15:53:42 +02:00
Holger Vogt 4feb43e067 Prepare ngspice-35 2021-07-22 20:38:08 +02:00
Holger Vogt 4dbd8b7f9a Preliminary fix for the 'interpolate' function.
Interpolation of 1D vectors is o.k. now,
multi-dimensional vectors are not (yet) supported.
2021-07-22 20:37:57 +02:00
Holger Vogt 1977128380 Prevent crash when CIDER diode models are used.
There is no third node in NUMD or NUMD2, so don't set
GENnode(fast)[i]. This patch fixes a bug introduced in
4895a4b5a ("Diode model with selfheating option", 2021-04-11)
2021-07-20 14:24:43 +02:00
Holger Vogt 9cc9c56cad Don't write past '\0', fixes a bug in commit
1c5e0d11d ("If there is a XSPICE code model .model line with
file input, keep quotes and case for the file path.", 2021-07-15)
2021-07-18 11:19:51 +02:00
Holger Vogt b7473a33a0 Check for double '{', replace the inner '{', '}' by '(', ')'
in .subckt or .model (which both may stem from external sources)
2021-07-18 10:29:16 +02:00
Holger Vogt 85b07e35bf Fixes bug 483
prevent crash when surface mobility (surfmob) has been
selected in 2D simulation.
The patch is provided by Brian Taylor (see
https://sourceforge.net/p/ngspice/mailman/ngspice-devel/thread/e6e921a3-677c-f513-7410-df8568c4bdad%40comcast.net/#msg37318450
)
2021-07-16 10:53:07 +02:00
Holger Vogt 1c5e0d11dd If there is a XSPICE code model .model line
with file input, keep quotes and case for the file path.
2021-07-16 10:52:54 +02:00
Holger Vogt 15a3ed87c0 Enable the m parameter in E, G, B, R behavioral source/devices 2021-07-16 10:52:21 +02:00
Holger Vogt 973a60b898 re-enable making the old help system for Linux/Cygwin
by --enable-help --enable-oldapps
2021-07-08 15:34:41 +02:00
Holger Vogt d34d1e7c7c Get immediate response into text window,
when requesting information on coordinates.
2021-07-07 19:50:50 +02:00
Holger Vogt 182a4d3f5f WinGUI: Push any remaining error message into text window
before emitting interactive error message window and exit.
2021-07-07 19:50:37 +02:00
Holger Vogt ae72677cc2 Remove a false read when curr_line has
already been invalidated.
2021-07-05 19:43:25 +02:00
Holger Vogt 0f25c25c7e Remove a memory leak
Make inp_rem_levels non-static
and use it to remove 'root' after it has been used.
2021-07-05 19:42:14 +02:00
Holger Vogt 54cbfb4138 Nodedamping: Make difference independent of the sign
of the difference
2021-07-05 14:32:57 +02:00
Holger Vogt c74321e0f5 JFET2: Add a link to literature 2021-07-05 14:32:47 +02:00
Holger Vogt 93ddc7a3eb Enhancement for E source with table, convert to B source with pwl:
Add G source
Allow 'table' also being part of a parameter name like 'table_something'
2021-07-05 14:32:34 +02:00
dwarning 0ece04cdc8 Add channel type determination belong nmos/pmos model parameter 2021-07-05 14:32:14 +02:00
Holger Vogt fe158341ba Don't show message for every iteration 2021-07-05 14:31:47 +02:00
Holger Vogt c38b8e3615 Fix a bug in the 'dc' progress report 2021-07-05 14:31:32 +02:00
Holger Vogt 8eeb924460 CIDER: Enable printing either binary or ascii data output to file.
Patch provided by Brian Taylor, see
(https://sourceforge.net/p/ngspice/mailman/message/37309841/)
2021-07-05 14:31:21 +02:00
Holger Vogt 9bb401d9cd Add a 'qsort' dummy according to current compiler standards.
Detected during the very rare condition of not finding a 'qsort'
during the ./configure step.
2021-07-05 14:31:08 +02:00
Holger Vogt 76eac5aa0f Make error message more verbode 2021-07-05 14:30:35 +02:00
Holger Vogt a4be66b9b0 Prevent crash if there is bad syntax in h, g, e, or f line 2021-07-05 14:30:26 +02:00
Holger Vogt 31fbf910af Crash when trying to delete root and netlist:
Revert the order of deletion: Firstly the root, then the netlist.
2021-07-05 14:30:08 +02:00
Holger Vogt 858689d206 Make syntax check for nesting of .subckt ... .ends more verbose:
Try to find out where .subckt/.ends may be doubled, or missing.
2021-07-05 14:29:50 +02:00
Holger Vogt 52b5e218c7 Add '\f' to characters to be replace by '+'
during the syntax check of an netlist input file.
2021-07-05 14:29:35 +02:00
Holger Vogt c061747f19 Add evaluating and using temp and dtemp
as ASRC instance parameters.
2021-07-05 14:29:10 +02:00
Holger Vogt ddcc6f6097 add a comment: we should use TNOM, but not a fixed 300.15.
TNOM still has to be added to the ASRC parameters.
2021-07-05 14:28:51 +02:00
Holger Vogt dcde7b590e Don't put brackets around dtemp and temp, when they denote
instance parameters and thus are on the left hand side of '='
2021-07-05 14:28:39 +02:00
Holger Vogt 945786fba7 Make PTcheck more verbose:
Send error message containing failed expression
2021-07-05 14:28:19 +02:00
Holger Vogt 7e01b800f0 add the parameter name to error message of missing or bad parameter 2021-07-05 14:28:07 +02:00
Holger Vogt 7eb791fe00 No parse tree submitted to IFeval:
Prevent segfault and emit error message
2021-07-05 14:27:46 +02:00
Holger Vogt 19abc83312 Make the choice of last commit mor obvious 2021-07-05 14:27:23 +02:00
Holger Vogt 87a9d87f7d Replace identifier by func not only after '=', but also '{'
Extension to commit
61e48f984 ("Start replacing identifiers by func only after the first '='", 2021-06-18)
2021-07-05 14:26:57 +02:00
Holger Vogt 68e51848a4 logic condition to check only 'x' lines had not been given 2021-07-05 14:26:46 +02:00
Holger Vogt d0ca6a4773 Start replacing identifiers by func only after the first '=' 2021-07-05 14:26:21 +02:00
Holger Vogt 36069467fb Clarify that 'scale set to ...'
is not a query, but a statement
by 'scale is set to ...'..
2021-07-05 14:25:49 +02:00
Holger Vogt 5d1dfdf34e Fix a comment 2021-07-05 14:25:26 +02:00
Holger Vogt 06136d2d02 Set the default line width for grid and graph to 1.
0 is possible but seems to be too thin for reasonable plots.
2021-07-05 14:25:13 +02:00
Holger Vogt 028dd0ab88 Remove unused
Add a delay of half a time step to reduce error
2021-07-05 14:24:46 +02:00
Holger Vogt abc6eb56f3 Plausibility checking
Enforce out=in when delay == 0
2021-07-05 14:24:29 +02:00
Holger Vogt fbab9a0fe2 Add an analog delay source for transient simulation
Internal circular memory of size tstop/tstep or user defined.
(aprox.) every tstep a value is stored.
Delay time in multiples of tstep, by control voltage or user defined.
Dc or ac sim will simply connect input to output.
2021-07-05 14:24:06 +02:00
Holger Vogt 0d2d034eb2 Add devices s and w to previous commit.
R and C are not yet covered here, due to the many
varieties available.
2021-07-05 14:23:52 +02:00
Holger Vogt c033298db9 Don't replace a device model name by a parameter, if both
have the same names.

This is an extension to commit
7706889a0 ("inpcom.c, fix bug no 384 do not quote fourth
token in f, h lines otherwise if dev name equals param
name parsing fails", 2018-12-08)

Fixes bug 327 reported by T. Edwards at
https://github.com/google/skywater-pdk/issues/327
2021-07-05 14:23:23 +02:00
Holger Vogt 03517ae86c Define the function DevFinalize as used in the previous commit. 2021-07-05 14:22:55 +02:00
Holger Vogt 5e8ae680db Don't do gr_redraw twice (for non-X11 is already
done in gr_resize)
Add a function DevFinalize() to add the closings in SVG or PS
files ("/> or "stroke"), when files are generated by the
plot window in MS Windows.
2021-07-05 14:22:33 +02:00
Holger Vogt a6079781ea Fix previous commit, enable name upgrade for Linux and other non-Win OSs 2021-07-05 14:22:10 +02:00