• 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. SKILL program or Cadence feature to count number of instances...

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 143
  • Views 9548
  • 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

SKILL program or Cadence feature to count number of instances hierarchically including multiples in a schematic

Anna Sambile
Anna Sambile over 2 years ago

Hi,

I am new in learning cadence SKILL and I'm currently using cadence virtuoso ICADVM20.1-64b.

Can someone help me if there is already a SKILL program or cadence feature that will count the number of instances hierarchically including the number of multipliers in the instance property?

I read the forum guidelines and checked if there's already a similar inquiry with this and this is what I found: https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1Od0000000nVxnEAE&pageName=ArticleContent&caseSessionKey=0053w000009eUkpAAE__20230213131015443

I tried to run this and it seems to count the number of instances hierarchically but doesn't include the multipliers in the instance property.

I am using this SKILL program to get the tree and just post process the output file to get the total number of instances per subblock and convert it to a csv file.

But I noticed that the program doesn't take into account the multiplier unless it is in the instance name like (MN<3:0>).

Hope someone could help.

Thank you very much!

Regards,

Anna

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago

    Hi Anna,

    I wrote that article - and also this one How can I find the total number of primitive components in my design? which uses the CCSschTree code.

    For the simple case, the line in CCSschTree that could be changed to take into account the m-factor is:

    (setq count (plus count (or (dbGetq inst numInst) 1))))

    this gets the numInst attribute of the instance which is for iterated instances. It would then need to multiply this by the m-factor. The tricky part would be that the property may or may not be called "m" - it depends on the PDK and the primitive device.

    Also, from having a quick look at the code, I'm not quite sure the counts are right for when the traversal is done on a config. When I have a moment, I'll spend some time checking that (I wrote this code a long time ago), but I won't be updating it to include m-factor because it is too difficult to make generic - I'll leave that as an exercise for you; if it's not a config, it would be the line I mentioned above that needs changing (I think).

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Anna Sambile
    Anna Sambile over 2 years ago in reply to Andrew Beckett

    Hi Andrew,

    Yes, I'm using the CCSschTree code that you wrote and I can see the line that you mentioned and tried to edit it.

    What I did in the code is to filter all MOS devices which has instance name starting with letter "M", then get the value of the m-factor with "totalM" as property name and then multiply that value with the numInst as you mentioned.

    If the device is not a transistor, then it will just do the default counting of instances.

    But what I noticed is that let's say I have 2 PMOS devices with the following properties:

    PMOS #1 - totalM = 1
    PMOS #2 - totalM = 4
    The total number of devices I'm getting is just 4, instead of 5.

    Can you help me check what I can do with the code I added?

    Regarding the config, I do not think I need the config since the code will only be used in schematic view.

    Thank you very much!

    Regards,

    Anna

    PS -- I cannot seem to add the code in the comment there's an error. I will try to add it in the next reply.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Anna Sambile
    Anna Sambile over 2 years ago in reply to Anna Sambile

    Here's the code. Attaching it as screenshot. I cannot reply with text.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to Anna Sambile

    Anna,

    There's a strange quirk with the community forums that it doesn't like code containing the function substring - I tried getting this resolved in the past, but I didn't succeed yet. So that's why it objected to you pasting the code.

    From a quick glance at the code (I don't have time to test right now), my guess is that the problem is that when you have the totalM parameter set to 1 on an instance, it's the default value and so the property is not stored on the instance. Consequently, it will be in the then branch of the if because  the instance name begins with "M" but there's no totalM property on the instance; instead it's getting the value from the CDF default (presumably 1), but you completely omitted incrementing the count parameter at all. Maybe something like:

    if(uppercase(...) == "M" && dbFindProp(inst "totalM") then
      (setq count (plus count (or (dbGetq inst numInst) 1) * atoi(inst~>totalM)))
    else
      (setq count (plus count (or (dbGetq inst numInst) 1)))
    )

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Anna Sambile
    Anna Sambile over 2 years ago in reply to Andrew Beckett

    Hi Andrew,

    Thank you very much! Your suggestion worked!

    Regards,

    Anna

    • 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