[sv-cc] Interpretation problem with vpiClasObj

From: Radoslaw Nawrot <Radoslaw.Nawrot@aldec.com.pl>
Date: Mon Oct 10 2011 - 07:23:20 PDT

Hello,
I like to ask question about classes in vpi:
 
I have such example :

class A;
    int i;

    function new(int a);
    i=a;
    endfunction
 
endclass
 
module top;
 
A a1=new(1);
A a2=new(0);
 
initial
begin
$basic_test;
#2;
a2=a1;
a1=new(2);
#2;
$basic_test;
#5;
end

endmodule
 
basic_test:

extern "C" PLI_INT32 basic_test( PLI_BYTE8 *user_data)
{
 s_vpi_error_info err;
 static vpiHandle hnd=vpi_handle_by_name("top.a1.i",0);
 if(!hnd)
   {
    vpi_chk_error(&err);
  vpi_printf("hnd %s",err);
  return 1;
   }
 t_vpi_value val;
 val.format=vpiIntVal;
 vpi_get_value(hnd,&val);
 vpi_printf("%0d\n",val.value.integer);
 return 0;
}
 
My question is wath value should I receive ?
I'd expected to recived :
1
1
 
but many simulators works in different way (I receive value "2" and second
time).
 
Way I'm thinking:
static hnd points to signal correlated with vpiClassObj. So if I have copy
of vpiClassObj and I'm sure that it still in memory, I soulde be able to get
value from signal "i"
Am I right ??
 
Accorting to LRM variables are get via class obj:

 
 
Thanks in advance,
 
Radek
 
 
 
 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Outlook.jpg
Received on Mon Oct 10 07:23:42 2011

This archive was generated by hypermail 2.1.8 : Mon Oct 10 2011 - 07:23:52 PDT