Commit Graph

7833 Commits

Author SHA1 Message Date
Holger Vogt 84f87aeafd Improve error message by adding the sourcing netlist line 2026-03-20 10:31:34 +01:00
Holger Vogt 3fcfc4b989 Improve error message 2026-03-20 10:30:01 +01:00
Holger Vogt 81d3812db0 Add a user-settable variable measureprec to set the number of digits
when printing the measure outputs.
Internally this is a global variable measure_precision.
Enable all measure commands to recognize measure_precision when
printing an output.
Default value is 5 (yielding 6 digits after .?).
2026-03-20 10:28:28 +01:00
Holger Vogt 9ac5bda207 After an ac simulation, a tran measurement causes a segfault.
A check prevents this issue.
2026-02-03 22:38:56 +01:00
Holger Vogt 417c52ee5c Remove compiler warnings 2026-02-03 15:05:24 +01:00
Holger Vogt ab87bd57a4 Re-enable compiling with clang
Patch thanks to Gon Solo, issue 826
2026-02-03 14:25:18 +01:00
Holger Vogt afb17cb6c7 New analogue and digital device models from TI contain
the token GND in their subcircuit. Up to now ngspice has
declared GND as global and replaced it by 0.

Now, if PS is selected as compat mode, GND is not
declared as global, and is not replaced inside of a subcircuit.
2026-02-03 14:25:09 +01:00
Holger Vogt b25ff08307 Moving window filtering with function 'newvec = mtimeavg(vec)'
Window of fixed time width given by 'set mtimeavgwindow=400u'
Length and scale of newvec resembles the original vetor vec.
Large vec and large mtimeavgwindow take their time.
OpenMP is used if available.
2026-02-03 14:23:32 +01:00
Holger Vogt 84ce2b4084 Exclude B voltage source, whan '.probe alli' is used.
It already gets a bxx#branch for current measurement.
2026-02-03 14:23:22 +01:00
dwarning 1601571432 Correct vgs assignment - bug found by K. OHara 2026-02-03 14:23:14 +01:00
dwarning 23eafe9978 remove redundant definition and unused variable 2026-02-03 14:22:57 +01:00
dwarning 81894e0c52 Minor change that helps VADistiller. 2026-02-03 14:22:48 +01:00
dwarning 06aa4989a6 convert to lower case for spice2 input and remove few warnings 2026-02-03 14:22:37 +01:00
dwarning 48438ba736 rm ngnutmeg from build list of old apps 2026-02-03 14:22:29 +01:00
Holger Vogt cd6ca5e86a re-enable maling old app ngsconvert
ngnutmeg is still defect
2026-02-03 14:22:21 +01:00
dwarning 1841709eab more realistic default values for case to ambient thermal resistance and device transconductances 2026-02-03 14:22:02 +01:00
dwarning d3b0dc1b31 Adapt VDMOS Vth temperature coefficient to usual notation with - for nch and + for pch. 2026-02-03 14:21:50 +01:00
Holger Vogt 2e5772e35e Add the non-nqs PSP103 OSDI model to spinit 2026-02-03 14:21:24 +01:00
Holger Vogt 8737839f41 Add a function m3avg(vector) for filtering of trap ringing.
Moving average with D(n) = (C(n-1)/2 + C(n) + C(n+1)/2)/2
2026-02-03 14:20:08 +01:00
Holger Vogt 8d21c8e79b Make pred available always 2026-02-03 14:19:42 +01:00
Holger Vogt fe55cbe69f Enable optional voltage based truncation error correction.
This is selectable as 'option newtrunc' (--enable-Predictor is required)

Remove --enable-NEWTRUNC

Add three option parameters (default):
lteTrtol (500), lteReltol (1e-3), lteAbstol (1e-6)

Add new error function for TRAP, similar to GEAR
 (tentative, to be improved), in ckttrun.c

