Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ADS & AEL for macro use

Status
Not open for further replies.

diedjee

Newbie level 1
Joined
Apr 14, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Leuven
Activity points
1,294
Hello everybody,

Since a long time I stumbled upon this site when searching for some answers using google.
But recently I got a problem on which I don't find an answer immediately.

I'm using ADS to automatically create inductor lay-outs and simulate them.
Since some weeks, I drew these lay-outs manually but now I would like to parametrize them.
For that purpose, I am using macros and AEL scripts.

Because it is the first time I am writing AEL code, te likelihood that I'm introducing some bug is very big but most of the time I am able to fix it using the manuals and internet.

Recently an error showed up which I an unable to find a solution for.

The following script creates a regular polygon. The error occurs when it tries to write to the last index of the array. (functions.ael line 71, column 3 in assignment) left operand invalid array access)
Increasing the size of the array doesn't help much.

To use the script, you must create a path in lay-out mode and apply this script upon it. Then compile, set the default values, save and add it as a component to another lay-out. (Then the error appears)

Alternatively, use the files in attachment...

(I left my debug printouts enables so you can see what's going on...)
Code:
defun n_agon(n, radius)
{
  fputs(stderr, "nagon start");
  decl pnts;
  //decl nb;
  //nb = n;
  
  pnts = {{0, 0}};
  pnts=resize_array(pnts, 1, 0, n+1);
  pnts=resize_array(pnts, 2, 0, 1);
  
  pnts[0, 0] = radius * cos((PI / (2 * n)));
  pnts[0, 1] = radius * sin((PI / (2 * n)));
  
  fputs(stderr, identify_value(pnts));
  fputs(stderr, "nagon loopstart");
  decl i;
  for(i=1; i<=n; i++)
  {
    pnts[i, 0] = radius * cos((i * 2 * PI / n) + (PI / (2 * n)));
    pnts[i, 1] = radius * sin((i * 2 * PI / n) + (PI / (2 * n)));
    fputs(stderr, strcat(i, ""));
  }

  fputs(stderr, "n+1=");
  fputs(stderr, strcat(" ", n+1));
  fputs(stderr, ",pnts=");
  fputs(stderr, strcat(" ", array_upperBound(pnts, 1)));
  fputs(stderr, identify_value(pnts));
  
  decl end_pnts;
  end_pnts = n+1;
  
  fputs(stderr, strcat("end_pnts=", end_pnts, ",n=", n, ",upper1=", array_upperBound(pnts, 1), ",upper2=", array_upperBound(pnts, 2)));
  
  pnts[end_pnts, 0] = radius * cos(PI / (2 * n));
  pnts[end_pnts, 1] = radius * sin(PI / (2 * n));
  
  fputs(stderr, "nagon finish");
  return (pnts);
}

Any help would be appreciated!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top