• 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. how to declare an array of unknown size

Stats

  • Locked Locked
  • Replies 11
  • Subscribers 143
  • Views 25549
  • 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

how to declare an array of unknown size

Sri Charan B
Sri Charan B over 13 years ago

Hi,

I am trying to implement a code where i came in need of an array which can increase the size of the array during the runtime. I mean the size of the array shall not be declared using the 'declare' command but during the run time if new elements are to be added into that array i will use it or else the array shall be empty.

I need this because i am at a juncture where i cannot expect or fix the size of the array to a particular value so guys please help me.

Thanks in advance for any help,

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    The second code uses a hash table (or an "association table" in SKILL parlance) to store the unique members. You can read up more about these in the SKILL Language User Guide, but the important thing to know is that the table is a bit like an array, except that the indices can be anything, not just numbers. So they can be strings, database ids, numbers, lists, whatever you like.

    The code iterates through the list and for each element it uses that element as the "index" (or key) into the hash table - setting the value of that entry in the table to some arbitrary value (I picked t, but it could have been anything). Tables can actually be iterated with foreach loops - so I could do at the end:

    foreach(elem uniq
      printf("Table entry for %L has value %L\n" elem uniq[elem])
    )

    In addition for a table you can retrieve all the indices (keys) using uniq->? or a list of key-value pairs using uniq->?? . So all I do after populating the table is retrieve all the keys that were used - and since if it used the same key more than once in the foreach loop it will set the same entry  in the table, it will return a unique list of keys.

    Association tables use a hashing mechanism to allow them to efficiently store and lookup entries without having to use sequential searching. If you want to find out more, search for "hash table" on wikipedia (although you probably don't need to understand the implementation ideas behind hash tables to be able to use them effectively).

    Hope that helps,

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Rameen
    Rameen over 4 years ago in reply to Andrew Beckett
    Hi Andrew,
    Can u guide me why this error occur? If you have any idea about it,It will be so helpful for me.
    I found this error during elaborate
    "Error   : Array size must be greater than zero. [CDFG-607] [elaborate]
            : Invalid array size: 0.
            : The width of an array must evaluate to a positive integer at compile time."
    There is no module name and line no define
    Why this error occur and how we can debug this that we will in which module this error is occurred
    Regards,
    Rameen.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Rameen
    Rameen over 4 years ago in reply to Andrew Beckett
    Hi Andrew,
    Can u guide me why this error occur? If you have any idea about it,It will be so helpful for me.
    I found this error during elaborate
    "Error   : Array size must be greater than zero. [CDFG-607] [elaborate]
            : Invalid array size: 0.
            : The width of an array must evaluate to a positive integer at compile time."
    There is no module name and line no define
    Why this error occur and how we can debug this that we will in which module this error is occurred
    Regards,
    Rameen.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to Rameen

    Hi Rameen,

    You're asking about something completely unrelated to the topic in this thread (and also breaking all the forum guidelines by posting in a 9 year old thread). Based on a search of the error code internally, this appears to be related to the Genus product which has absolutely nothing to do with Custom IC Design or SKILL.

    I suggest you post a new question in the Digital Implementation forum.

    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