Enable PREDICTOR as default with Visual Studio.
2026-02-03 14:18:55 +01:00
Holger Vogt ab49ea9657 Fix tiny bug. 2026-02-03 14:18:29 +01:00
Brian Taylor 50c4272544 Add function to verify that subckt port directions are compatible with auto bridging. Use set ps_ports_and_pins=1 to see the port directions. 2026-02-03 14:18:17 +01:00
lorenzo 66797fdebc Fixes a memory corruption bug resulting from improper parsing
and accessing of array parameters in OSDI models
2026-02-03 14:17:59 +01:00
dwarning 89a25ac6c1 Diode sensitivity analysis: Exclude few parameters and add level 3 geometry parameter. 2026-02-03 14:17:42 +01:00
dwarning f2ef953246 Fix the overlap in state vector for sensitivity states of diode and bjt model. 2026-02-03 14:17:16 +01:00
dwarning eea3af64e2 KLU bindings for separate sw diode only if sw resistor is given 2026-02-03 14:16:59 +01:00
Holger Vogt 4958221e92 Update comment to cktnumstates 2026-02-03 14:16:48 +01:00
dwarning f52749afa3 Diode model level=2 (Fowler-Nordheim) is not supported. 2026-02-03 14:16:11 +01:00
Holger Vogt abdd936cb8 Add missing function prototypes 2026-02-03 14:15:52 +01:00
dwarning 96d0559631 This fixed #822 diode discontinuity problem
Base recombination current appears in reverse and breakdown region too.
2026-02-03 14:15:38 +01:00
dwarning 58d7ad791e Add optional switch for separate bottom and sidewall diode model - configuration is dependent from model parameter RSW
Further sidewall knee current parameter IKP is implemented.
2026-02-03 14:15:28 +01:00
Holger Vogt d7f5169b0d Re-formatting 2026-02-03 14:15:08 +01:00
Holger Vogt ee8bf7a948 Add a comment 2026-02-03 14:14:52 +01:00
dwarning f1378f2e5a general vdmos update 2026-02-03 14:14:35 +01:00
Holger Vogt 6304f0124b Remove unused functions from the IFfrontEnd struct. 2026-02-03 14:13:54 +01:00
Holger Vogt 83bf3ae46b Remove a double entry 2026-02-03 14:13:42 +01:00
Holger Vogt 6dfaf3f11c Enable guessing the vector type or SP analysis in batch mode. 2026-02-03 14:13:26 +01:00
Holger Vogt bc7d68884e Remove variable and flag 'use_numparams'.
Not using numparam has not been a supported option for the last 20 years.
2026-02-03 14:13:04 +01:00
Holger Vogt f3871c3ea2 Try to equalise the last two time steps before a breakpoint,
if the second step would be smaller than CKTdelta otherwise.
2026-02-03 14:12:38 +01:00
Holger Vogt 8172362529 Using cbrt() instead of exp(log...) might be more efficient 2026-02-03 14:12:20 +01:00
dwarning 6bd5c2d03b VDMOS: apply m scaling fix for acld as well 2026-02-03 14:12:10 +01:00
Árpád Bűrmen 2bc63e71ae VDMOS scaling fixed. 2026-02-03 14:12:01 +01:00
Árpád Bűrmen 804658601e Minor change in VDMOS that helps VADistiller. 2026-02-03 14:11:51 +01:00
Holger Vogt c896fed414 Update to commit
172fb6d66 ("Fix Bug 817 - "Global models are not visible from
with subcircuits". Remove code that can miscount the number of
nodes to be renamed.", 2025-10-08)
Keep checking for x lines with nesting. This re-enables
simulating large cxircuits (e.g. SRAMs) with deeply nested
subcircuit calls.
2026-02-03 14:11:34 +01:00
Holger Vogt 1ef57ffc42 Add a variable 'debug-out-short' to enable a shortened debug-out.txt,
useful when large circuits are monitored, which otherwise may result
in GigaBit size of data.
2026-02-03 14:11:12 +01:00
dwarning 5836f9c487 vdmos convtest needs type for vd - load hack not needed anymore 2026-02-03 14:11:01 +01:00
dwarning ce94dd1587 vdmos: in case temp and dtemp is given - use dtemp and omit temp 2026-02-03 14:10:39 +01:00
dwarning f9cd5f1471 correct gate and source resistor temperature update 2026-02-03 14:10:23 +01:00
dwarning 564a97e693 correct rthca connection 2026-02-03 14:10:07 +01:00
Holger Vogt 329343a31e Fix a bug. 2026-02-03 14:09:43 +01:00
Holger Vogt 89c03ca640 fix bug no 819, which has been introduced by
d5ef8a366 ("Remove all entries connected to IPC, an outdated (>30 years) method to link ngspice to a now defunct controller (ATESSE).", 2025-10-21)
2026-02-03 14:09:22 +01:00
Holger Vogt 31a8486c03 make nthreads local 2026-02-03 14:08:42 +01:00
Holger Vogt 6004d9aef9 Improve comments 2026-02-03 14:08:28 +01:00
Holger Vogt 4d24b18f35 Remove all entries connected to IPC, an outdated (>30 years)
method to link ngspice to a now defunct controller (ATESSE).
2026-02-03 14:07:59 +01:00
Holger Vogt 7fbb4450d4 Improve comments, add note to user. 2026-02-03 14:07:35 +01:00
Holger Vogt 48d28f9f4a Entries to old CLUSTER code removed. 2026-02-03 14:07:15 +01:00
Holger Vogt 4594d5fd91 Add variable deltacheck to measure the CKTdelta[0]
(most recent accepted delta time) versus simulation time.
Activated if 'set ngdebug' is given (not forget to set
'.save deltacheck' if other .save commands are given).
2026-02-03 14:07:02 +01:00
Giles Atkinson aa1242ac70 Add new functions for .param expressions. vec() takes a string argument
and fetches a vector value from the current plot or "const".  var() is similar
but fetches an interpreter variable.
2026-02-03 14:06:36 +01:00
Holger Vogt 5443385ae9 Another update on comments 2026-02-03 14:06:11 +01:00
Holger Vogt d49134df93 Small update on comments. 2026-02-03 14:05:46 +01:00
Holger Vogt 1f2a6f3665 document the goto labels. 2026-02-03 14:05:12 +01:00
Holger Vogt 58380ba1b8 Remove all entries related to CLUSTER,
an old, never finished attempt to run transient in parallel.
2026-02-03 14:04:50 +01:00
Holger Vogt 9fc4435dca Update on comments. 2026-02-03 14:04:36 +01:00
Holger Vogt 827e6ba7fb Add perror() to fopen: more info for user. 2026-02-03 14:04:15 +01:00
Holger Vogt 7fe6ab5424 Improve error messages. 2026-02-03 14:03:58 +01:00
Holger Vogt e4aacf352a Add breakpoints to achieve quadratic smoothing.
Shift 50%-detection for breakpoints into the INIT section,
to do it only once.
2026-02-03 14:03:31 +01:00
Giles Atkinson 87338b0b8a Fix Bug 817 - "Global models are not visible from with subcircuits".
Remove code that can miscount the number of nodes to be renamed.
2026-02-03 14:03:13 +01:00
Holger Vogt 68e8f43318 Re-enable warning note when rusage xxx is not implemented. 2026-02-03 14:02:52 +01:00
Holger Vogt 5fcbe3c6df Improve error message: add source type 2026-02-03 14:02:32 +01:00
Holger Vogt f84a72d1f8 Improve error messages. Towards better locating of errors:
Remove entry to avoid false file readings.
Still to do: Return correct fline numbers, when reading large PDKs.
2026-02-03 14:02:05 +01:00
Holger Vogt c4ae3b1243 Improve on truncation when printing out the .model lines during debug-out 2026-02-03 14:00:46 +01:00
Holger Vogt 76c4be60ce Add info for line source 2026-02-03 14:00:24 +01:00
Holger Vogt e277c886ef Improve reading the source code sequence by extra comments:
While searching for 'Parsing the circuit', the sequence of major
functions is revealed.
2026-02-03 13:59:59 +01:00
Brian Taylor a99ff45eaf Update and clarify the comments at the top of udevices.c, which should make it easier when someone in the future has to make changes. 2026-02-03 13:59:39 +01:00
Brian Taylor 71614dba3a Add a correction to the previous change of inppas4.c, which freed devname and left instance name pointers in DEVnameHash pointing at freed memory. This commit adds the devname string to the symbol tables which are eventually cleared by INPtabEnd. Also, if a capacitor in the spice netlist has the same name (unlikely, but possible) as a shunt capacitor, then no shunt is created, and a warning is issued. 2026-02-03 13:59:30 +01:00
dwarning 766c8d15e2 correct init state vector for qth integration 2026-02-03 13:59:17 +01:00
Holger Vogt 7d4cf5487d Typo 2026-02-03 13:59:03 +01:00
dwarning 3286651aca correct xoi and xom defaults to Angstrom and clarify comments 2026-02-03 13:58:53 +01:00
dwarning 8e1ba4d9e2 count level=3 model poly and metal capacitance in charge calculation 2026-02-03 13:58:43 +01:00
Brian Taylor e694983536 Fix memory leaks in INPpas4 and get_number_terminals found using paranoia_parallel. 2026-02-03 13:58:32 +01:00
Holger Vogt 7ea0ee9714 Add short description of code model 2026-02-03 13:58:21 +01:00
Holger Vogt 65fc0ad8a6 Add analog code model astate.
It reports the previous state (delayed by 1 to 3 time steps)
of the input node. Single or differential voltage or current.
2026-02-03 13:57:57 +01:00
Holger Vogt 63d5e94b94 Improve the error message by naming the port 2026-02-03 13:57:46 +01:00
Holger Vogt 5e12a80fb4 Exxx n1 n2 nc1 nc2 TABLE = (x0, y0, x1, y1, x2, y2)
is now supported in addition to already existing
Exxx n1 n2 TABLE {expression} = (x0, y0) (x1, y1) (x2, y2)
2026-02-03 13:57:37 +01:00
Holger Vogt e25c70b2bb add new function gettok_node_br which adds braces { } on its list
of ignored characters.
2026-02-03 13:57:23 +01:00
Holger Vogt 85a04c5693 Cosmetics: Indentation 2026-02-03 13:57:14 +01:00
Holger Vogt 3d0ab2db8e Enable plain expression instead of only a number for area
in bipolr device instances.
2026-02-03 13:57:04 +01:00
dwarning b57800d4bd remove obsolete bracket 2026-02-03 13:56:57 +01:00
dwarning f1a240e6b1 remove old commented strncmp version check code 2026-02-03 13:56:48 +01:00
Árpád Bűrmen adae811ad2 BSIM4 version 4.8 is considered to be the latest, i.e. 4.8.3. 2026-02-03 13:56:37 +01:00
Árpád Bűrmen e0694629d1 Scaling of NQS charge deficit with mult_q. 2026-02-03 13:56:23 +01:00
Árpád Bűrmen 5153d8a4c1 ceqqjd, ceqqjs should be scaled with mult_q.
This fixes erratic simulation behavior when
mult_i != mult_q.
2026-02-03 13:56:16 +01:00
Árpád Bűrmen dc58709a37 Fixed a bug causing mult_* factors to get scaled at each setup(). 2026-02-03 13:56:04 +01:00
Árpád Bűrmen 942f877290 Check if toxp+dtox!=toxe with double precision tolerance. 2026-02-03 13:55:56 +01:00
Árpád Bűrmen 58dfdcec52 icvgs, icvds, icvbs exposed as BSIM4v8 parameters. 2026-02-03 13:55:46 +01:00
Árpád Bűrmen 5a8b176378 Fast version checks in BSIM4. 2026-02-03 13:55:38 +01:00
Holger Vogt 71a980f820 Improve detection of the number of terminals for bipolar devices.
Fixes bug no. 807.
2026-02-03 13:55:31 +01:00
Holger Vogt 0648d5e844 Spelling
Found by Lintian, patches provided by C. Schoenert
2026-02-03 13:55:23 +01:00
Brian Taylor 7af862af3d Enable CIDER with KLU for DC, OP, and TRAN analyses. Small signal AC analysis is not yet supported for CIDER complex valued device KLU matrices. The examples/cider testcases produce printed simulation result values which have slight differences between Sparse and KLU. Differences are probably expected and in a few cases are ~1-2%, sometimes a little more. This should be good enough for most CIDER analyses. Francesco did a good piece of work. Runtimes are significantly shorter with KLU. 2026-02-03 13:55:12 +01:00
Holger Vogt af28d2416d free(info.errors) leads to a assertion error on the heap.
On Windows it reads:

is_block_type_valid(header->_block_use).

Memory for info.errors is allocated in the osdi device dll
during the call to

      descr->setup_instance((void *)&handle, inst, model, temp,
                            connected_terminals, sim_params, &init_info);

(in fcn OSDIsetup(), line 254 of osdisetup.c).
Therefore ngspice is not the owner of this memory and thus cannot free it.

Fixes bug no. 803.
2026-02-03 13:53:46 +01:00
Holger Vogt 49b35ed3fc We are developing towards ngspice-46 2026-02-03 13:52:36 +01:00
dwarning ce55f05e1b bsim4: unify error printout 2026-02-03 13:46:02 +01:00
dwarning 50bfc214ab bsim4: reimplement mobility and binning extension 2026-02-03 13:45:50 +01:00
dwarning 2c9c2c20c4 reply commit e5c162f1: dc sweep fails after transient sim 2026-02-03 13:45:37 +01:00
dwarning 94b193ad91 prevent warning if NOBYPASS is not defined 2026-02-03 13:45:24 +01:00
dwarning 11ee179639 adapt instance parameter extension to new bsim4 multiplier concept 2026-02-03 13:45:11 +01:00
Holger Vogt 724dc77b91 Prepare bug-fix release ngspice-45.2. 2025-09-05 23:59:35 +02:00
Holger Vogt 82c620304b Fixing bug 804.
Using function get_windows_canonical_path() may neglect the
ngspice file search sequence, as an absolute path is returned also
for relative input paths. ngspice however searches a file not only
relative to the current directory, as inforced by this
function, but for example also in the directory of the previous
input file.

So restrict this function to paths longer than MAX_PATH, which would fail
otherwise.
2025-09-05 23:59:05 +02:00
dwarning 86c78150b7 add KLU bindings for diode selfheating effect, bug #802 2025-08-31 15:16:05 +02:00
Holger Vogt dbb1db8b9d add tlines files to distribution 2025-08-29 23:55:36 +02:00
Holger Vogt 86ea9fee8a Prepare for ngspice-45 2025-08-29 15:01:45 +02:00
Holger Vogt a2b3d7c7d2 Enhance comment. 2025-08-28 12:39:13 +02:00
Holger Vogt 7fc68c0c07 Adding .param SWSOA=1 right after the .lib entry during reading in
the libraries.
2025-08-28 12:39:01 +02:00
Holger Vogt b1f4f32b36 Prevent a segfault if cp_variablesubst return a nullptr.
Fixes bug-801
2025-08-28 12:16:22 +02:00
Holger Vogt 2185f82a28 typo 2025-08-28 12:16:11 +02:00
Holger Vogt bebf7efd8b Command completion is not supported, removed from 'help' 2025-08-28 12:15:55 +02:00
Holger Vogt c45d1e0974 Rename t to tn to avoid t shadowing the t from the function header
void cpmslineAnalyseDispersion (double W, double h, double s,
				   double t, double er, double Zle,
...
2025-08-28 12:15:40 +02:00
Vadim Kuznetsov 94740a3d2b Fixed warnings in cpmlin and mlin 2025-08-28 12:15:25 +02:00
Holger Vogt 481e3e567b Update to filesource
Move tprev out of the loop to enable storing the previous time value.
Add some general warning message that an error might have occurred during
reading the time or data values from the data input file.
Allow empty lines in the data input file.
Guard early data values (TIME < time offset) against false reading.
Add some simple examples.
2025-08-11 18:45:21 +02:00
Brian Taylor 179c7504fb Misplaced break statement in callback. 2025-08-08 11:46:33 +02:00
Holger Vogt 21c238276a Another copyright update 2025-08-08 11:46:22 +02:00
Holger Vogt 632b55a90d Update copyright notice 2025-08-08 11:46:13 +02:00
Holger Vogt b7692fbda7 Move CALLBACK into the 'init' section,
to have it called once only.
2025-08-08 11:46:06 +02:00
dwarning 5e21393fbb prevent unused warning 2025-08-08 11:45:49 +02:00
dwarning 7ede33e7c6 git ignore temporary file 2025-08-08 11:45:32 +02:00
Holger Vogt 787a8530be Prevent doubly defined tokens. 2025-08-08 11:45:15 +02:00
Holger Vogt cbf93cf8e0 Add missing CALLBACK 2025-08-08 11:44:51 +02:00
Holger Vogt 5af5f02ad1 Remove unused variable. 2025-08-08 11:44:34 +02:00
Holger Vogt 4ab6be1b90 Keep saving nodes only once, but make an exception for node 'all'.
Fixes bug-799, at least partially (diffpair.cir is running again.).
2025-07-29 11:05:14 +02:00
Holger Vogt 805f14e50b Don't check .params as they will fall through anyway. 2025-07-29 11:05:06 +02:00
Holger Vogt 3d55c16531 Don't print a form feed if 'option nopage' is given.
Print the header really only once  if 'option nopage' is given.
2025-07-29 11:05:00 +02:00
dwarning 68c3fc1031 diode needs both current components (bottom and sidewall) for Vcrit and breakdown voltage calculation 2025-07-29 11:04:51 +02:00
dwarning 05bbb2aaa2 introduce aliases for certain diode breakdown model parameter 2025-07-29 11:04:38 +02:00
Jason Pyeron 178b541fb2 BUGFIX: #797 - gettoks did not protect against NULL pointer input 2025-07-29 11:04:05 +02:00
Brian Taylor 47d7f7aa62 Allocating arrays of double* should use sizeof double* not double, even though they may be the same. Avoid potential divide by zero. 2025-07-29 11:03:28 +02:00
Brian Taylor 416edbbb9a Fix memory leak in xspice oneshot. 2025-07-29 11:03:10 +02:00
dwarning a0c7af575d bsim4 update to version 4.8.3 2025-07-29 11:02:56 +02:00
Holger Vogt c24fc9e9d0 Remove compiler warning. 2025-07-29 11:02:39 +02:00
Holger Vogt 29d5584c56 Bug fixes:
fix function rdivide
fix a copy/paste bug in cpline
add copying of tlines
2025-07-29 11:01:57 +02:00
Holger Vogt 33efc5ed2c Add functions for VS non-C99-compatible complex data manipulation,
selected by #ifdef _MSC_VER switch.
Update tlines project file, correct buiuld sequence for
code models in vngspice.
Add tlines to spinit.
2025-07-29 11:01:30 +02:00
Holger Vogt 6d86b0ebda Visual Studio C does not support C99 complex types and functions
Add type DoubleComplex, to become 'double complex'
with gcc and _Dcomplex with Visual Studio.
Add functions rdivide and divide to divide real or complex numbers
by another complex number.
Use rdivide and VS built in function to evaluate _Z11 - _Z14.
2025-07-29 11:01:02 +02:00
Holger Vogt 89c2070a96 Add missing constants for Visual Studio C 2025-07-29 11:00:52 +02:00
Vadim Kuznetsov 741a7002d0 Fix licence header in msline_common 2025-07-29 10:56:31 +02:00
Vadim Kuznetsov dcb4202910 Added MSOPEN model 2025-07-29 10:55:51 +02:00
Vadim Kuznetsov 6914662c4d Implement rollback; fix memory management 2025-07-29 10:55:41 +02:00
Vadim Kuznetsov 4358b99183 Add license header for new files 2025-07-29 10:54:52 +02:00
Vadim Kuznetsov 047de0f201 Add XSPICE models for transmission lines 2025-07-29 10:54:23 +02:00
Holger Vogt c2f9f6d3f4 retain type=0, type=1, type=+1, or type=-1 in a .model card,
even if compatmode PS or LT are set.
2025-07-29 10:52:54 +02:00
dwarning 6aba1f302b allow showmod command for verilog-a models - feature request #100 2025-07-29 10:52:14 +02:00