Commit Graph

7275 Commits

Author SHA1 Message Date
Brian Taylor 4fcb925555 Merge branch 'pre-master-42' into bt_dev 2023-10-28 16:09:35 -07: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
Brian Taylor 3bb6e86015 Add Windows Visual Studio support for the Isotel d_process xspice digital model. The Isotel mixedsim-master/examples/embedded/motorforce C code needs to have minor changes for _MSC_VER defines, and are not included with this commit. The changes relate to using #pragma pack(push, 1)...#pragma pack(pop) around some structs, and setting stdin/stdout in binary mode. It is doubtful that the cfunc.mod will compile on mingw or cygwin since I don't know if they support pipe/fork/exec/spawn calls. The code builds and runs on Windows, Linux, and MacOS. In the future, Giles Atkinson is looking at allowing Xspice models to load shared libraries (.dll, .so) which will avoid creating and communicating with an external program. 2023-10-28 10:58:06 +02:00
Holger Vogt efdf332061 Prevent a crash if hash model table was not generated,
e.g. due to missing valid models.
2023-10-27 23:13:41 +02:00
Brian Taylor 9c60497f2e Make it explicit that null output ports are not allowed. The output port vector bounds are always >= 1. 2023-10-23 10:36:27 -07:00
Holger Vogt 10d7297798 Add cm_cecit(). If the input file could not be opened, stop ngspice. 2023-10-21 15:52:10 +02:00
Brian Taylor 7ee33b3602 Call cm_cexit() to prevent the simulator running when d_process initialization errors occur. 2023-10-19 08:31:37 -07:00
Brian Taylor 30f494e83d Pick up cm_exit(). Merge branch 'pre-master-42' into bt_dev 2023-10-18 16:24:06 -07:00
Brian Taylor 12d10eaffc Cleanup child processes on Windows VisualC and Mingw. On Linux those processes quit when ngspice quits. 2023-10-18 14:48:16 -07:00
Holger Vogt 19ebfb1887 Add a code model function cm_exit(const int exitcode).
This function calls controlled_exit(exitcode) to shut
down gracefully.
2023-10-18 22:46:27 +02:00
Holger Vogt f26dda8616 Formatting 2023-10-18 17:44:56 +02:00
Holger Vogt 39443fafdd Removing unused models takes much more time than keeping them
for large circuits.

Probably a hash table may help here (t.b.d.).
2023-10-18 14:36:08 +02:00
Holger Vogt 8ef0aece58 During setup of the models thre have been search scans in the
linked model list modtab. The time used here grows approx.
quadratically with the number of models. If the numbers get large,
e.g. with the IHP Open PDK, setup time make simulation impractical.
Therefore the linked list modtab has been enhanced by a hash table
modtabhash, which allows linear search time and makes simulation
of a 200k transistor circuit with IHP PDK possible. Already
the setup time for 15k transistor circuits has been reduced.
2023-10-18 14:34:16 +02:00
Brian Taylor fb3866d2bf 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-16 13:19:43 -07:00
Holger Vogt 9702557f81 Evaluate function gauss() in B sources. This is required when
in .model files the tokens 'temper' and gauss() coexist, because
then the B Source function parser is applied.
2023-10-16 17:53:58 +02:00
Brian Taylor 843fbde6e9 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-14 16:01:39 -07:00
Brian Taylor 29e048df6f Add modifications note. 2023-10-13 19:23:38 -07:00
Brian Taylor 73010da4e9 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-13 18:15:38 -07:00
Brian Taylor dee0500140 Merge branch 'pre-master-42' into bt_dev 2023-10-11 14:42:29 -07:00
Brian Taylor 074355f830 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-10 15:41:06 -07:00
Holger Vogt eb36084700 re-formatting (indentation, tabs removed) 2023-10-11 00:08:55 +02:00
Brian Taylor d114715d99 Remove unused reset_state param; do not allow null in and out, so there is at least 1 input and 1 output. 2023-10-09 21:52:32 -07:00
Holger Vogt 9edf34495e Don't say 'issue in line no. 0', as this 'info' does not tell
where the line with position 0 really is in the input deck.
2023-10-09 23:19:30 +02:00
Brian Taylor 4e4c871863 Remove the unused reset_delay param. 2023-10-08 20:22:00 -07:00
Brian Taylor 35ba73e27b Add array bounds check, fix typos. 2023-10-08 14:57:43 -07:00
Holger Vogt 7c3cb8169c This is a re-write of the PWM generator.
It is modelled according to the new d_OSC by Giles Atkinson.
Here frequency is fixed and duty cycle is controlled by an
analog input.
2023-10-07 17:13:55 +02:00
Holger Vogt ecb416b800 This patch fixes a bug when shared library uses XSPICE:
Don't subtract delta twice, when breakpoint is active
and step is rejected.
https://sourceforge.net/p/ngspice/patches/106/
Thanks to Vyacheslav Shevchuk
2023-10-07 17:10:31 +02:00
Holger Vogt 9944a4869f typo 2023-10-07 13:36:56 +02:00
Brian Taylor 26bba7a1bc Fix VisualC and Mingw compiler warnings. 2023-10-06 14:58:53 -07:00
Brian Taylor 0d7ca7f669 Add callback to free process memory. 2023-10-05 15:13:26 -07:00
Brian Taylor a720193335 Merge branch 'pre-master-42' into bt_dev 2023-10-05 10:22:13 -07:00
Holger Vogt 53315ed764 Prevent crash when no input file given. 2023-10-05 00:19:51 +02:00
Brian Taylor eea7514b07 Add MODIFICATIONS note, cleanup white space. 2023-10-04 14:46:42 -07:00
Holger Vogt 4f79105b06 Add comment 2023-10-02 10:07:52 +02:00
Holger Vogt 233f9daba4 Remove unused instance parameter ic (initial condition of controlling source). 2023-10-01 10:51:31 +02:00