VPI passing argument

56 views
Skip to first unread message

Amrutha Ramdas

unread,
Oct 6, 2022, 11:32:47 AM10/6/22
to
Hi ,

I want to check for a signal inside a subsystem. I know the top level module name. and i want to pass this as an argument to VPI call as below :

$trace("top level module" , "subsystem name")

And i used below code:

static PLI_INT32 trace (PLI_BYTE8 * param)
{
vpiHandle systfref, args_iter, argh , module ,internal;
systfref = vpi_handle(vpiSysTfCall, NULL);
while (args_iter = vpi_iterate(vpiArgument, systfref)) {
argh = vpi_scan(args_iter);
vpi_printf ("Starting VPI function \n");
module = vpi_handle(vpiModule , argh);
internal = vpi_handle(vpiInternalScope , module);
vpi_printf ("Module is %s\n", vpi_get_str(vpiName , module));
vpi_printf ("Module is %s\n", vpi_get_str(vpiName , internal));
}
return 0;
}

void RegisterMyTfs( void )
{
s_vpi_systf_data systf_data;
vpiHandle systf_handle;
systf_data.type = vpiSysTask;
systf_data.sysfunctype = vpiSysTask;
systf_data.tfname = "$trace";
systf_data.calltf = trace;
systf_data.compiletf = 0;
systf_data.sizetf = 0;
systf_data.user_data = 0;
systf_handle = vpi_register_systf( &systf_data );
vpi_free_object( systf_handle );
}

void (*vlog_startup_routines[])() = {RegisterMyTfs,0};


Could any one please help is this right way to pass argument?

Thanks & Regards
Amrutha
Reply all
Reply to author
Forward
0 new messages