Are there established methods of “allowing” C code to monitor simulation (simulated) time, so that the C code could perform function(s) based on simulation time? Basically to get SV’s $time accessible to C code. I think it’s possible to pass $time to the C code on every DPCI-C function call, but that’s not pretty. Are there ways for the C code to access (get, and perhaps even set) SV variables?
Note that although (I think) DPI-C C code is meant to be primarily invoked from SV code, the C code here is running in pthread(s), so the execution order of the Questa simulation (engine) and the C code is not quite clear to me (yet). I will likely have follow-on questions (or do more experiments myself) to get more clarity on these kind of things.
My current need for greater SV-to-C communication/interaction is to improve the way C code can throttle sequencer data, although these mechanisms will be useful for lots of other testbench functionality.
Thank you in advance for any help.