• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X Scripting - Skill
  3. Skill - access to pins List

Stats

  • State Verified Answer
  • Replies 5
  • Answers 1
  • Subscribers 18
  • Views 5723
  • Members are here 0
More Content

Skill - access to pins List

soll
soll over 3 years ago

Hello,

I am learning to use Skill language to develop scripts to automate some tasks on Cadence Allegro. As a training, I am trying to write a simple script that asks the user to select a symbol, and then the script lists all the pins on that symbol alongside the net name associated with the pin. I am using this very good serie of videos on the Cadence Youtube channel : https://youtu.be/bzXmQYvpCFc

I have some issues understanding how the different interactions between the design, the database and the language itself work. I have these two pieces of code :

axlSetFindFilter(?enabled list("noall" "symbols") ?onButtons list("noall" "symbols"))
axlSingleSelectPoint()
symb = axlGetSelSet()
length(symb~>pins)  -> RETURNS 1
pinsList = nth(0 symb~>pins)
length(pinsList) -> RETURNS THE CORRECT AMOUNT OF PINS

allDBids = axlDBGetDesign()
symb2 = nth(100 allDBids~>components)
length(symb2~>pins) -> RETURNS THE CORRECT AMOUNT OF PINS

As you can see, in the first code, I trigger a selection (forcing it to symbols), then get the result of that selection in a variable (symb), then asks what is the length of the "pins" list. It returns 1, whatever symbol I pick. To get a list with 1 pin per list element, I have to use the nth() function as shown above.
In the second code, I get the design DBids, then pick one (random) symbol in the list, and asks for the length of the "pins" list. It give the correct amount of pins right away.

Does anyone has an idea about what causes the symb~>pins list to have only one element (that is, in fact, the pins list itself) whereas symb2~>pins works as expected ? Maybe I am wrongfully using the axlSingleSelectPoint() function ?

Something I may add : When I try to use -> instead of ~> to access the lists, it returns nil everytime in the first code, but it does work with the second code, and I have absolutely no idea why.

Is there some place where I could find resources about Skill ? Do you know about some forum (else than this one that I don't want to pollute) or facebook group or anything where people discuss about this language ?

Thank you for taking the time to read this, and please excuse English, it isn't my primary language.

  • Cancel
  • Sign in to reply
Parents
  • B Bruekers
    +1 B Bruekers over 3 years ago

    One tip, look at each API what the possible return values are. This will save you a lot of headaches...  Most of them you can find back in the Allegro SKILL Reference document. (see help documents)

    From the API description of axlGetSelSet() :

    lo_dbid List of figure dbids.
    nil Select set is empty.

    So it always returns a list when something is selected. Even in the case if only 1 item is selected.

    Each entry in 'symb = axlGetSelSet()'  is a symbol database ID. This symbol ID contains a list, a so called disembodied property list (DPL). This is basically a list of names and values.  For example a name in the Allegro symbol DPL is 'pins'. You can find all entries in the 'The Allegro PCB Editor Database User Model'  chapter in Allegro SKILL Reference documentation.

    A basic LISP operation to get the 1st element of a list is car()

    With the '->'  you can access a variable inside a DPL  It returns a single item which can be any valid variable type (list, float, string, etc)

    With '~>'  iterates over a list of items and tries to return the value of the given name. It returns a list containing the values which are inside the requested name

    So;

    symbols = axlGetSelSet()   returns a list of selected symbol(s)

    symb = car(symbols)  ; get first item from list

    pins = symb->pins ; is a list of pins. Each pin is a database ID. So the list looks like this: (dbid1 dbid2 dbidn)

    length(symb->pins)  ; returns pin count, same as length(pins) since 'pins' was set to symb->pins

    By using symbols~>pins  you will get a list containing lists of pins.  If there was only 1 symbol selected then the length(symbols~>pins) returns 1, since there is only 1 'pin list'

    Do you want to iterate over all symbols:

    foreach(symb symbols

     pins = symb->pins

     println(length(pins))

    )

    symb2 = nth(100 allDBids~>components)
    length(symb2~>pins) -> RETURNS THE CORRECT AMOUNT OF PINS

    This is because you assigned symb2 to the 100th item in the list of symbols. The ~> instead of -> in this case is working since the 'pins' itself is a list.  However i suggest not to use ~> in any case, unless you are certain that you can not do without it.

    Some small exercise:

    axlDBGetDesign()->components                  Returns a list of component dbids
    axlDBGetDesign()->components->pins             does not work. There is no single 'pins' property name inside the list of components.
    axlDBGetDesign()->components->pins~>number  Same as above, component->pins returns nil, so no single 'number' property can be accessed.
    axlDBGetDesign()->components~>pins->number  does not work. list with pin lists does not have a single property name 'number'
    axlDBGetDesign()->components~>pins~>number  returns a list with lists of pin numbers

    Difference between ->components and ->symbols:

    axlDBGetDesign()->components  contains all component instances imported from the netlist. No physical data like location, rotation etc.

    axlDBGetDesign()->symbols contains all placed symbols instances in the PCB, so also the location, rotation etc.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • soll
    0 soll over 3 years ago in reply to B Bruekers

    Thank you for taking the time to reply !
    OK, it now makes sense that I only have one item in the first code : axlGetSelSet doesn't return the object selected, but a list of objects ; in this case, a list with 1 element... That is clear now.

    You mention the chapter "The Allegro PCB Editor Database User Model" in Allegro SKILL Reference documentation. May I ask where I could find this document ? In Allegro's installation directory, there are a few documents but none of them has that chapter, and when I search the web, I mostly find the same documents, plus some other about functions that are only working within Virtuoso or with Framework II (not sure what that on is).

    B Bruekers said:

    With the '->'  you can access a variable inside a DPL  It returns a single item which can be any valid variable type (list, float, string, etc)

    With '~>'  iterates over a list of items and tries to return the value of the given name. It returns a list containing the values which are inside the requested name

    Ok so -> gives you access to what we could compare to a "pointer" in C whereas ~> only gives you the value of the item, but is not linked to it directly ? Or am I completely wrong ?

    Anyway, I rearranged the code to something that looks more like what you wrote and now -> works ! I am not sure exactly why but it is already a good step :p

    Thank you a lot for the exercises, I will try fiddling around with those tomorrow morning.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • soll
    0 soll over 3 years ago in reply to B Bruekers

    Thank you for taking the time to reply !
    OK, it now makes sense that I only have one item in the first code : axlGetSelSet doesn't return the object selected, but a list of objects ; in this case, a list with 1 element... That is clear now.

    You mention the chapter "The Allegro PCB Editor Database User Model" in Allegro SKILL Reference documentation. May I ask where I could find this document ? In Allegro's installation directory, there are a few documents but none of them has that chapter, and when I search the web, I mostly find the same documents, plus some other about functions that are only working within Virtuoso or with Framework II (not sure what that on is).

    B Bruekers said:

    With the '->'  you can access a variable inside a DPL  It returns a single item which can be any valid variable type (list, float, string, etc)

    With '~>'  iterates over a list of items and tries to return the value of the given name. It returns a list containing the values which are inside the requested name

    Ok so -> gives you access to what we could compare to a "pointer" in C whereas ~> only gives you the value of the item, but is not linked to it directly ? Or am I completely wrong ?

    Anyway, I rearranged the code to something that looks more like what you wrote and now -> works ! I am not sure exactly why but it is already a good step :p

    Thank you a lot for the exercises, I will try fiddling around with those tomorrow morning.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information