I have the following scenario : I have a vpi callback that is triggered when an assertion is triggered. In this callback I want to call an export system verilog function I tried to setSvScope before the export but simulator gives me some errors.
Is it possible to call export function in VPI callback
1000 Views Asked by Viktorinox At
2
There are 2 best solutions below
1
Serge
On
Usually when vpi invokes a callback function, there is no DPI contents available at this time. So, you need to look it up before calling the exported dpi:
svScope scope = svGetScopeFromName("path.to.your.export.scope");
svSetScope(scope);
where the scope is the one which exports the function. For the exports from the global scope the $unit could be used for the scope name.
Related Questions in SYSTEM-VERILOG
- Tick-including a header file inside package in systemverilog
- How to use throughout operator in systemverilog assertions
- Packed vs unpacked array
- Creation of array in Verilog that can store real values
- What does Z in Verilog stand for?
- Properly including a .vh in a .sv file?
- Verilog generate statement : conditional port connections
- How to pass a class between two modules?
- What is the meaning of this code statement in verilog?
- importing VHDL packages to SV from libraries other than WORK
- How to demonstrate a 32-bit MIPS with FPUs in a FPGA?
- SystemVerilog DPI returning string from C++ to verilog - ASCII charaters at the end?
- SystemVerilog: derive input width from parameter
- What is advantage of structure?
- How to access the structures from testbench
Related Questions in SYSTEM-VERILOG-ASSERTIONS
- How to use throughout operator in systemverilog assertions
- system verilog assertion disable condition
- How to use recursive properties in Systemverilog
- Error in system verilog 2012 Reference guide regarding non-blocking in always_comb ? and delayed assertion property marker?
- SystemVerilog always @ sequence
- Can I use bind inside generate block
- Assertion fails despite equality being true
- SVA assertion compile syntax errors
- Evaluation at posedge of SVA assertions
- SVA for verifying that two signals are equivalent after some delays
- What is the difference between the symbol '->' and '|->' in System Verilog Assertion Properties
- Gate-level timing checks in SVA
- Meaning of |-> 1[0:$] in assertions
- Qualifying SVA's ##[0:$] in a simulation
- Can I generate a number of SystemVerilog properties within a loop?
Related Questions in SYSTEM-VERILOG-DPI
- SystemVerilog DPI returning string from C++ to verilog - ASCII charaters at the end?
- SystemVerilog: How to connect C function using DPI call in VCS simulator?
- SystemVerilog DPI-C pointers
- In DPI-C, what data types to be used for internal variables?
- regexp in hdl path for UVM hdl access functions
- Integrating fftw C function calls inside system verilog code
- undefined reference to `main' in C
- System Verilog DPI - unknown array size
- Accessing a shared memory
- System verilog simulation performance for uvm_hdl_read vs assign statement
- is there any API to convert "svLogicVecVal *" to "uint_8"?
- DPI-C export of a task defined inside a SystemVerilog class
- Unable to access dimensions of svOpenArrayHandle
- Get port name in SystemVerilog
- How to compile and run a verilog program which calls C function?
Related Questions in VPI
- In Verilog Procedural Interface, is it possible to scan through iteration loop several times?
- How to add a new key to a Systemverilog associative array using VPI
- How to check if a Systemverilog associative array has a key using VPI
- Pass an array element to vpi_handle_by_name
- Is it possible to call export function in VPI callback
- How to read memory value at a specific location using VPI and verilator?
- Is it possible to iterate systemverilog associative array with non-int index type through VPI c function?
- Reading array of regs using Verilator and VPI
- Time unit for VPI call back on signal value change
- Obtaining signal names in the design (using VPI calls)
- How to get dimensions of a verilog vector port using PLI routines?
- Allocated structure for value_p to be used with VPI vpi_put_value()
- Call task or function via VPI
- What API to use for a Verilator test harness?
- SystemVerilog looping through hierarchy
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Calling an DPI exported routine from a routine that has not been DPI imported is left undefined by the 1800-2012 LRM (See section 35.5.3 Context tasks and functions)
The exported DPI routine when called needs two key pieces of information to behave like any other routine that would have been called by SystemVerilog instead of C. It needs a scope context and a process context.
For the scope, it’s possible to have multiple DPI exports with the same name. In fact, it is possible to have a DPI import/export pair in a module, and that module gets instantiated multiple times. Even though the import calls the same C code, its context gets set from the caller’s scope and that scope gets matched with the exported scope. The DPI provides a
svSetScoperoutine to do this explicitly if the implicit DPI imported routine does not.For the process, there are many things you can do like
disable, or suspend it. The DPI provides no mechanism to set this explicitly.Some tools(like Questa) do provide a mechanism to do this for a limited set of use cases. For example, you can only call a DPI exported
functionfrom non-DPI imported C/C++ code. A task cannot be called because it has the potential to block, and that interferes with any process context.