Reputation: 117
I'm implementing Verilog "force" and "release" using VPI so that they can be called from C routines. To force a value to a vector net, I need to create an array of s_vpi_vecval for value_p. I allocated a storage for the array and populated it with the value I want. Then I used vpi_put_value() to force the vector value to the net.
The standard, IEEE 1800, clearly says that the calling routine needs to allocate a space for such structure for value_p. But it didn't say when it is safe to free the storage. Is it safe to free the storage just after calling vpi_put_value()?
I assume, the vpi_put_value() will keep a copy of the force value in their side. Any insights to this are greatly appreciated.
Upvotes: 0
Views: 266
Reputation: 42698
I think it is safe to assume you can free the memory after making the VPI call - this is how all other VPI routines work.
You can easily test this by making two calls to dpi_put_value()
using the same struct pointer.
I've put in a request to have the IEEE standard clarified.
Upvotes: 1