• 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 18324
  • 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
Parents
  • 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
Reply
  • 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
Children
No Data

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