ngspice/examples/xspice/d_process
Brian Taylor 1f5f7ae439 Update d_process examples. 2023-10-28 19:43:36 +02:00
..
README Update d_process examples. 2023-10-28 19:43:36 +02:00
checks.cir Update d_process examples. 2023-10-28 19:43:36 +02:00
clean.sh Add examples/xspice/d_process. 2023-10-28 11:00:12 +02:00
compile.bat.txt Add examples/xspice/d_process. 2023-10-28 11:00:12 +02:00
compile.sh Add examples/xspice/d_process. 2023-10-28 11:00:12 +02:00
d_process.h 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
debugging.h Update d_process examples. 2023-10-28 19:43:36 +02:00
graycode.c Update d_process examples. 2023-10-28 19:43:36 +02:00
nggtk.tcl Add examples/xspice/d_process. 2023-10-28 11:00:12 +02:00
prog-pipes.cir Update d_process examples. 2023-10-28 19:43:36 +02:00
prog1-4.cir Update d_process examples. 2023-10-28 19:43:36 +02:00
prog1in4out.c Update d_process examples. 2023-10-28 19:43:36 +02:00
prog4in1out.c Update d_process examples. 2023-10-28 19:43:36 +02:00

README

The d_process Xspice model was created by Uros Platise.

A complete, non-trivial example is located at:
  https://www.isotel.eu/mixedsim/embedded/motorforce/index.html

This directory contains a simple test of the d_process model.

Compile the programs that are called from within d_process:

  ./compile.sh   (on Linux or Cygwin on Windows)

In a Windows Powershell using VisualC, copy compile.bat.txt to compile.bat,
then use it. In a Mingw Msys shell, you can use the VisualC compiled programs,
or use compile.sh. In both these environments the programs need to be compiled
this way to use binary mode pipes.

Run the test case (comment out the gtkwave lines or use plot if you like):

  ngspice prog1-4.cir

To clean up:

  ./clean.sh

NOTE that the prog-pipes.cir test needs fifos created on Linux or Cygwin
on Windows. This is not available on Windows VisualC or Mingw builds.

  mkfifo graycode_in
  mkfifo graycode_out

before ngspice prog-pipes.cir, and in another shell:

  ./graycode --pipe

needs to be started.

The file checks.cir can be run to test the error handling in d_process.

==============================================================================

NOTE ON DEBUGGING. On Linux or Cygwin on Windows, gdb can be attached to
the running d_process programs, or in --pipe mode with fifos, the graycode
example can be run when invoked from gdb.

From a Windows Powershell, WinDbg can be attached to a running d_process
program.

To enable the debugging hooks in the programs (graycode.c, prog1in4out.c,
prog4in1out.c), edit them to #define ENABLE_DEBUGGING. The debugging
hooks are in the debugging.h include file.

Each program prints (to stderr) its process id when started. This makes
it easier to know the process when attaching a debugger.

All the programs (graycode.c, prog1in4out.c, prog4in1out.c) contain a call
to debug_info() which calls sleep() to give you time to attach a debugger.
Just after the sleep() call, there is a call to known_bp() on which you can
set a breakpoint. The sleep() is enabled by:

  export GO_TO_SLEEP=1   (on Linux, Cygwin)
  $env:go_to_sleep = '1' (on Windows Powershell)

Don't forget to remove the environment variables after use, or the
prog1-4.cir will sleep (for up to 1 minute) each time you rerun it.