[sv-bc] Re: [sv-cc] DPI imported task can have dynamic array as formal argument??

From: Dhiraj Kumar Prasad <dhiraj_at_.....>
Date: Thu Jan 17 2008 - 01:51:44 PST
Hi Doug,

Is the following example legal??

module tmp(input bit [3:0] in1,output bit [3:0] out1);

import "DPI-C" task task1(input bit in1[],output bit out1[]);

always@(in1)
out1 = in1;
endmodule

Thanks,
Dhiraj



Warmke, Doug wrote:

> Dhiraj,
>
>  
>
> No, the text you highlighted in red applies to actual arguments, not 
> formal arguments.
>
> Any formal arguments of an import must have a representation in C.
>
> Since bit and logic vectors have no natural C representation, Annex F goes
>
> out of its way to define typedefs and supporting infrastructure that are
>
> the C representation of bit and logic vectors.
>
>  
>
> The closest thing to a dynamic array in an import formal would be an 
> open array.
>
> That has the same [] syntax as dynamic array, but very different 
> semantics.
>
> Read in Annex F to learn all about open arrays.
>
>  
>
> Regards,
>
> Doug
>
>  
>
> *From:* owner-sv-cc@server.eda.org [mailto:owner-sv-cc@server.eda.org] 
> *On Behalf Of *Dhiraj Kumar Prasad
> *Sent:* Wednesday, January 16, 2008 9:06 PM
> *To:* sv-bc@server.eda.org; sv-cc@server.eda.org
> *Cc:* Dhiraj Kumar Prasad
> *Subject:* [sv-cc] DPI imported task can have dynamic array as formal 
> argument??
>
>  
>
> Hi,
>
> According to LRM P1800.2005, the different section says about the use 
> of dynamic
> array as formal argument of imported/exported task/function.
>
>
> 26.1.2
>
> Formal arguments of an imported function can be specified as open arrays.
>
> 26.4.6
>
> In exported DPI tasks or functions, it is erroneous to declare formal 
> arguments of dynamic array types.
>
> 26.5.1.1
>
> It is sometimes permissible to pass a dynamic array as an actual 
> argument to an imported DPI task or function.
>
>
> 26.4.6.1
>
> Formal arguments of imported functions can be specified as open arrays.
>
> So is dynamic array permited in formal argument of imported task??.
>
> Thanks,
> Dhiraj
>
>
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
>




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Jan 17 01:58:07 2008

This archive was generated by hypermail 2.1.8 : Thu Jan 17 2008 - 01:58:24 PST