Commit Graph

530 Commits

Author SHA1 Message Date
Holger Vogt 678a6582f6 A preliminary fix to reduce the amount of missing pulses considerably.
Probably not yet the final solution.
2023-05-27 10:40:32 +02:00
Giles Atkinson 5aa48cab0b Do not generate netlist lines that use non-existent libraries.
To support that, give global scope to  function inp_pathresolve()
in inpcom.c.  Update internal documentation (long comment).
2023-04-01 13:56:12 +02:00
Holger Vogt 062785319a When '.probe alli' is set, disable auto bridging and set a flag 2023-03-24 22:10:18 +01:00
Giles Atkinson 5197200fb3 Fix crash reported by Brian Taylor. If "source" is used after
analysis, the circuit is both deleted and destroyed. Beware of
double frees.
2023-03-22 14:30:18 +01:00
Giles Atkinson 98333ee89a Fix a memory leak reported by Brian Taylor that was introduced
by commit 4d8e17487b.
2023-03-22 14:30:11 +01:00
Giles Atkinson e25f8bd522 Add inertial delay to missed d_xnor and tidy blank lines in d_xor. 2023-03-22 14:29:03 +01:00
Giles Atkinson cecce5163e Inertial delay for remaining simple gates and buffers:
nand or xor open_c open_e, but not tristate.
2023-03-22 14:28:51 +01:00
Giles Atkinson db38d4ad54 Correct timing of transitions to UNKNOWN. 2023-03-22 14:28:37 +01:00
Giles Atkinson 4623a04615 Interim version of inertial delay for tristate buffer.
This does not handle three-way or mixed transitions.
2023-03-22 14:28:15 +01:00
Giles Atkinson e3b4df6a51 First group of digital code models with improved implementation
of inertial delay: buffer, inverter, and, nor.  Also adds
utility function cm_is_inertial(().
2023-03-22 14:27:54 +01:00
Giles Atkinson 2643e3b17f New code-model library functions cm_schedule_output() and cm_getvar().
To be used in the inertial delay code for digital code models.
2023-03-22 14:27:35 +01:00
Giles Atkinson c1659a64c3 Change output event setup in evtload.c so that, when making an event call
to a code model, there is no longer a reference to the value of the event
at the head of the free list.  That allows all such free lists (with the
same data type) to be combined, probably improving performance.
This is in preparation for full implementation of inertial delay for
digital nodes.
2023-03-22 14:27:19 +01:00
Giles Atkinson 2d0561f386 Allow string-valued parameters to XSPICE device models with no default.
The code model then sees the value NULL.  Needed for the "family"
parameter on logic models, used by automatic bridge insertion.
2023-03-22 14:27:06 +01:00
Giles Atkinson 06aa693852 A new fix for Bug #331: "XSpice skips digital output point".
The problem was caused by removing an output queue from the "modified"
list when it had been modified by processing one of its events.
2023-03-18 14:33:02 +01:00
Giles Atkinson 7457a2684b Revert "Fixes bug #331"
This reverts commit 6d9876229c, because
it was found to break examples/xspice/various/xspice_c3.cir
(see discussion in bug report for February 2023) and an alternative
fix is available.
2023-03-18 14:32:53 +01:00
Holger Vogt 5924ae2dfb bug report 619 by Hanspeter Niederstrasser
remove double inclusion of stdlib.h
Correction of commit 9e432838c ("Patch by Robert Turnbull: remove warning messages", 2023-02-05)
2023-03-18 14:30:56 +01:00
Holger Vogt 3ff9643f49 Add a scale factor 'a' (atto, 1e-18) 2023-03-18 14:30:03 +01:00
holger f9ed3fd080 Patch by Robert Turnbull: remove warning messages 2023-02-05 11:25:42 +01:00
Giles Atkinson 7ead974a5a Prevent crash when cm_analog_set_temp_bkpt() is called during OPtran(). 2022-12-11 15:35:31 +01:00
Giles Atkinson 73e8fed0fc Fix warnings from gcc 10.2.1. 2022-12-11 15:35:14 +01:00
Holger Vogt ba6ff75dab Trim trailing spaces 2022-12-11 15:22:30 +01:00
Holger Vogt f26c9146f5 Don't allocate memory for control array at every time step
Use loc instead, setting it up once during INIT
2022-12-11 15:22:01 +01:00
Holger Vogt e47049f31a Add STATIC_VAR_TABLE locdata
Add CALLBACK cm_d_pwm_callback
Reserve memory for x, y arrays only once during INIT
2022-12-11 15:15:22 +01:00
Holger Vogt ed6f802948 Add a guard on parameter 'position', limit to
1e-9 to 0.999999999
FIXME: the given parameter limits from ifspec.ifs are not recognized.
2022-10-22 15:54:12 +02:00
Holger Vogt 2d8ea17d65 Update on author 2022-10-22 15:54:01 +02:00
Holger Vogt 61d23b99ff Patch required to allow compiling at Fedora with -Werror=format-security
Provided by Mamoru Tasaka
2022-10-22 15:53:45 +02:00
Giles Atkinson 01c4a5dff2 Fix memory leak reported by Brian Taylor. 2022-10-14 13:52:34 +02:00
Holger Vogt 9166f202a6 Streamline the simple diode model. 2022-10-08 16:50:47 +02:00
Holger Vogt ec6a902fb9 Fix a bug in simple diode, when ilimit is set, but not epsilon.
Make model more similar to LTSPICE
Add an example
2022-10-08 16:50:38 +02:00
Giles Atkinson d9952575dd Correct the digital state resolution table, that was previously asymmetric.
An equivalent change is mentioned in the SPICE OPUS change history.
2022-10-08 16:48:20 +02:00
Giles Atkinson 372d9b2c87 Add bidirectional digital/analog bridge. 2022-10-08 16:48:11 +02:00
Giles Atkinson e80b724460 Add two functions to the Code Model Library: cm_get_node_name()
makes circuit node names available to diagnostics, while
cm_probe_node() is needed for a bidirectional A/D bridge.
2022-10-08 16:47:50 +02:00
Giles Atkinson 06131d8107 Rewrite code with Visual Studio complaints. 2022-10-08 16:47:09 +02:00
Holger Vogt 519ce44227 safeguard against circuit not being abvailable,
avoid crash
2022-10-08 16:43:41 +02:00
Holger Vogt 1d026475a2 pwlts: a pwl v/i source with time input, smoothing and limiting functions 2022-10-07 13:39:16 +02:00
Holger Vogt 0af4932c6f Prevent a crash if (due to input error) the node_table is not available. 2022-10-07 13:37:57 +02:00
Holger Vogt 2126230b64 Prevent crashes when nodes or tables are not available,
e.g. due to missing input file.
2022-10-07 13:22:59 +02:00
Giles Atkinson a0357b3432 Remove search for "family" parameters on subcircuits in XSPICE
automatic bridging support as string-valued parameter support is
not yet intgrated.
2022-10-07 13:20:34 +02:00
Giles Atkinson 4115064fd5 Latest auto-bridge code from development branch. 2022-10-07 13:20:17 +02:00
Giles Atkinson b1341c8e30 Insert XSPICE bridging devices automatically when an analogue node
has the same name as an XSPICE event node (including digital nodes).
The function Evtcheck_nodes() is replaced by a new version in its
own file.
2022-10-07 13:19:59 +02:00
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
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
Giles Atkinson dbf4c16bc0 Fix XSPICE memory leaks found by valgrind. 2022-05-09 10:07:57 +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 7130097710 Prevent crash when no simulation has been run and
asking for plotting an event node
2022-02-19 17:23:36 +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
Brian Taylor 08bc3ccdd6 Remove compiler warnings (writ_ifs.c ipcsockets.c). 2022-01-13 14:54:16 +01:00