RE: [sv-cc] Multidimensional dynamic array in DPI-C

From: Radoslaw Nawrot <Radoslaw.Nawrot@aldec.com.pl>
Date: Wed Apr 11 2012 - 23:01:45 PDT

Sorry, You are right. But still in that case I will have size 4 and for y[0]
I have only one element so If I use for loop I will have sigsegv
 
 
Radek

  _____

From: Bresticker, Shalom [mailto:shalom.bresticker@intel.com]
Sent: Sunday, April 08, 2012 1:59 PM
To: Radoslaw Nawrot; sv-cc@eda.org
Cc: 'Oleg Demchenko'; 'Daniel Mlynek'
Subject: RE: [sv-cc] Multidimensional dynamic array in DPI-C

Why do you say,

 

"So all dynamic arrays should have size =0 ??"

 

Shalom

 

 

From: owner-sv-cc@eda.org [mailto:owner-sv-cc@eda.org] On Behalf Of Radoslaw
Nawrot
Sent: Thursday, April 05, 2012 9:31 AM
To: sv-cc@eda.org
Cc: 'Oleg Demchenko'; 'Daniel Mlynek'
Subject: [sv-cc] Multidimensional dynamic array in DPI-C

 

Hello,

 

I have two interpretation problems:

 

1.) array querying functions for multidimensional dynamic array

 

Example code:

module top;
import "DPI-C" function a(int i [][]);
int y [][];
 initial
 begin
 y=new[4];
 y[0] = new[1];
 y[1] = new[2];
 y[2] = new[3];
 y[3] = new[4];
 a(y);
 end
 initial #1000 $finish;
endmodule

 

What should be returned on c side by svSize:

extern "C" int a(svOpenArrayHandle hnd) {

file<<"Size d2: "<<svSize(hnd,2)<<std::endl;

return 0;

}

?

Should be 0 ($high - $low + 1)? Or maybe simulation error would be better in
that case?

 

LRM says:

$left shall return the left bound of the dimension. For a packed dimension,
this is the index of the

most significant element. For a queue or dynamic array dimension, $left
shall return 0.

- $right shall return the right bound of the dimension. For a packed
dimension, this is the index of

the least significant element. For a queue or dynamic array dimension whose
current size is zero,

$right shall return -1.

- For a fixed-size dimension, $increment shall return 1 if $left is greater
than or equal to $right

and -1 if $left is less than $right. For a queue or dynamic array dimension,
$increment shall

return -1.

- $low shall return the same value as $left if $increment returns -1, and
the same value as

$right if $increment returns 1.

- $high shall return the same value as $right if $increment returns -1, and
the same value as

$left if $increment returns 1.

 

So all dynamic arrays should have size =0 ??

 If yes than how user can get information to hull data by index if he(she)
doesn't know how many index;es array have?

 

2.) If I use svGetArrElemPtr1(hnd, 0) should it return another
svOpenArrayHandle ?

    If not then how user can get number of second dimension elements to use
svGetArrElemPtr2 ??

    The same question about svGetArrayPtr

Thanks in advance ,

 

Radek

-- 
This message has been scanned for viruses and 
dangerous content by  <http://www.mailscanner.info/> MailScanner, and is 
believed to be clean. 
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies. 
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Apr 11 23:02:38 2012

This archive was generated by hypermail 2.1.8 : Wed Apr 11 2012 - 23:02:48 PDT