Hello I have a follow scenario where C->SV need to call a class task, the class is a singleton.
import “DPI-C” function int tb_process(input int data1[0x1000],output int data2[1000]);
export “DPI-C” task/function read_mem(sv_handle,data,size)
export “DPI-C” task/function write_mem(sv_handle,data,size)
class X
external task f();
read_mem(payload, size);
write_mem(payload, size);
endclass
task X::f();
read_mem(payload, size);
tb_process(handle_of_this, payload, size);
endtask
//C code
int tb_process(sv_handle, payload, size)
{
while(size>0)
{
pkt=parse_payload()
//call into SV to retrieve data from HW based on pkt info
read_mem(sv_handle,data_buff, size); //calls into SV exported routine
//process data_buff
write_mem(sv_handle,some_data, size); //calls into SV exported routine
}
}
Is he above idea doable? if yes, what code is missing?
if not can you please recommend a solution?
Thanks in advance