RE: Are array parameters in functions allowed?

From: Muranyi, Arpad <arpad.muranyi_at_.....>
Date: Thu Jun 14 2007 - 07:56:38 PDT
Shalom,

Are you sure about that?  The example I see in
1364-2005 Section 10.4.3 seems to sow an array
input parameter:


function [7:0] getbyte;
input [15:0] address;
begin
// code to extract low-order byte from addressed word
. . .
getbyte = result_expression;
end
endfunction


Or did I misunderstand that example?

Thanks,

Arpad
================================================= 

-----Original Message-----
From: Bresticker, Shalom 
Sent: Thursday, June 14, 2007 6:39 AM
To: David Miller; Muranyi, Arpad
Cc: Verilog-AMS LRM Committee
Subject: RE: Are array parameters in functions allowed?

In digital, they are not allowed in Verilog (1364), but they are allowed
in SystemVerilog (1800).

Shalom

> -----Original Message-----
> From: owner-verilog-ams@server.eda.org [mailto:owner-verilog-
> ams@server.eda.org] On Behalf Of David Miller
> Sent: Wednesday, June 13, 2007 9:08 PM
> To: Muranyi, Arpad
> Cc: Verilog-AMS LRM Committee
> Subject: Re: Are array parameters in functions allowed?
> 
> Muranyi, Arpad wrote:
> > Hello everyone,
> >
> > Sorry for bringing this questions to this forum, but
> > the information in the v2.2 LRM doesn't answer my
> > question.
> >
> > I wonder whether arrays are allowed as parameters to
> > analog (or digital) functions.  Section 4.6 doesn't
> > give enough detail on the "function_item_declaration"
> > to answer this question, and I am getting an error
> > message from my favorite simulator when I do this:
> >
> >   analog function integer FindCursorIndex;
> >     input Wfm[1:100];
> >     ...
> >     ...
> >     ...
> >
> > Error: Illegal array parameter 'Wfm' in function 'FindCursorIndex'
> >
> > Thanks,
> >
> > Arpad
> > ======================================================
> >
> >
> Hi Arpad,
> 
> Yes array parameters are allowed as the arguments to an analog udf.
> In the latest version of the LRM currently under review, this has been
> clarified with regards to the syntax. Also array parameters were valid
> in LRM 2.2, when we introduced the output, inout direction
> declarations.
> 
> So you should be able to have:
> 
> analog function integer FindCursorIndex;
>     input [1:100]Wfm;
>     integer Wfm[1:100];
> 
> .....
> parmaeter integer P[1:100] = {.......};
> 
> analog begin
>     ... = FindCursorIndex(P);
> 
> 
> Take care where the range is specified, I think, since Wfm is a 'port'
> the range (width) is on the left, and then when you declare the local
> integer variable, it is an array so the range is on the right. At
> least
> this is the case for Analog.
> 
> Cheers....
> Dave

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Jun 14 07:57:18 2007

This archive was generated by hypermail 2.1.8 : Thu Jun 14 2007 - 07:57:52 PDT