Commit Graph

609 Commits

Author SHA1 Message Date
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
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 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
Holger Vogt fd72c3ce3e Bail out when state file is not found. 2024-11-02 22:26:53 +01:00
Brian Taylor d01868b725 Cleanup gcc compiler warnings. 2024-06-22 14:23:50 +02:00
Holger Vogt 63d496b564 New parameter char *linesource for fcn insert_new_line
Make Fcn inp_read in inpcom.c static
2024-05-14 16:29:51 +02:00
Holger Vogt 2d8fe0362f Allow delay of 0, as requested by Infineon model of the 2EDNY52X 2024-05-14 16:29:07 +02:00
Holger Vogt e151b691fb Add an additional funtion parameter 'filename' to fcn inp_readall
to transfer not only the folder, but also the file name of the
current input
2024-05-14 16:28:40 +02:00
Giles Atkinson 9f0e44cace Fix an error in cfbe1afa21 that causes a crash in d_cosim. 2024-05-01 10:55:10 +02:00
Holger Vogt 2bee691717 correct the link to the license text. 2024-05-01 10:31:58 +02:00
Giles Atkinson 5f59d76a03 Suppress some warnings from MSVC. 2024-05-01 10:31:25 +02:00
Giles Atkinson 6ce627e6f8 Tidy d_process/ifspec.ifs so that it works after changes in
mif_inp2.c and writ_ifs.c to enforce "Null_Allowed".
2024-05-01 10:31:15 +02:00
Giles Atkinson 27eda59034 Make the 'Null_Allowed' option for XSPICE code model parameters
behave as reasonably expected and as described in the manual.
Previously a missing (null) value was always accepted if the ifsspec.ifs
file contained a default value, and several of the the included
code models worked that way.  Where there was a useful default,
"no" has channged to "yes".  Some models with a look-up table defined
by two parameters had such defaults that did nothing useful. Thay have
been given useful vector defaults.  These changes should not affect
previously-working netlists.
2024-05-01 10:31:07 +02:00
Giles Atkinson 7dd2db904c Change CMPP-related struct Mif_Parse_Value to a union
as C99 allows initialisation of any member.  Also correct a comment
in miftypes.h.
2024-05-01 10:30:48 +02:00
Giles Atkinson 0152ea92db Support use of vector defaults for XSPICE vector parameters.
This answers Feature Request 60 - "Array as default value for parameter".
2024-05-01 10:30:40 +02:00
Holger Vogt 3341b2e045 Bug 665: enable compiling the code models with link time optimization.
Fix provided by Giles Atkinson.
Still the build of ngspice fails (tested with Cygwin) at the linking stage.
2024-05-01 10:25:12 +02:00
Holger Vogt ace932e1b9 Patches provided by Carsten Schoenert: Misspellings, File access 2023-12-31 13:51:05 +01:00
Holger Vogt f99a137eb3 Patch for snprintf provided by Marco Atzeri 2023-12-29 10:59:56 +01:00
Holger Vogt d1abc8f6c7 typo 2023-12-22 13:11:21 +01:00
Giles Atkinson ffcf3b24d9 Improve efficiency and irreversible CM support in EVTcall_hybrids() by
halting calls to code models as soon as the timestep is chenged.
This should have been included in 508fad0f55.
2023-12-19 14:26:56 +01:00
Giles Atkinson c18447f9f5 Add the support files for co-simulation with Verilog code
compiled by Verilator.  Also add script files to Visual Studio builds
that are already installed by the Makefile builds.
2023-11-27 20:55:59 +00:00
Giles Atkinson 566e2938f4 Add XSPICE code model d_cosim, a generic adaptor for digital cosimulation. 2023-11-27 14:50:21 +00:00
Giles Atkinson 12fe7b90c4 Add new code model function cm_irreversible(). This may only be
called from an XSPICE code model's INIT call and has three effects:
the instance is treated as "hybrid" even when it does not use both
port types; its position in the hybrids array is adusted; and it
is explicitly notifed when called just befoore the end of an
analog time-step.
2023-11-26 18:30:53 +00:00
Giles Atkinson 34e6c4abea Convert XSPICE's hybrid_index array to instance pointers.
That simplifies code and will be needed for irreversible code model support.
2023-11-26 18:29:23 +00:00
dwarning 2cf2693706 few code cleanings 2023-11-12 17:04:36 +01:00
Giles Atkinson 10386ee3e3 Commit [35d338]ngspice partly reverted commit 423f9a9db to fix deletion
of source files if make was accidentally used in the source tree.
That caused the original bug to return.  Fix the problem by deleting
the generated source files by name (no such files exist in source.
Also make the generated files depend on cmpp, making 'make clean'
unnecessary after a chenge to cmpp.
2023-11-09 12:08:02 +00:00
dwarning 35d338f256 partly revert commit 423f9a9db - don't remove xspice/icm .c files 2023-11-08 07:59:36 +01:00
Brian Taylor 04c68d5f30 Cleanup child processes on Windows VisualC and Mingw. On Linux those processes quit when ngspice quits. 2023-10-28 19:45:24 +02:00
Brian Taylor 4219efb5d5 Make it explicit that null output ports are not allowed. The output port vector bounds are always >= 1. 2023-10-28 19:43:46 +02:00
Brian Taylor c83d11c9c0 Call cm_cexit() to prevent the simulator running when d_process initialization errors occur. 2023-10-28 19:43:23 +02:00
Holger Vogt 21761207bc Change license to 3-clause BSD (see
https://sourceforge.net/p/ngspice/ngspice/merge-requests/6/?limit=25#fd4f/73e6)
2023-10-28 14:55:13 +02:00
Brian Taylor 09f070f582 Error handling improvements in cfunc.mod. Ensure that d_process.h wiil always respond to version and interface checks sent from sendheader. This is needed so that the pipe reads in sendheader do not cause Windows to hang when the interface version and in/out counts do not match. This hang was the cause of errors not being reported and the Windows gui hanging. Startup and header checks are now detected in cm_d_process, and the simulator will run but with runtime errors since a d_process model cannot be completely instantiated after initial errors. It would be good to find a means of gracefully halting the simulation run. 2023-10-28 11:00:33 +02:00
Brian Taylor 8c72a76844 Another attempt at clean up of error handling and reporting. It's OK on limux and cygwin, but Windows VisualC is being stubborn. I would prefer not to have to call exit(1) just for Windows, since then nothing is reported and the gui disappears in a puff of smoke. Even without the exit calls nothing gets reported with the Windows gui which will hang when there are errors detected by d_process. 2023-10-28 11:00:28 +02:00
Brian Taylor 4eae039779 Add modifications note. 2023-10-28 11:00:23 +02:00
Brian Taylor 4530cde8e2 Use Xspice cm_message_send to report errors rathen than printing to stderr and calling exit. When a d_process model has errors found in start(), sendheader(), and dprocess_exchangedata() these are reported, but if the model is run a SIGINT is raised. There must be a better way of stopping the simulator. 2023-10-28 11:00:18 +02:00
Brian Taylor df28fabc42 Restore the deleted unused params to be backword compatible. Handle the case where the d_process instance has a null in vector, so that N_din is zero. This allows the model to be just a pattern generator. Add include to cmproto.h to avoid a forward ref. to an enum type. 2023-10-28 11:00:03 +02:00
Brian Taylor 307ba1985b Remove unused reset_state param; do not allow null in and out, so there is at least 1 input and 1 output. 2023-10-28 10:59:52 +02:00
Brian Taylor 7820940be3 Remove the unused reset_delay param. 2023-10-28 10:59:42 +02:00
Brian Taylor e762047fc2 Add array bounds check, fix typos. 2023-10-28 10:59:34 +02:00
Brian Taylor 022a340ddb Fix VisualC and Mingw compiler warnings. 2023-10-28 10:59:11 +02:00
Brian Taylor cccb4a1559 Add callback to free process memory. 2023-10-28 10:58:39 +02:00
Brian Taylor 33780055ee Add MODIFICATIONS note, cleanup white space. 2023-10-28 10:58:28 +02:00
Brian Taylor 5c4352d02f Add __MINGW64__ defines for builds on mingw with msys. 2023-10-28 10:58:15 +02:00