Commit Graph

7554 Commits

Author SHA1 Message Date
Holger Vogt deb3cd9809 Replace all BOOLEAN, BOOL, _Bool by bool
Remove all #undef bool (set in conjunction with #iclude <Windows.h>)
2024-12-15 10:25:28 +01:00
Giles Atkinson 932ef50cc3 Improve two error messages: in d_cosim, report the filename given,
not the last one tried; and report attempted use of iplot or
tclplot in batch mode only once.
2024-12-06 22:50:37 +01:00
Giles Atkinson 721aab9624 Fix a bug reported by Tom Hajjar with title "XSPICE d_osc usage" in
Help, 2024/12/5.  Also correct the timing of the request for the next
call and modify a constant to make the method more robust.  To support
the main change, cm_analog_set_temp_bkpt() now reports when a breakpoint
request is ignored, and T(x) values are set before an EVENT call.
2024-12-06 22:50:25 +01:00
Holger Vogt 68228ca33f Improve comments 2024-12-06 22:49:55 +01:00
Holger Vogt 660b183ad0 Revise check for '.probe alli' and event nodes:
Bail out, don't run any sim, don't change variable
'auto_bridge'.
2024-12-06 22:49:40 +01:00
dwarning 54865ed39d bring the KLU_malloc() in right order, ticket #717 2024-12-06 22:48:56 +01:00
Holger Vogt 4eec6eb8e2 Fixes bug 723
New lines had been inadvertently written into the .control section.
2024-12-06 22:48:44 +01:00
Holger Vogt 2db9533380 Enable strings as parameters across subckt boundaries
by keeping the quotes and excluding {} around the string token.
2024-12-06 22:48:15 +01:00
dwarning 07994ff225 VDMOS: concatenate inner node name 2024-12-06 22:45:48 +01:00
Brian Taylor 6500caeba1 Now that checks on actuals and formals have been fixed for X* instances, some older PSpice libraries will not translate correctly in psa mode. This commit removes unnecessary power and ground nodes from X* instances of subcircuits where the nodes are optional. These X* instances occur within the body of another subcircuit which is being translated. MicroCap libraries that we can translate in ngspice do not have such cases. To enable the removal of the power and ground nodes, set ps_global_tmodels=1 in .spiceinit. This is not set by default since an extra pass through the circuit word list is necessary to find the subcircuits whose instances do not require power and ground node removal. Without enabling this feature, errors reporting too many parameters may be reported. 2024-12-06 22:45:13 +01:00
Giles Atkinson 5980869040 Apply Patch #119 -
"Fix buffer overflow in src/xspice/icm/digital/d_state/cfunc.mod".
The change is not identical to the supplied patch. It was slightly
modified to make the original code more sane.
Found and patched by Artem Sinkevich.
2024-12-06 22:44:36 +01:00
Giles Atkinson abc3fceb7e Enhance sensitivity analysis with an option to choose the parameters
to be varied.  Shell-style wildcards ("*?") are supported.
2024-12-06 22:44:06 +01:00
Giles Atkinson c30bc423ba Initial fix for Bug 710 -
"The log file appears blank when a VDMOS element is added".
The problen was caused by a crash during sensitivity analysis
caused by selecting parameters for wariation based on their
values.  That is not repeatable between passes.  The fix is to
remove that code, but it causes many more parameters to be used.
2024-12-06 22:43:53 +01:00
Holger Vogt 7d59ad2db7 Create extra name derived from node name, but with / replaced by _,
to become part of the new voltage source name: avoid names
which are not parsed correctly by the B source equation parser.
2024-12-06 22:43:26 +01:00
Holger Vogt a45c1500a6 Remove 512 char limit of sourcepath variable.
Make attaching new path more efficient.
2024-12-06 22:43:00 +01:00
Holger Vogt 3d7dbc0124 Update to
a43c6f491 ("Add #define RESMIN 1e-6 as a minimum resistor value", 2024-07-12)
Remove bug with TL071 model.
2024-12-06 22:42:35 +01:00
Holger Vogt 22b4f4e632 Re-enable detection of over- or underflow of number of nodes
when calling a subcircuit.
Update to commit
c12296182 ("The code in src/frontend/subckt.c has a
fixed-size structure called table at the top with a
size set to N_GLOBAL_NODES = 1005.  If the number of
items passed in formal and actual exceeds 1005, then
ngspice exits immediately with an error.", 2023-03-14)
2024-12-06 22:42:16 +01:00
Holger Vogt 33ef1fc876 typos 2024-12-06 22:41:43 +01:00
Holger Vogt 8c806912d0 Improve convergence in Infineon Power MOS.
0**something is 0
2024-12-06 22:41:18 +01:00
Giles Atkinson b48224e514 Improve the behaviour of ngspice when run in the background on a
Unix-like OS with job control.  The progress ticker is suppressed
for a command like "ngspice some_circuit.cir &" so the terminal
remains usuable while the simulation runs.
2024-12-06 22:40:55 +01:00
Giles Atkinson 4feb0c3ccc Remove function cp_ccon() and related code. The function modifies
the terminal driver's treatment of the control-D (EOF) and escape
keys on Unix-like OSs.  But escape has no special meaning, and treating
control-D as a line terminator was probably to prevent unexpected
session exit when connected through a modem without error-correction.

Removing the function allows "ngspice netlist &" to work correctly.
The function was called during initialisation, which caused an endless
loop of job-control stops when ngspice was started as a background process.
2024-12-06 22:40:38 +01:00
Giles Atkinson 562466a3c5 Three minor code improvements. Remove a redundant test in com_measure2.c.
In vectors.c, always initialise a newly-created plot exactly once.
Improve an error message in spiceif.c.
2024-12-06 22:40:21 +01:00
Giles Atkinson fb63573b6b Fix processing of lines like: "*# pre_some_command ...". 2024-12-06 22:40:08 +01:00
Brian Taylor 75c2811fa9 Fix some memory leaks. 2024-12-06 22:39:49 +01:00
Holger Vogt a2b8b0d733 In batch mode: if transient simulation fails with 'Timestep too small',
still fill in the number of points in the raw file.
Fixes bug no 714.
2024-12-06 22:39:34 +01:00
dwarning 6381c51ee1 relative time differences needed - not to prgm start time 2024-12-06 22:39:21 +01:00
dwarning 02abb65c59 rm obsolete #ifdef HAVE_QUERY in windows block 2024-12-06 22:39:06 +01:00
dwarning 3d20dc0da7 format - white spaces 2024-12-06 22:38:26 +01:00
dwarning bf6ffd357d Keep it simple: use only one structure and get_time function 2024-12-06 22:38:16 +01:00
dwarning 60554855d8 seconds() gives difftime to program start, lower priority for getrusage() and times() 2024-12-06 22:38:00 +01:00
Holger Vogt 26f2fec689 seconds() no longer supports a time difference, so create it locally. 2024-12-06 22:37:51 +01:00
dwarning 821733a5f6 suppress compiler warning 2024-12-06 22:37:39 +01:00
dwarning 40aa445ee8 unify os dependent time code in one file - rm win_time.c 2024-12-06 22:37:30 +01:00
Holger Vogt 5000e0d57a Fix a bug: AF and KF had been interchanged. 2024-12-06 22:37:06 +01:00
Holger Vogt 5d47c9b696 Add AF and KF: error messages in commands 'showmod' or .sens are gone. 2024-12-06 22:36:11 +01:00
dwarning 7b815c743e intel cc see obsolete }; as empty declaration 2024-12-06 22:35:49 +01:00
dwarning 3faed1647a Reorder and renovate timer functions taking into account ngspice multiprocessor capabilities
by using available high performance functions first.
Deprecated ftime() still acts as a backup function.
Solution is portable for today's operating systems and compilers.
2024-12-06 22:35:02 +01:00
Holger Vogt 2b89d2a1cd Add function ngSpice_nospiceinit(void) if you don't want to read .spiceinit 2024-11-02 22:46:49 +01:00
Holger Vogt 7ac92bb9fc Bail out when the number of s parameter ports is less than 2. 2024-11-02 22:46:39 +01:00
Holger Vogt 60ddad4983 Make the resistor name unique for a device with multiple unconnected nodes 2024-11-02 22:46:20 +01:00
Holger Vogt 70b407d835 Improve error message during setup of TXL or CPL 2024-11-02 22:46:01 +01:00
Holger Vogt 793fca6e2a If preprocessing is skipped, we still need the number of lines in the deck. 2024-11-02 22:45:45 +01:00
Holger Vogt 8e05683592 Prevent crash if number of lines is wrong/not available ... 2024-11-02 22:45:35 +01:00
Brian Taylor 5079b42f26 Fix bug 483 again. Faulty merges of KLU changes for cider were
introduced in ngspice 42. These broke the fix.
2024-11-02 22:45:11 +01:00
Holger Vogt 20d6fb460f Add a comment 2024-11-02 22:44:56 +01:00
Holger Vogt e2c4182888 Vectors Cy_xxx are of type 'current'. 2024-11-02 22:44:43 +01:00
Holger Vogt c716e34425 Use the correct type for each vector after S-parameter analysis.
Cy_1_1 is still missing (voltage as default).
2024-11-02 22:44:34 +01:00
Holger Vogt de7ae6e678 Fix bug 711 reported by Sonia Edward 2024-11-02 22:44:21 +01:00
Holger Vogt 3d6d0d880a Improve comment 2024-11-02 22:44:11 +01:00
Holger Vogt 27db91480b Fix bug no. 708, reported by Philip Sauvage. 2024-11-02 22:43:57 +01:00
Árpád Bűrmen 16798edb36 Minor change. 2024-11-02 22:43:35 +01:00
Árpád Bűrmen 5f8ab0eb67 Minor change. 2024-11-02 22:43:28 +01:00
Árpád Bűrmen 9d2e2f77c0 Minor change. 2024-11-02 22:43:22 +01:00
Árpád Bűrmen b40dcaa18d OpenVAF-reloaded compiled model support. 2024-11-02 22:43:06 +01:00
Holger Vogt 368c59466b Allow plotting a single point in an ascii plot
(command .asciiplot)
2024-11-02 22:42:42 +01:00
Giles Atkinson e3f7cf3e0a Fix Bug #698 -
"Initial transient solution assumes voltage source=0 even if it is not."
Cause was another error in ad5bb9eb8d, fix for Bug #607, which uncovered
an earlier latent bug.
2024-11-02 22:42:22 +01:00
Giles Atkinson 537d55d80b Improve an error message. 2024-11-02 22:42:12 +01:00
Giles Atkinson cf812da363 Try to clarify the mechanism of parameter substitution and add
an example of substituting an XSPICE vector parameter.
2024-11-02 22:41:59 +01:00
Brian Taylor e130371410 Added: Error: Pole/zero analysis is not (yet) supported with 'option KLU'.
Use 'option sparse' instead.
2024-11-02 22:41:42 +01:00
briantofleeds 09d352be12 This does not fix noise analysis with klu.
It does add missing { and } when event-driven instances are not present.
Without this change CKTop will always be called again directly in NOISEan even
if CKTop was previously called by EVTop. This matches the intended
behavior before #ifdef KLU was added.
2024-11-02 22:41:21 +01:00
Holger Vogt b350786c48 Some cosmetics 2024-11-02 22:40:54 +01:00
Holger Vogt bafa3ff8a3 Revert the sign of ac_gain.real
Fix bug no 697, reported by Matthieu Guerquin-Kern
2024-11-02 22:40:43 +01:00
Alessio Cacciatori f300154922 Insert correct conversion sections for KLU matrices 2024-11-02 22:39:50 +01:00
Holger Vogt 2129ac26fd Add optional series resistance or junction capacitance, if non
is defined in the .model statement. This may help achieving
convergence if subcircut models of opamps etc use simple diodes
as voltage limiters. Example call:
.options diode_cj0=20p diode_rser=20m
2024-11-02 22:39:24 +01:00
Holger Vogt d5f0c6598f Fix commit 09685dde1
("Set lower case for variables or vectors in command 'echo'.
Tokens starting with '$' will get lower-casing.", 2024-09-07)

Don't use s as name for temporary string, as s has been set
already and is used later.
2024-11-02 22:39:03 +01:00
Holger Vogt b62528d7e5 Set lower case for variables or vectors in command 'echo'.
Tokens starting with '$' will get lower-casing.
2024-11-02 22:38:49 +01:00
Francesco Lannutti 419e821a09 Fixed KLU conversion to complex for SP Analysis 2024-11-02 22:38:03 +01:00
Holger Vogt 287280c3db Make error messages more verbose:
add line number and source file name.
2024-11-02 22:37:47 +01:00
Holger Vogt bce621680b Add line number and source file to some error messages 2024-11-02 22:37:31 +01:00
Holger Vogt 8e8716abc7 Fix warning message 2024-11-02 22:37:12 +01:00
Holger Vogt c2c35b56a4 More on verbose error and warning messages 2024-11-02 22:36:46 +01:00
Holger Vogt 4e6af5a55f Allow KiCad special token V(/xyz) by quoting 2024-11-02 22:36:26 +01:00
Holger Vogt c33fd66a21 Make error messages more verbose:
add line number and source file name.
2024-11-02 22:36:11 +01:00
Brian Taylor 3528156d14 Fix bug #680. Check that src/dest memcpy arguments are non-NULL. 2024-11-02 22:35:57 +01:00
Matthias Schweikardt 8fbd357fdd extend bsim4 operating point info list 2024-11-02 22:35:10 +01:00
Holger Vogt 123ed0aada Add simulator version info to raw file ('write' commad)
using an extra line 'Command: ...').
The old sequence (adding commands manually to raw file) is
still available.
The 'Command: anycommand' will not be executed if loading
an ngspice-generated raw file. Raw files from other simulators may
generate a warning that the command is not available.
2024-11-02 22:34:59 +01:00
Holger Vogt 1087c6a0c2 Add simulator version info to raw file in batch mode,
using the line 'Command:...'
2024-11-02 22:34:41 +01:00
Giles Atkinson 14844af175 Fix #686: "XSpice Verilog Vector Input Bug".
Bug report and fix by Aodhan Murray.
2024-11-02 22:34:23 +01:00
Holger Vogt 5f059abdca Improve debugging using shared ngspice:
print out each command received.
2024-11-02 22:34:05 +01:00
Holger Vogt f495431509 Add a comment 2024-11-02 22:33:52 +01:00
dwarning 4cffcd96ce add missing klu bindings 2024-11-02 22:32:33 +01:00
Vogt 606c6d0df7 Notes go to stdout. 2024-11-02 22:32:14 +01:00
Vogt 232101af10 Don't dereference a NULL pointer. 2024-11-02 22:32:03 +01:00
Vogt 501a64470f Error and warning messages to stderr 2024-11-02 22:31:47 +01:00
Vogt 34549c4524 Note directed to stdout 2024-11-02 22:31:27 +01:00
Holger Vogt 4a1698c22d enable compiling with CYGWIN 2024-11-02 22:31:13 +01:00
Giles Atkinson f4c7202130 Fix gcc warnings. 2024-11-02 22:30:45 +01:00
Giles Atkinson 64a9a0bfbc Add a utility function to the d_cosim code model to open dynamic
libraries. It automatically tries adding standard file extensions,
so that model lines for d_cosim can be the same for all OSs.
2024-11-02 22:30:15 +01:00
Giles Atkinson ce1ecca15e Add support for including Verilog simulation within an instance
of the d_cosim codemodel, using libvvp, the simulation runtime of
Icarus Verilog.  This complements the existing method using Verilator.
The new source code is built into two binary shared libraries,
ivlng.so (or .DLL) and ivlng.vpi that are loaded during simulation.
2024-11-02 22:30:07 +01:00
Giles Atkinson 693a9df09f Add support for Verilator's --timing option, allowing use of delays
in Verilog source code.  Also add two parameters to d_cosim:
sim_args is used to pass string arguments to a Verilator simulation;
and lib_args is for future use.  In vlnggen, also check for two causes
of failure: a verilator error may lead to creation of interfering header
files; and misleading instances of verilated_shim.cpp can cause an obscure
failure (reported by Diarmuid Collins).
Use a generic name for the generated DLL in MSVC.CMD.
2024-11-02 22:29:54 +01:00
Giles Atkinson 4173d0e220 Allow trailing null connections to be omitted from XSPICE device
lines.  Also tidy some code,
2024-11-02 22:29:34 +01:00
Giles Atkinson 98076281c6 Changes to d_cosim to work with initial support for Icarus Verilog.
Fully resolve symbols on loading and tolerate attempts to set
output in the past.
2024-11-02 22:29:19 +01:00
dwarning 9c5507d1c8 vbic: have to load Vrxf/Itxf with value 2024-11-02 22:29:07 +01:00
dwarning 14402ea911 vbic: correct op reporting for excess phase model 2024-11-02 22:28:53 +01:00
dwarning 8c6fb7c5e0 format: rm misleading indentation 2024-11-02 22:28:39 +01:00
Holger Vogt 295be20859 Remove sourceinfo upon shared ngspice reset.
Remove memory leaks.
2024-11-02 22:28:21 +01:00
Holger Vogt a2ca4616b9 Memcpy only when p_word is not NULL
enable -fsanitize=address
2024-11-02 22:27:59 +01:00
Holger Vogt 28c501bfef Add #define RESMIN 1e-6 as a minimum resistor value 2024-11-02 22:27:44 +01:00
Holger Vogt a6240eed87 Stop the worker thread when running
Delete mutexes only after all other resets and delets.
2024-11-02 22:27:26 +01:00
Holger Vogt 250e9afd92 Set pl_lookup_table to NULL after freeing: allow another initialization 2024-11-02 22:27:08 +01:00
Holger Vogt fd72c3ce3e Bail out when state file is not found. 2024-11-02 22:26:53 +01:00
Holger Vogt d0ae65accf Add function ngSpice_Reset(void) to completely reset shared ngspice,
so that it may be restartet again by ngSpice_Init
2024-11-02 22:26:35 +01:00
Holger Vogt 4f8cfbf9f9 Update copyright 2024-11-02 22:26:20 +01:00
Mamoru TASAKA 099c0e65c2 misc/string.c: fix one byte ahead access in dup_string
In dup_string in misc/string.c , even if the destination
buffer is allocated with n_char bytes,
the source buffer `str` can be accessed up to only n_char bytes.
2024-11-02 22:22:06 +01:00
Holger Vogt a8c1104cfb 43+ developing towards ngspice-44 2024-11-02 22:21:51 +01:00
Holger Vogt 2af390f0b1 Update copyright info 2024-07-13 10:14:02 +02:00
dwarning 08d834841f diode: init of potential uninitialized variable 2024-07-12 14:26:53 +02:00
dwarning 4ad7d10aef init of potential uninitialized variables 2024-07-12 14:26:44 +02:00
dwarning bbfb3953ed repair missing parenthesis 2024-07-12 14:26:33 +02:00
dwarning aae53f3641 complete vbic nqs effect implementation 2024-07-12 14:26:18 +02:00
dwarning 065b1c817c more complete vbic dc/tran nqs effect 2024-07-12 14:25:04 +02:00
dwarning 6e6e2fb203 first attempt to include NQS effect 2024-07-12 14:24:50 +02:00
Holger Vogt 1fef3835c9 Fix common typo: unkown -> unknown 2024-07-09 14:50:21 +02:00
Holger Vogt 3c7012a826 Repair the link to the xhtml manual
Thanks to Geoffrey Coram for the hint.
2024-07-05 23:59:37 +02:00
Holger Vogt 83e8cb3715 Remove VS compiler warning 2024-07-05 13:53:04 +02:00
dwarning 62677575fa vbic: init of thermal capacitances 2024-07-05 13:52:56 +02:00
dwarning 113275d3be vbic: save Vrth into state vector 2024-07-05 13:52:45 +02:00
dwarning 1b56bbe297 vbic: complete reactive part into acload 2024-07-05 13:52:33 +02:00
dwarning 8a88442004 vbic: more adding reactive part into acload 2024-07-05 13:52:22 +02:00
dwarning 32c4f24bfe vbic: first add reactive part into acload 2024-07-05 13:52:11 +02:00
dwarning c90da3ee38 vbic: add resistive part into acload 2024-07-05 13:52:03 +02:00
Holger Vogt acdd93f157 If compiling shared ngspice, don't set up a terminal. 2024-07-01 09:42:58 +02:00
Holger Vogt 28d8301b5f Prevent crash upon buggy user input 2024-07-01 09:42:45 +02:00
Holger Vogt 442d8554f0 Enable single terminal n devices (Verilog-A modules) 2024-07-01 09:42:28 +02:00
Holger Vogt 727a920032 Authorship for HICUM 2024-06-24 17:21:50 +02:00
Holger Vogt 33939d3f50 Prepare ngspice-43 2024-06-22 17:06:45 +02:00
Holger Vogt 14bb63490c Plug a memory leak 2024-06-22 16:33:53 +02:00
Brian Taylor d01868b725 Cleanup gcc compiler warnings. 2024-06-22 14:23:50 +02:00
Holger Vogt b1795dbcf2 add path or filepath (without file name) to variable sourcepath,
when calling command 'source'
2024-06-22 14:23:41 +02:00
Holger Vogt fb6820de30 Send warning message to stderr, not to stdout. 2024-06-22 14:23:29 +02:00
dwarning 11a3711d86 revert commit ea4c438 and db85dead by removing VJ and M limiting 2024-06-22 14:23:13 +02:00
Holger Vogt dd6089c4fc Improved warning message: hint to line causing the warning. 2024-06-22 14:22:59 +02:00
Holger Vogt f15a92d997 Revise commit
75c2a3c621/
If the frquency difference is less than a decade, use the old
frequency calculation.
If start and stop frequencies are equal, use a single point only.
2024-06-22 14:22:38 +02:00
Holger Vogt d61a728688 Add function check_for_nodes to
check if there are enough tokens in an instance line.
2024-06-22 14:22:06 +02:00
Holger Vogt 0362953cd4 Bail out when the instance line is not complete.
Moving on does typically not make any sense.
2024-06-22 14:21:56 +02:00
Holger Vogt e5195c10a3 Enable monotonic negative growth of abscissa values. 2024-06-22 14:21:42 +02:00
Holger Vogt 32901f9d0c Error messages to stderr only.
For MS Windows: Make code model path absolute.
Call LoadLibrary only when *.cm file exists. Until now
spurious return from LoadLibrary prevented error message,
when *.cm was not found, followed by a crash upon 'quit'.
2024-06-22 14:21:28 +02:00
Holger Vogt fa5ac4a0cd When reading code models, allow only a single model pere command
(as was implicitely assumed anyway).
2024-06-22 14:21:15 +02:00
Holger Vogt 344beaad24 Add ft_spiniterror, to be set during spinit processing,as
ft_stricterror will be set only later, when .spiceinit is
executed.
2024-06-22 14:21:01 +02:00
Holger Vogt 36e7835afd Remove Valgrind "potentially undefined" message. 2024-06-22 14:20:44 +02:00
Holger Vogt 74fc096bfd Enable coupling of more than 2 inductots in a single line:
K1 L1 L2 L3 L4 L5 0.99
2024-06-22 14:20:33 +02:00
Holger Vogt a5bf93d04d 'No OP' is the more important news, update note to the user. 2024-06-22 14:20:15 +02:00
Holger Vogt ee39d678b7 Improve comment 2024-06-22 14:20:01 +02:00
Holger Vogt ace47103e7 Search path for .lib and .include has been enhanced to read complete
or partial paths from environmental variables. The env variable
names have to start with '$' as the first character after the .inc
or .lib token. Two consecutive env variables are possible. They are
read each until directory separator '/' or '\\', or if none is found,
until the end of the line. In this case the filename has to be included
in the env variable. A .lib line may look like
.lib "$ENVS1\$ENVS2/libraries\sky130_fd_pr\latest\models\sky130.lib.spice" tt

If an env variable is read successfully, a ngspice variable with
the same name (without leading '$') and contents is defined for
use in a .control section.
2024-06-22 14:19:48 +02:00
Holger Vogt 252ca65f56 Add '.save nosub' to suppress storing the node vectors from inside
of subcircuits.

Saves a lot of memeory if using devices with subcircuit models,
and one is not interested in the inner workings of the device model.
2024-06-22 14:18:25 +02:00
dwarning 02a5cd5ea6 mos1...3: set channel thermal noise to 0 in subthreshold range for nlev=3 2024-06-22 14:17:45 +02:00
dwarning f44a0ede08 mos1...3: logical error-prevent garbage for nlev=3 2024-06-22 14:17:36 +02:00
dwarning ac5470568c diode: no need for vte recalculation, rhs not changed 2024-06-22 14:17:28 +02:00
Holger Vogt 621918f289 Transform nested braces {{}} into {()} also in .param statements
(See TI PSPICE model for LMR33630).
2024-06-22 14:17:16 +02:00
Holger Vogt 2f5b869979 Issue this warning only when 'set ngdebug' is given. 2024-05-14 16:32:45 +02:00