The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 6th, 2024, 4:55am
Pages: 1
Send Topic Print
2D vector (i.e. array) as an input for an analog function? (Read 3690 times)
Vince Lee
New Member
*
Offline



Posts: 2

2D vector (i.e. array) as an input for an analog function?
Feb 24th, 2014, 3:21pm
 
Hi, I wonder if it is possible to pass a 2D vector into an analog function as an input argument? e.g.

analog function myfunc;
   input x[0:2][0:2];
   real x[0:2][0:2];
   ...
endfunction

Thanks!
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: 2D vector (i.e. array) as an input for an analog function?
Reply #1 - Feb 25th, 2014, 12:44pm
 
There's an example in LRM 2.3.1, section 4.7.1:

Example 3 — Initialization of a vector variable
The analog user defined function called arrayadd adds the contents of a second array to the first.
Code:
  analog function real arrayadd;
    inout [0:1]a;
    input [0:1]b;
    real a[0:1], b[0:1];
    integer i;
    begin
      for(i = 0; i < 2; i = i + 1) begin
        a[i] = a[i] + b[i];
      end
    end
  endfunction
 



I can't say whether it works in all simulators.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.