I'm using the vhpi interface in ncsim to connect a processor simulator written in C to a VHDL simulation. This all seems to work fine accept for seemingly random crashes (segmentation faults mostly). Sometimes a simulation runs fine for quite a while and sometimes it crashes very quickly.
Our C model uses pthreads to simulate the different parts of the processor and it uses semaphores (from libc) to synchronize between the ncsim pthreads and our own pthreads (which are scheduled by our own thread scheduler).
The behaviour I see is that calls to the function "sem_wait" get interrupted and return without having acquired the semaphore. Can it be that ncsim is sending interrupts to its threads?
Also, when attaching GDB to the ncsim process, the thread behaviour changes and it gives a segfault somewhere else.
All in all I'm unable to pinpoint the exact problem, so I'm asking if anybody knows more about the way ncsim treats its threads.
BTW, I'm using ncsim 5.7 at the moment.. are there any known bugs with this version perhaps?
Thanks very much for your time.