vpiMemory and callbacks

Thanks for the info. Between that and some sample code from Icarus I
managed to get something working. I'll definitely snag that book;
from what I see on google print it looks very worthwhile. I have an
interim fix that works, but yes, memory accesses aren't exactly
efficient and there are probably ways to optimize things.

-Tony
 

Guest
Is it possible with the VPI to set up a callback so it fires when
individual memory words change value (callback on the handles returned
from iterating/scanning for vpiMemoryWords), or something similar such
as the trapping any change in a memory handle and dealing with the
array as a whole during cbReadOnlySynch?

I'm working on interfacing to a dumper that can handle arrays and
cbValueChange works great for everything else. I looked through the
newsgroup for references to "vpiMemory" and noticed it's only been
mentioned once ever on any of the google newsgroups so I'm wondering
if vpiMemory is a hopeless cause and that I should be using some
different mechanism. Anything that works with NC or SV is fine. I'm
currently hashing out some code with cver, but that's only temporary
so I can get up to speed with VPI fundamentals. I have no idea if
parts of the VPI in question are unimplemented with cver.

(Note that I can access the IEEE specs so if the relevant info is in
there and it's a long answer--I just need to be pointed to the right
section and functions if that's the case.)

Thanks!
-Tony

[google groups gave me an error message--hope this isn't a duplicate]
 
First, get a handle to the memory. Either via vpi_handle_by_name, or
by taking it from a parameter of a calltf function you wrote, or what
have you. Then use vpi_iterate to get the particular element from the
memory array you are interested in. Once you have that you can use
vpi_register_cb to setup a callback on it.

If you don't already have it, I'd recommend getting THE VERILOG PLI
HANDBOOK by Stuart Sutherland. The IEEE LRM is simply an exercise in
frustration when it comes to the VPI/PLI. Refer to Chapter 4.5.7 for
getting a handle to a memory array element, and Chapter 6.8 for
setting up callbacks.

Also, most simulators disable VPI/PLI access to memories by default,
because it can really degrade performance. For example, you need add
+memcbk to VCS's compile in order for callbacks attached to memories
to actually work.

Ryan

On Feb 13, 10:48 pm, byb...@gmail.com wrote:
Is it possible with the VPI to set up a callback so it fires when
individual memory words change value (callback on the handles returned
from iterating/scanning for vpiMemoryWords), or something similar such
as the trapping any change in a memory handle and dealing with the
array as a whole during cbReadOnlySynch?

I'm working on interfacing to a dumper that can handle arrays and
cbValueChange works great for everything else. I looked through the
newsgroup for references to "vpiMemory" and noticed it's only been
mentioned once ever on any of the google newsgroups so I'm wondering
if vpiMemory is a hopeless cause and that I should be using some
different mechanism. Anything that works with NC or SV is fine. I'm
currently hashing out some code with cver, but that's only temporary
so I can get up to speed with VPI fundamentals. I have no idea if
parts of the VPI in question are unimplemented with cver.

(Note that I can access the IEEE specs so if the relevant info is in
there and it's a long answer--I just need to be pointed to the right
section and functions if that's the case.)

Thanks!
-Tony

[google groups gave me an error message--hope this isn't a duplicate]
 

Welcome to EDABoard.com

Sponsor

Back
Top