Commit Graph

9614 Commits

Author SHA1 Message Date
Holger Vogt 6ed467c8f9 Add new pyplot command source files to Visual Studio 2026-07-19 17:36:52 +02:00
Meisam 133f118c66 Adds a 'pyplot' interactive command that renders simulated vectors with
matplotlib -- a Python counterpart to ngspice's 'gnuplot' command. Same
syntax (pyplot <file> <plot expressions...>): the first word is the output file name only when it is NOT a plot expression, the rest are ordinary plot expressions handled by plotit().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 17:36:40 +02:00
Holger Vogt 39c662c12b Disable topology reduction by default. Enable it by setting
'topo_reduce' in .spiceinit.
2026-07-19 17:36:31 +02:00
Holger Vogt 08f4b56de5 Enable obtaining node info also for code models. 2026-07-19 17:36:09 +02:00
Holger Vogt 02c6478399 If stricterrorhandling is set, ngspice detects the dangling
capacitors and resioiostors, lists them and then bails out.
2026-07-19 17:35:37 +02:00
Holger Vogt 4fb403a590 enable removal of dangling nodes also when MODETRANOP is set.
Removes singular nodes when op before tran is run.
2026-07-19 17:35:23 +02:00
Holger Vogt b020c83b86 no removal of dangling capacitors/resistors when rshunt is set 2026-07-19 17:35:02 +02:00
alto555 9575899a95 ckt: dangling-passive topology reduction
Add CKTtopologyReduce() (cktsetup.c) to remove degree-1 dangling
capacitors/resistors -- e.g. dead-end opamp compensation caps -- that
otherwise cause spurious 'Timestep too small' aborts. Node degree is
counted generically over all device types; the floating node is pinned
with a unit diagonal. Disable with 'set no_topo_reduce'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 17:34:52 +02:00
Holger Vogt b8ae73d4a2 typo 2026-07-19 17:30:54 +02:00
Holger Vogt 3f7f438f0a Warn if rshunt without XSPICE selected 2026-07-19 17:30:47 +02:00
Holger Vogt 7fc36269b8 Improve the output format of the 'show' command,
tested with various voltage sources.
2026-07-19 17:30:35 +02:00
Holger Vogt 58600e5db1 Restrict the return vectors (malloced) to the voltage source type
given by the requested VSRC function type value (VSRC_PULSE etc.)
2026-07-19 17:30:29 +02:00
Peer Hofstra 9d385d512c Strip a UTF-8 byte order mark at the start of a line -- i.e. at
the start of a file written by a Windows editor.  A BOM is never
legal SPICE syntax; left in place it glues to the first token
(fatal ".subckt/.ends mismatch" class errors in included libs).
2026-07-19 17:30:10 +02:00
alto555 b2ec82609e `show' printed a device's vector parameter (a source's pulse/pwl/ac
coefficient list) one element at a time, calling askInstanceQuest for
every element.  Two bugs made that catastrophic on a large chip:

  * IFvalue val was uninitialised, so a query that did not set
    v.numValue left `n' as stack garbage -- the element loop then ran
    essentially forever.
  * askInstanceQuest TMALLOCs the coefficient vector (vsrcask.c) on
    every call and printvals()/printvals_old() never freed it, so the
    listing leaked O(n^2) allocations -- tens of GB on a deck with many
    stimulus sources.

