Re: Are array parameters in functions allowed?

From: David Miller <David.L.Miller_at_.....>
Date: Wed Jun 13 2007 - 11:08:03 PDT
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

-- 
=====================================
-- David Miller
-- Design Technology (Austin)
-- Freescale Semiconductor
-- Ph : 512 996-7377 Fax: x7755
=====================================


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jun 13 11:08:20 2007

This archive was generated by hypermail 2.1.8 : Wed Jun 13 2007 - 11:08:34 PDT