• 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. Creating instances and naming them in a definite manner...

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 143
  • Views 12213
  • 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

Creating instances and naming them in a definite manner using a loop

Sattiwk
Sattiwk over 4 years ago

Hi,

I am trying to create N instances and name them as xI1, xI2......,xIN using a loop and add them in a list. I have a written code that does the same for 4 instances as shown below (code snippet).

; Create library and cell for the scaled copy
dbCreateLib("__distCalcLib")
x1cp=dbCopyCellView(x1m "__distCalcLib" "__distCalcCell" "symbol")
dbSave(x1cp)
x1cpsch=dbOpenCellViewByType("__distCalcLib" "__distCalcCell" "schematic" "schematic" "w")
dbSave(x1cpsch)

; Have 4 instances(one for OP, three for scaled signals)
; add code-Currently, y spacing is hard coded-modify to determine size and spacing from the size
xI1=schCreateInst(x1cpsch x1m "I1" '(0 0) "R0")
dbCopyProp(x1 xI1)
xI2=schCreateInst(x1cpsch x1m "I2" '(0 5) "R0")
dbCopyProp(x1 xI2)
xI3=schCreateInst(x1cpsch x1m "I3" '(0 10) "R0")
dbCopyProp(x1 xI3)
xI4=schCreateInst(x1cpsch x1m "I4" '(0 15) "R0")
dbCopyProp(x1 xI4)

; One list for the operating point and three for scaled signals
opInstList = cons( xI4 nil )
sigInstList = list( xI1 xI2 xI3 )

-------------------------------------------------------------------------------------------

I tried to write a code to achieve my goal.This is my effort.

-------------------------------------------------------------------------------------------

; Have N instances

numCopies=4

counter=1
instanceIndex='()
opInstList='()
sigInstList='()
while(counter <= numCopies
ySpace=5*counter-5
instanceIndex =append(instanceIndex schCreateInst(x1cpsch x1m sprintf(nil, "xI%d" counter) '(0 ySpace) "R0"))
dbCopyProp(x1 instanceIndex[counter-1])
if(counter==numCopies then
opInstList =cons(nth(counter-1 instanceIndex) opInstList)
else
sigInstList =append(sigInstList nth(counter-1 instanceIndex))
)
counter=counter+1
)

---------------------------------------------------------------------------------------------------------------------------------------------------------------

I am not getting the desired output. The lists are empty and no instances are getting created.But the length of the lists are correct but the 'sigInstList' shows (nil,nil,nil) for N=4.

I am new to skill programming, so I couldn't figure out how to fix this and am seeking for help. Also, before creating the library, I want to add a code to check whether the library of same name exists or not and if it exists, it must be deleted.

I just want to automate the first code for N instances. Please help me out.

I am using cadence version IC6.1.7-64b.500.3.

  • Cancel
Parents
  • mbracht
    mbracht over 4 years ago

    Hi,

    Your function schCreateInst(...) goes wrong - reason is that you pass the instance's origin (the 4th argument of schCreateInst() as a quoted list: '(0 ySpace)
    That way ypSpace is not turned into a value but remains a symbol. As a result schCreateInst() fails..silently unfortunately... and returns nil.

    Use (list 0 ySpace) instead and you should be ok.

    Max

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Sattiwk
    Sattiwk over 4 years ago in reply to mbracht

    Thanks mbracht, it worked fine. Can you explain when to use quoted list and when not to? What is the difference between the two? I just want to know so that I don't make similar mistakes in the future. Thank you for your time.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mbracht
    mbracht over 4 years ago in reply to Sattiwk

    A qoted list silently applies the quote to each and every element in the list. And applying a quote to a symbol prevents it from being evaluated as a SKILL expression,- in your specific example ySpace.

    ySpace = 5.0
    (list 0 ySpace) ---> (0  5.0)
    '(0 ySpace)     ---> (0 ySpace)

    So in case of the quoted list you get back the SKILL symbol.
    You should make yourself familiar with the concept of symbols - they are really crucial in SKILL. A symbol in SKILL is essentially just a name that can be used (potentially simultanously) for a variable, a function or a property list.

    regards
    Max

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Reply
  • mbracht
    mbracht over 4 years ago in reply to Sattiwk

    A qoted list silently applies the quote to each and every element in the list. And applying a quote to a symbol prevents it from being evaluated as a SKILL expression,- in your specific example ySpace.

    ySpace = 5.0
    (list 0 ySpace) ---> (0  5.0)
    '(0 ySpace)     ---> (0 ySpace)

    So in case of the quoted list you get back the SKILL symbol.
    You should make yourself familiar with the concept of symbols - they are really crucial in SKILL. A symbol in SKILL is essentially just a name that can be used (potentially simultanously) for a variable, a function or a property list.

    regards
    Max

    • Cancel
    • Vote Up +1 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