vpi_put_value

S

SrFPGA

Guest
Hi,

vpi_put_value() returns a vpiHandle and to free that handle, The
Verilog PLI Handbook uses vpi_free_object() on the vpiHandle
returned. Did anyone have success freeing the handle.

Thanks in Advance


Sarma
 
Not sure what you are doing exactly - usually I just call vpi_put_value
without assigning it to a vpiHandle.

The function will usually return NULL, unless you OR the fourth
parameter input with vpiReturnEvent.

If you are ORing the flag, and expect a vpiHandle, it shows that it's of
type vpiSchedEvent. I'm assuming that is a scheduled event. Is it
possible you are scheduling an event, and then telling it to free the
handle before the event is scheduled?

I'm really reaching here, as I have never used the return value of
vpi_put_value. I'd be interested to hear how you are applying it. I
could set up a test snippet pretty easily if I know what flag and time
property you are using.



SrFPGA wrote:
Hi,

vpi_put_value() returns a vpiHandle and to free that handle, The
Verilog PLI Handbook uses vpi_free_object() on the vpiHandle
returned. Did anyone have success freeing the handle.

Thanks in Advance


Sarma
 
Thanks for your answer. I am using vpinodelay and NULL for the time
property.

Sarma
 
I can tell you the implementation of the synopsys vpi_put_value. ( i.e
VCS)

The function is defined as vpi_handle vpi_put_value(...

Now, only for a scheduling event does it return a handle. So you can
free that.
DO a check on the handle returned in your case. It will be a NULL for
VCS in all the other cases.


Or you can forward me the scenario in your case.
-Parag
 
On Fri, 14 Sep 2007 13:03:15 -0700, SrFPGA wrote:

Thanks for your answer. I am using vpinodelay and NULL for the time
property.

Sarma
You will only get a handle back if the value was scheduled to
happen some time in the future.

vpiHandle schedH;

schedH = vpi_put_value(regh, someValue, SomeTime, vpiPureTransPortDel);


With the returned handle, assuming it is non NULL you can

) Query the event to see if it is still active.
vpi_get(vpiScheduled, schedH);

) Cancel the event if it has not already happened
vpi_put_value(schedH, NULL, NULL, vpiCancelEvent);

It is upto the user to free the handle when they are done
with it or no longer wish to cancel an existing event.

vpi_free_object(schedH);

Untill you call vpi_free_object() on the handle it has to remain
valid. Freeing the handle will not effect the scheduled event it
just tags the handle as being free and allows the memory to be
reused.
 

Welcome to EDABoard.com

Sponsor

Back
Top