Hi,
I have a working uvm_driver which has all tasks to read and write registers.
Now I want to reuse these tasks in my c code for bringup. Systemverilog DPI supports this using “export”.
But when I exports the tasks in my uvm_driver I run into compile issues !
Any help is appreciated.
Hi Dave
Thanks for the reply.
Couple of questions
You have said:
my_driver h; // Someone needs to initialize this
How could this be done? We could do h = my_driver_handle(assuming my_driver_handle was created in say an agent), but that can be done only inside a class.
“your C code needs to be invoked by importing a C task” - Not sure why this is needed for an “export”?
You could also put it in the config database or use find_component
task do_something_wrapper(something arguments);
static my_driver h;
if (h==null) begin <get from config_db or use find_component> end
h.do_something(arguments);
endtask
About your C code being imported, I think you need to get further along before you will understand the issue.
I am trying to import and export in the sequence/virtual sequences scope.
I am successfully able to import C functions, but having a problem with exporting virtual task defined in these sequences, since DPI exports only export task and function defined in modules/ Packages.
Don’t just mention you have a problem, describe it.
As I stated above, you need a wrapper task that you export, and it calls the virtual task you want. Also, you need to import your C routines as a task, not a function, to call another task.