VCS PLI: vpi_put_value not working

Y

Yottameter

Guest
In my VPI code I have the following, in which I am trying to force
single bit ports to a 1:

s_vpi_value value_s;
value_s.format=vpiBinStrVal;
char myValue[2]="1";
value_s.value.str=myValue;
vpi_put_value(port_handle, &value_s, NULL, vpiForceFlag);

inside the loop of a module iterating over all the inputs of the module,
so port_handle contains an input port.

I know the following:
1. port_handle exists, I am able to print out the port name, and the
value of the port.
2. vpiForceFlag, vpiNoDelay, etc, do not work. I see the original values
and not the value I have forced, ie a '1'.
3. I'm using vcs, and I tried setting the cli to +cli+3, which didn't do
anything.
4. At the same time I call the PLI function that is supposed to force
the ports, I tried to force it via the verilog, this works.

It's coming down to the vpi_put_value just not 'put'ting the value. What
am I doing wrong here? I've tried integer assigns and scalar assigns as
well.

Joe
 
Hi Joe,

What simulation time are you setting for the delay? Here is the
innards of the teal code that does the same thing:

s_vpi_value v;
v.format = vpiVectorVal;
v.value.vector = (s_vpi_vecval*)teal_acc_vecval_;
s_vpi_time delay;
delay.type = vpiSimTime;
delay.low = 0;
delay.high = 0;
vpi_put_value (handle_, &v, &delay, write_policy_);
s_vpi_error_info error_data;
if (vpi_chk_error (&error_data)) {
local_log << teal_error << "Error in vpi_put_value: " <<
error_data.message << endm;
local_log << teal_error << "Error in vpi_put_value: at " <<
error_data.file << " " << error_data.line << endm;
}

I do not use string, but perhaps the format is wrong? Maybe it's
expecting a 1'b1 ?

Hope this helps.

Take Care,
Mike

On Aug 17, 5:25 pm, Yottameter <yottame...@yahoo.com> wrote:
In my VPI code I have the following, in which I am trying to force
single bit ports to a 1:

s_vpi_value value_s;
value_s.format=vpiBinStrVal;
char myValue[2]="1";
value_s.value.str=myValue;
vpi_put_value(port_handle, &value_s, NULL, vpiForceFlag);

inside the loop of a module iterating over all the inputs of the module,
so port_handle contains an input port.

I know the following:
1. port_handle exists, I am able to print out the port name, and the
value of the port.
2. vpiForceFlag, vpiNoDelay, etc, do not work. I see the original values
and not the value I have forced, ie a '1'.
3. I'm using vcs, and I tried setting the cli to +cli+3, which didn't do
anything.
4. At the same time I call the PLI function that is supposed to force
the ports, I tried to force it via the verilog, this works.

It's coming down to the vpi_put_value just not 'put'ting the value. What
am I doing wrong here? I've tried integer assigns and scalar assigns as
well.

Joe
 
Thanks for the suggestion, but the problem was that I didn't set up an
acc tab file correctly. I created a tab file that listed:

$myFunction data=0 acc+=read_write:* acc+=force:*

which worked.

Is there a better way to do this?




mmintz@gmail.com wrote:
Hi Joe,

What simulation time are you setting for the delay? Here is the
innards of the teal code that does the same thing:

s_vpi_value v;
v.format = vpiVectorVal;
v.value.vector = (s_vpi_vecval*)teal_acc_vecval_;
s_vpi_time delay;
delay.type = vpiSimTime;
delay.low = 0;
delay.high = 0;
vpi_put_value (handle_, &v, &delay, write_policy_);
s_vpi_error_info error_data;
if (vpi_chk_error (&error_data)) {
local_log << teal_error << "Error in vpi_put_value: "
error_data.message << endm;
local_log << teal_error << "Error in vpi_put_value: at "
error_data.file << " " << error_data.line << endm;
}

I do not use string, but perhaps the format is wrong? Maybe it's
expecting a 1'b1 ?

Hope this helps.

Take Care,
Mike

On Aug 17, 5:25 pm, Yottameter <yottame...@yahoo.com> wrote:

In my VPI code I have the following, in which I am trying to force
single bit ports to a 1:

s_vpi_value value_s;
value_s.format=vpiBinStrVal;
char myValue[2]="1";
value_s.value.str=myValue;
vpi_put_value(port_handle, &value_s, NULL, vpiForceFlag);

inside the loop of a module iterating over all the inputs of the module,
so port_handle contains an input port.

I know the following:
1. port_handle exists, I am able to print out the port name, and the
value of the port.
2. vpiForceFlag, vpiNoDelay, etc, do not work. I see the original values
and not the value I have forced, ie a '1'.
3. I'm using vcs, and I tried setting the cli to +cli+3, which didn't do
anything.
4. At the same time I call the PLI function that is supposed to force
the ports, I tried to force it via the verilog, this works.

It's coming down to the vpi_put_value just not 'put'ting the value. What
am I doing wrong here? I've tried integer assigns and scalar assigns as
well.

Joe
 

Welcome to EDABoard.com

Sponsor

Back
Top