Forums » Using AUTOs »
Calling nth element from an array in AUTO_TEMPLATE
Added by Sandip Das 7 months ago
Hi,
i have the following situation :
i am using regular expression to grab the "CPU number" from the port name and
using that number to index into the corresponding "entry" from array "CpuOrder" and substitute that in
the signal name
/*AUTO_LISP(setq CpuOrder '(
"2"
"4"
"8"
"12"
))*/
/* BlkA AUTO_TEMPLATE (
.Cpu\([0-9]+\)BlkA\(.*\) (Cpu@"( nth \1 @ CpuOrder)"BlkA\2[]),
);
*/
Example of it's implementation would be :
BlkA BlkA ( /*AUTOINST*/
.....
.Cpu2BlkAtxn (Cpu8BlkAtxn[9:0]),
.....
);
my effort to make it work with the above AUTO_TEMPLATE did not work.
i guess you need to define the function to do the abstraction outside the template.
how do i do that ? i am very new to using LISP in emacs AUTOs :)
thanks,
Sandip
Replies (4)
RE: Calling nth element from an array in AUTO_TEMPLATE - Added by Wilson Snyder 7 months ago
You just have a spurious @ in the nth.
.Cpu\([0-9]+\)BlkA\(.*\) (Cpu@"( nth \1 CpuOrder)"BlkA\2[]),
Nice usage, BTW.
RE: Calling nth element from an array in AUTO_TEMPLATE - Added by Sandip Das 7 months ago
removing the second @ did not work i get the message "Symbol's value as variable is void: CpuOrder"
RE: Calling nth element from an array in AUTO_TEMPLATE - Added by Wilson Snyder 7 months ago
Are you sure the AUTO_LISP is above the first usage of it? If so, please send a complete example as I tried it and it's ok for me.
RE: Calling nth element from an array in AUTO_TEMPLATE - Added by Sandip Das 7 months ago
i apologize :) our xemacs set up is kind flaky. i had to close and open the file couple of times and retry the "Recompute AUTO" before the desired expansion took effect. i have run into this issue before. acted on a hunch again to close/open the file. thanks for your help. - Sandip
(1-4/4)
![[logo]](/img/veripool_small.png)