• 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 code to place all symbol cells in a virtuoso lib to...

Stats

  • Locked Locked
  • Replies 11
  • Subscribers 142
  • Views 20394
  • 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 code to place all symbol cells in a virtuoso lib to top level schematic cell

Nhumai
Nhumai over 7 years ago

Hi All,

I was trying to create a top level schematic which has all the symbol of cells in a schematic. What I have is 

##########create a test schematic with inv symbol in it ###############

cv=dbOpenCellViewByType("sc33tps_v1" "test" "schematic" nil "a")

 cv1=dbOpenCellViewByType("sc33tps_v1" "inv"  "symbol")  
  schinst=dbCreateInst(cv cv1 nil list(0 0) "R0" 1)    

this code is working fine

#############################################################

now I want to place all the cell in "sc33tps_v1" lib in test schematic and I have 

cv=dbOpenCellViewByType("sc33tps_v1" "test" "schematic" nil "a")  
lib=ddGetObj("sc33tps_v1")
foreach (cell lib~>cells
  when(ddGetObj(lib~>name cell~>name "symbol")
      cv1=dbOpenCellViewByType(lib~>name cell~>name "symbol")   
      schinst=dbCreateInst(cv cv1 nil list(0 0) "R0" 1)    
)
)
 

this code is not working . Please help to let me know what is wrong ? 

thanks 

Nhumai 

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    You didn't give any indication of what went wrong or what errors were given. Three things that I can spot:

    1. The nil on the first line would probably be better being "schematic" so that it knows what viewType to create the view as if there is no existing "schematic" view.
    2. You've got an erroneous space after the foreach and before the parenthesis that follows it. If you use the C-style for SKILL, you must not put spaces between the function name and the parenthesis after it.
    3. All your instances will be on top of each other because you've set the xy location to list(0 0)

    With the code as (my library name):

    cv=dbOpenCellViewByType("opamp090" "testforum" "schematic" "schematic" "a")
    lib=ddGetObj("opamp090")
    foreach(cell lib~>cells
      when(ddGetObj(lib~>name cell~>name "symbol")
        cv1=dbOpenCellViewByType(lib~>name cell~>name "symbol")
        when(cv1
          schinst=dbCreateInst(cv cv1 nil list(0 0) "R0" 1)
        )
      )
    )

    The code worked (albeit with the instances on top of each other). You could compute the coordinate yourself (if you have some idea of the size of the symbols - although you could find that out using the bBox of the symbols too). My code has an additional when to make sure it doesn't fail if the symbol couldn't be opened for some reason.

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Nhumai
    Nhumai over 7 years ago in reply to Andrew Beckett

    Hi Andrew 

    thanks for your code. I was trying to submit the code as the org thread but I can't find org thread. 

    I will try to modify it so I can array them instead of put them on the top of each other 

    I will keep you posted 

    thanks 

    Nhumai 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Nhumai
    Nhumai over 7 years ago in reply to Nhumai

    Hi Andrew 

    I got it now below is my code 

    cv=dbOpenCellViewByType("sc33tps_v1" "all_cells" "schematic" "schematic" "a")

    lib=ddGetObj("sc33tps_v1")

    x = 0.0

    y = 0.0

    foreach(cell lib~>cells

      when(ddGetObj(lib~>name cell~>name "symbol")

        cv1=dbOpenCellViewByType(lib~>name cell~>name "symbol")

        when(cv1

          schinst=dbCreateInst(cv cv1 nil list(x y) "R0" 1)

          if( (x == 27.0) then x = 0.0 y = y + 3.0 else x = x + 3.0 )

        )

      )

    )

     

    Thanks for your help 

    Nhumai 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Nhumai
    Nhumai over 7 years ago in reply to Nhumai

    Hi Andrew, 

    Now I would like to enhance the script to put the cells in alphabetical order do you have any suggestion for me ? your suggestion is very appreciated it 

    thanks 

    Nhumai 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 7 years ago in reply to Nhumai

    cv=dbOpenCellViewByType("sc33tps_v1" "all_cells" "schematic" "schematic" "a")

    lib=ddGetObj("sc33tps_v1")

    x = 0.0

    y = 0.0

    foreach(cell sort(lib~>cells lambda((x y) alphalessp(x~>name y~>name)))

      when(ddGetObj(lib~>name cell~>name "symbol")

        cv1=dbOpenCellViewByType(lib~>name cell~>name "symbol")

        when(cv1

          schinst=dbCreateInst(cv cv1 nil list(x y) "R0" 1)

          if( (x == 27.0) then x = 0.0 y = y + 3.0 else x = x + 3.0 )

        )

      )

    )

    Should do the trick I think.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Nhumai
    Nhumai over 7 years ago in reply to skillUser

    it works :-) 

    but it put the cells in reverted order but that is good enough for me 

    thanks all for help 

    Nhumai 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 7 years ago in reply to Nhumai

    Hi Nhumai,


    sorry about that, you can switch the order of the x and y in the call to alphalessp -> alphalessp(y~>name x~>name)

    Best regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • annesha
    annesha over 5 years ago in reply to Andrew Beckett

    Hi Andrew

    If i need to use only a particular type of cells (say 'inv') what do i add for it?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to annesha

    Assuming you're asking me to update Lawrence's code in this part of the thread and by "type of cells" you mean those that begin with a certain string, then you could replace:

      when(ddGetObj(lib~>name cell~>name "symbol")

    with

      when(ddGetObj(lib~>name cell~>name "symbol") && pcreMatchp("^inv" cell~>name)

    The first argument to pcreMatchp would be the regular expression you want - in this case this means anything beginning with inv.

    Not really sure why you asked me... I corrected the original code but then pointed out what was wrong with it, and then Lawrence fixed it properly.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • annesha
    annesha over 5 years ago in reply to Andrew Beckett

    Thanks Andrew! I could do the same using following code

    foreach(cell lib~>cells
       when(pcreExecute(pattern cell~>name)
          cv1=dbOpenCellViewByType(lib~>name cell~>name "symbol")
          when(cv1
             schinst=dbCreateInst(cv cv1 nil list(0 0) "R0" 1)
          )
       )

    )

    • 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