returning multiple values from VPI task?

D

danmc91

Guest
Hello,

Is it possible to have a VPI task that returns reals and also returns
more than one value?

What I'm wanting to do is write a VPI task which will let me write a
test bench that runs for a bunch of clock cycles to fill up a memory,
then calls this task which will compute the fft of the sequence of
values in the memory and return the real and imaginary (or magnitude
and phase) in some other memory which I could then write out to a file.
For that matter, I could write it out to a .vcd file and use a
waveform viewer to look at the results.

I'm still very new to VPI and am struggling a bit with the "wonderful"
documentation that cadence provides.

-Dan
 
On Wed, 03 May 2006 13:22:30 -0700, danmc91 wrote:

Hello,

Is it possible to have a VPI task that returns reals and also returns
more than one value?
There is nothing in Verilog that will be able to read the
multiple values so you are looking at this incorrectly.

What you want to do is pass arguments to the system task that
will be set to contain the different values.

perhaps something like
reg retval;
reg [64:1] realval, imagval;

...

retval = $compute_what_ever(realval, imagval)

The return value can be a flag 1,0 or what ever if you need to
have one. The output of your calculation can be placed into
two argument registers realval and imagval.

You can get a handle to a system function using

myfunc = vpi_handle(vpiSysTfCall, NULL);

You can get the handle to the arguments by iterating

vpiHandle argIter, argH;

argIter = vpi_iterate(vpiArgument, myfunc);

while(argH = vpi_scan(argIter))
{
do what ever magic you want to the registers like
vpi_put_value(argH, &value, NULL, vpiNoDelay);
}

You return a value from a system function by putting a
value to it with no delay

vpi_put_value(myfunc, &value, NULL, vpiNoDelay);
What I'm wanting to do is write a VPI task which will let me write a
test bench that runs for a bunch of clock cycles to fill up a memory,
then calls this task which will compute the fft of the sequence of
values in the memory and return the real and imaginary (or magnitude
and phase) in some other memory which I could then write out to a file.
For that matter, I could write it out to a .vcd file and use a
waveform viewer to look at the results.

I'm still very new to VPI and am struggling a bit with the "wonderful"
documentation that cadence provides.

-Dan
 

Welcome to EDABoard.com

Sponsor

Back
Top