You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with DPI exported tasks and functions, I spent some time trying to resolve run-time errors such as:
%Error: unknown:0: Testbench C called 'a_read' but scope wasn't set, perhaps due to dpi import call without 'context'
%Warning: vlt/t_dpi_accessors: Exec of obj_dir/t_dpi_accessors/Vt_dpi_accessors failed
I realized that it is necessary to set the scope, so that the task can resolve names referenced within the task. For example, after instantiating the model, but before calling any task or function calling:
svSetScope (svGetScopeFromName ("dut.v"));
There are other ways of doing this, particularly when using DPI imported functions, which can be used to get the scope. But in this case I was using purely exported functions and tasks.
For the non-SystemVerilog expert this is not immediately obvious, so I propose some additional text for the user manual DPI section. I am not an expert in this area, so please modify as appropriate.
Attached as git diff against current HEAD (commit a8432ed).
The text was updated successfully, but these errors were encountered:
Author Name: Jeremy Bennett (@jeremybennett)
Original Redmine Issue: 452 from https://www.veripool.org
Original Date: 2012-03-08
Original Assignee: Jeremy Bennett (@jeremybennett)
When working with DPI exported tasks and functions, I spent some time trying to resolve run-time errors such as:
I realized that it is necessary to set the scope, so that the task can resolve names referenced within the task. For example, after instantiating the model, but before calling any task or function calling:
There are other ways of doing this, particularly when using DPI imported functions, which can be used to get the scope. But in this case I was using purely exported functions and tasks.
For the non-SystemVerilog expert this is not immediately obvious, so I propose some additional text for the user manual DPI section. I am not an expert in this area, so please modify as appropriate.
Attached as git diff against current HEAD (commit a8432ed).
The text was updated successfully, but these errors were encountered: