• 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. Custom IC SKILL
  3. Multi dimensional array

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 143
  • Views 18321
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Multi dimensional array

sprinter
sprinter over 15 years ago

Hi,

How can I create multi dimensional array in order to name variables like:

cp_6_4

cp_5_3

cp_4_2

.

.cp_m_m-2

etc.

Thanks,

Adil.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 15 years ago

    Didn't you ask this before, and Derek responded with this?

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • sprinter
    sprinter over 15 years ago

    Hi Andrew,

    I think we're not on the same page on this one. The past inputs on array have been on one-dimensional arrays but I'm trying to do a multi dimensional array this time. I've tried to search the documentation (Skill language reference) but either I've overlooked it or else it's not there. Could you please clarify if multi dimensional arrays can be done & if so, then how? I shall much appreciate your input.

    Thanks,

    Adil.

    Andrew Beckett said:

    Didn't you ask this before, and Derek responded with this?

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 15 years ago

    Hi Adil,

    You can do this easily with a table:

    data=makeTable('myData 0) ; the 0 is the default value you want to return

    data[list(3 2)]=45
    data[list(5 6)]=123

    Because the table can have anything you want as the key, passing a list of an X and Y value is perfectly acceptable. Derek mentioned this in his post.

    Or you could create a multi-dimensional array very simply by using SKILL as follows. Essentially SKILL supports simple (single dimension) arrays, but it's easy to create an array which is an array of arrays).

    /* abMultiDimArray.il

    Author A.D.Beckett
    Group Custom IC (UK), Cadence Design Systems Ltd.
    Language SKILL
    Date Nov 23, 2009
    Modified
    By

    Function for creating a multi-dimensional array.

    Usage:

    data=abMultiDimArray(6 8)

    Creates a 6 by 8 array (starting index is from 0). Then you can use:

    data[4][5]=23
    data[0][7]=123

    You can specify more dimensions by passing more arguments to abMultiDimArray.

    ***************************************************

    SCCS Info: @(#) abMultiDimArray.il 11/23/09.16:24:27 1.1

    */

    procedure(abMultiDimArray(@rest dimensions)
    let((arr)
    if(integerp(car(dimensions)) && plusp(car(dimensions)) then
    arr=makeVector(car(dimensions))
    when(cdr(dimensions)
    for(ind 0 sub1(car(dimensions))
    arr[ind]=apply('abMultiDimArray cdr(dimensions))
    )
    ) ; when
    arr
    else
    error("Dimension %L must be a positive integer\n" car(dimensions))
    ) ; if
    ) ; let
    ) ; procedure

    Regards,

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • sprinter
    sprinter over 15 years ago

    Hi Andrew,

    Thanks a lot for your suggestions. The small piece of your code is very instructive indeed in order to understand how to build an array of arrays. I've tried it & it works just fine. I wish this example was included in the documentation.

     

    Regards,

    Adil.  

    Andrew Beckett said:

    Hi Adil,

    You can do this easily with a table:

    data=makeTable('myData 0) ; the 0 is the default value you want to return

    data[list(3 2)]=45
    data[list(5 6)]=123

    Because the table can have anything you want as the key, passing a list of an X and Y value is perfectly acceptable. Derek mentioned this in his post.

    Or you could create a multi-dimensional array very simply by using SKILL as follows. Essentially SKILL supports simple (single dimension) arrays, but it's easy to create an array which is an array of arrays).

    /* abMultiDimArray.il

    Author A.D.Beckett
    Group Custom IC (UK), Cadence Design Systems Ltd.
    Language SKILL
    Date Nov 23, 2009
    Modified
    By

    Function for creating a multi-dimensional array.

    Usage:

    data=abMultiDimArray(6 8)

    Creates a 6 by 8 array (starting index is from 0). Then you can use:

    data[4][5]=23
    data[0][7]=123

    You can specify more dimensions by passing more arguments to abMultiDimArray.

    ***************************************************

    SCCS Info: @(#) abMultiDimArray.il 11/23/09.16:24:27 1.1

    */

    procedure(abMultiDimArray(@rest dimensions)
    let((arr)
    if(integerp(car(dimensions)) && plusp(car(dimensions)) then
    arr=makeVector(car(dimensions))
    when(cdr(dimensions)
    for(ind 0 sub1(car(dimensions))
    arr[ind]=apply('abMultiDimArray cdr(dimensions))
    )
    ) ; when
    arr
    else
    error("Dimension %L must be a positive integer\n" car(dimensions))
    ) ; if
    ) ; let
    ) ; procedure

    Regards,

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 15 years ago

    Hi Adil,

    There is an example in the SKILL Language User Guide which talks about implementing sparse 2D arrays (using makeTable), and in fact the documentation on arrays talks about storing an array within another array (although doesn't give an example like mine).

    I'll probably write the above up as a Cadence Online Support solution.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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