Is it possible in SystemVerilog to call a DPI-C routine, let it run in the background and exchange new inputs and outputs with it periodically?
In my application, I’m calling the Python interpreter in C++ and passing information to SystemVerilog through DPI-C. I can only call the DPI-C routine once and can not call it again later in the simulation; due to a limitation in how some Python libraries, like NumPy, are modelled. If the DPI-C routine is called again, the Python interpreter is reinitialized and some imported libraries will cause the code to crash.
So, is it possible to workaround this issue by calling this DPI-C routine one, let it run in parallel and pass new inputs to it and get a new output?