Fix: memset val before the query and clamp n (kills the runaway loop),
and free the returned vector after use via a new free_if_vec() helper.
Verified: pulse coefficients still print correctly; show on MOS/BSIM4/
OSDI/vsource is unchanged and does not crash.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 11:44:41 +02:00
Holger Vogt 773c5a263e Prepare for ngspice-47 2026-07-08 23:02:08 +02:00
Giles Atkinson 692c5a3f95 Fix file name quoting for .LIB. Reported by Tom Hajar in ngspice-users. 2026-07-08 22:47:41 +02:00
Holger Vogt 12bb48cf41 Add examples for the IHP Open Source PDK 2026-07-08 22:47:31 +02:00
Brian Taylor 6fce461984 Paranoia_Parallel: a test suite for more than 100 test circuits,
running in parallel on a multi-core machine (12 min execution time
on a i9 9900, ngspice compiled with gcc, debug mode enabled.
Linux with Valgrind and Parallel are required.
2026-07-08 22:47:22 +02:00
Giles Atkinson 1123808aec Correct three comments. 2026-07-08 22:46:54 +02:00
Giles Atkinson 2c2bc4f435 In a shared library build, the option -fvisibility=hidden may be set
when compiling making entry point Cosim_setup inaccessible.  The problem
was reported at https://github.com/iic-jku/IIC-OSIC-TOOLS/issues/287,
but not reproduced.
2026-07-08 22:46:42 +02:00
Holger Vogt 9230554e26 Make the name of the added voltage source more verbose
(to avoid already existing source names).
2026-07-08 22:46:31 +02:00
Giles Atkinson 08d97e6f09 Fix Bug #775 - "Missing LDFLAGS in vlnggen", and add an option
(-stc c++14) that was needed in testing on Windows.
2026-07-08 22:46:16 +02:00
Giles Atkinson cb5fbed1f9 Feature Request 72 - "Printing hidden errors to terminal" suggests
showing errors in XSPICE code model support functions by default.
But errors may occur routinely and be handled by code.
To aid developers, setting variable "noisyxspice" will display the messages.

Also fix an error report in cm_event_queue(), remove XSPICE parse error
messages that are now shown twice and fix errors in d_source that
were seen with the new error reporting.
2026-07-08 22:45:58 +02:00
Giles Atkinson 0f0f80f34f Add new capabilities to the adc/dac_bridge XSPICE code models.
If either bridge has a single analog connection and two or more digital
connections it will act as a conventional multi-bit ADC or DAC.
When the low threshold is higher than the high threshold, adc_bridge
acts as a Schmitt trigger.
2026-07-08 22:45:21 +02:00
Giles Atkinson 37b6fda497 Simplify adc_bridge, also removing excess white space. 2026-07-08 22:44:59 +02:00
Holger Vogt 62f0b2d8cc New behavioral capacitor model:
- Replace E source by G source with parallel resistor to improve
  convergence.
- Add parallel resistor to avoid floating nodes
- Reduce refecrence C to 1u (and thus the max. current).
2026-07-08 22:44:49 +02:00
Holger Vogt 63d45e81ab Prepare for ngspice-47 2026-07-08 22:44:37 +02:00
Holger Vogt c961118650 Add error message if scale and data vector lengths do not match 2026-07-08 22:44:28 +02:00
Holger Vogt 8c68d55067 Update the copyright notice 2026-07-08 22:44:21 +02:00
Holger Vogt d7db4192a8 Replace lengthy call to CKTcircuit by new TSTOP and TSTEP macros 2026-07-08 22:44:10 +02:00
Holger Vogt 28df521b11 Set TSTEP and TSTOP also when MIF_DC, as this is needed
when initialising a code model during op before a tran sim.
2026-07-08 22:43:56 +02:00
Holger Vogt e2f397f9b5 Add two macros TSTEP and TSTOP to XSPICE 2026-07-08 22:43:50 +02:00
Holger Vogt 1caee7903e Improve the error messages when reading a state file.
Bail out when the read has not been successfull.
2026-07-08 22:43:42 +02:00
Holger Vogt 9a79af8a3e Add MODEDCTRANCURVE to enable returning capacitance upon dc sweep.
Exclude integration if MODEDCTRANCURVE is active (forward,
self-heat and reverse diode)..
2026-07-08 22:43:26 +02:00
Holger Vogt e073718c0e Add MODEDCTRANCURVE to enable returning capacitance upon dc sweep.
Exclude integration if MODEDCTRANCURVE is active.
2026-07-08 22:43:19 +02:00
Holger Vogt 95414ec09b No integration, if dc sweep is to return cpacitances 2026-07-08 22:43:08 +02:00
Holger Vogt 08f2541d34 Reset ckt->CKTag[0] and ckt->CKTag[1] upon successful return
from transient simulation.
2026-07-08 22:43:02 +02:00
Holger Vogt 62d70a242e A digital NAND gate 9-stage ring oscillator (less than 30ms simulation time) 2026-07-08 22:42:44 +02:00
Holger Vogt 72620328a1 Excluded integration during self-heating as well. 2026-06-01 19:48:50 +02:00
Holger Vogt d029ed02db Diode: No integration if dc sweep, but keep calculating capacitances 2026-06-01 11:02:45 +02:00
Holger Vogt 973b6b6d49 No integration if dc sweep, but keep calculating capacitances 2026-05-31 15:57:26 +02:00
Holger Vogt e53325583b Don't check for tperiod, which is not used when the
distributed pulse is applied.
2026-05-26 16:02:36 +02:00
Holger Vogt 037b6578f8 gain cell as an example for the declarative small signal noise approach 2026-05-24 09:58:53 +02:00
Holger Vogt b03f3cc8fe title update 2026-05-23 15:03:12 +02:00
Holger Vogt afac24be24 Re-format 2026-05-22 21:20:58 +02:00
Holger Vogt 7b045a99b2 improve comment 2026-05-22 21:16:16 +02:00
Holger Vogt 1ec7f8168f Make structure equal to dllitf.h
Fixes bug 840
2026-05-22 21:15:50 +02:00
Holger Vogt 8b32c743ae Update to the SEEgenerator as describes in README.SEEgenerator 2026-05-22 17:32:46 +02:00
Brian Taylor abcbcbd724 Completed and cleaned up memory leak fixes in:
inpc_probe.c outitf.c inpcom.c niiter.c
cherry-pick of this one commit should be OK.
2026-05-19 10:50:35 +02:00
Holger Vogt 7911d0870d Correct paths in example file 2026-05-15 01:00:56 +02:00