ncverilog PLI tf_{get,set}workarea non functionality

P

Peter Riocreux

Guest
I have bashed my head against a brick wall for a while now with no
luck, so I thought I would see if anyone can help.

I am using ncverilog v03.40.(s004) and completely failing to get
tf_{get,set}workarea working in any way, in either the elaboration or
run phase. Stuff that works in XL doesn't work in ncverilog. The
strange thing is that I am sure it *was* working at some point.

I have tried a simple test with:
{
acc_initialize ();
void *foo = tf_getworkarea();
fprintf(stderr, __FUNCTION__ " : foo=%08X\n", foo);
tf_setworkarea(1);
foo = tf_getworkarea();
fprintf(stderr, __FUNCTION__ " : foo=%08X\n", foo);
fprintf(stderr, __FUNCTION__ " : tf_instance=%08X\n", tf_getinstance());
fprintf(stderr, __FUNCTION__ " : acc_instance=%08X\n", acc_handle_tfinst());
.......

At the top of my _call function.

foo is consistently reported as 0, as is tf_getinstance().
acc_handle_tfinst() causes a segfault, as does
vpi_handle(vpiSysTfCall, NULL), so I have run out of ways to try to
get something I can use to find the workarea.

Can anyone enlighten me as to (a) why what I am doing doesn't work or
(b) how to get/set the workarea.

Peter

--
Peter Riocreux, Amulet Group, Dept. Computer Science, Manchester University,
Oxford Road, MANCHESTER, M13 9PL, UK. <http://www.cs.man.ac.uk/apt/>
 
Peter,
Is the code below being called during a call to a registered
callback function for a task or function. If not, then these
functions are not meaningful; of course, one would hope
that they do not crash. I would expect acc_handle_tfinst()
to return a NUL, just as apparently the tf_getworkarea and
tf_setworkarea are doing.

If you must use this functionality outside a callback function,
then you can use tf_igetworkarea() and tf_isetworkarea()
instead. To get the instance pointer for the call to these
functions you have two options.

1. Use tf_getinstance() during a call to a registered
callback function to get and store a pointer to the task or
function instance and use it later in the workarea functions.

2. You could iterate through all the scopes (using acc_next_scope,
acc_object_of_type, acc_next_topmod, etc.) in the design and find
all the task and function instances, save the ones you are interested
in and use them in the workarea functions.

BTW, most simulators have flags to turn on error reporting for PLI
calls, have you tried them?

Regards,
Sudhir

"Peter Riocreux" <priocreux@cs.man.ac.uk> wrote in message
news:9kbrtremh6.fsf@cs.man.ac.uk...
I have bashed my head against a brick wall for a while now with no
luck, so I thought I would see if anyone can help.

I am using ncverilog v03.40.(s004) and completely failing to get
tf_{get,set}workarea working in any way, in either the elaboration or
run phase. Stuff that works in XL doesn't work in ncverilog. The
strange thing is that I am sure it *was* working at some point.

I have tried a simple test with:
{
acc_initialize ();
void *foo = tf_getworkarea();
fprintf(stderr, __FUNCTION__ " : foo=%08X\n", foo);
tf_setworkarea(1);
foo = tf_getworkarea();
fprintf(stderr, __FUNCTION__ " : foo=%08X\n", foo);
fprintf(stderr, __FUNCTION__ " : tf_instance=%08X\n", tf_getinstance());
fprintf(stderr, __FUNCTION__ " : acc_instance=%08X\n",
acc_handle_tfinst());
.......

At the top of my _call function.

foo is consistently reported as 0, as is tf_getinstance().
acc_handle_tfinst() causes a segfault, as does
vpi_handle(vpiSysTfCall, NULL), so I have run out of ways to try to
get something I can use to find the workarea.

Can anyone enlighten me as to (a) why what I am doing doesn't work or
(b) how to get/set the workarea.

Peter

--
Peter Riocreux, Amulet Group, Dept. Computer Science, Manchester
University,
Oxford Road, MANCHESTER, M13 9PL, UK.
http://www.cs.man.ac.uk/apt/
 

Welcome to EDABoard.com

Sponsor

Back
Top