• 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. Using nested scripts

Stats

  • Locked Locked
  • Replies 14
  • Subscribers 143
  • Views 8236
  • 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

Using nested scripts

ArbLouis
ArbLouis over 1 year ago

Hi. I'm trying to create a set of vias using a SKILL file. 

Issue 1: Instead of replicating the same piece of code several times, I'd like to use, within the main script, a call to a function (which hopefully I can store as an external file on a custom location and reuse in other projects).

Issue 2: Furthermore, I'd like to pass to this function some parameters, e.g. a position.

This is an example of main script in which I've highlighted where I'd like to call the external function creating a stack of vias (this part of code is not written, I've just used here the script file name viacreator.il). 

I hope someone could help.

pcDefinePCell(list(ddGetObj("TestExternalFunction") "testPCELL_SKILL" "layout") nil
let((pcMember pcStretchGroup stretchOffsetX stretchOffsetY pcLib
pcMaster pcInst pcTerm pcPin pcPinName
pcNet pcTermNet pcNetName pcTermNetName pcMosaicInst
pcParameters pcParamProp pcStep pcStepX pcStepY
pcRepeat pcRepeatX pcRepeatY pcIndexX pcIndexY
pcLayer pcPurpose pcLabelText pcLabelHeight pcPropText
pcParamText pcCoords pcPathWidth pcPolygonMargin
)
(pcLib = (pcCellView~>lib))
(pcParameters = ((pcCellView~>parameters)~>value))
(pcLayer = 187)
(pcPurpose = "drawing")
(pcInst = dbCreateRect(pcCellView
list(pcLayer pcPurpose)
list((0.0:-14.5)
(25.0:-7.5)
)
))

(pcLayer = 19)
(pcPurpose = "drawing")
(pcInst = dbCreateRect(pcCellView
list(pcLayer pcPurpose)
list((23.355:-14.46)
(24.945:14.4)
)
))

; Call to an external function located, for instance, in the folder /EDA/SKILL

viacreator ( list((23.355:-14.46) )

)
)

Thanks for your help!

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 1 year ago

    In the file viacreator.il you'd need to define a function - typically done using procedure() (there are other ways, but this is probably the most natural).

    procedure(viacreator(cv bBox)
      dbCreateRect(cv list("Via1" "drawing") bBox)
    )

    There's no requirement for the function name to match the file name, you can have multiple function definitions in each file, and it's a good idea to give them a unique prefix to avoid clashing with anybody else's functions - viacreator is not terribly unique, for example. So something like "CCFviacreator" (CCF being Cadence Community Forum; we recommend an uppercase prefix to avoid clashing with anything from Cadence).

    Then you'd call it:

    viacreator(pcCellView list(23.355:-14.46 24.945:14.4))

    (you had a space after the function name in your call which isn't legal - also the list() structure wouldn't work because you have matching duplicate parentheses which will confuse matters).

    For more detail, I suggest you read the SKILL Language User Guide or take one of the free online SKILL training classes at http://support.cadence.com (in the Learning section in the middle at the top).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ArbLouis
    ArbLouis over 1 year ago in reply to Andrew Beckett

    Thanks Andrew. I fixed it. . 

    MY_cell (folder)

        - MY_functions (folder)

       - libInit.il 

    The libInit.il file contains a single line: 

    load("./MY_cell/MY_functions/MY_viacreator.il")

    In the main Skill code (which is located in a folder different from the MY_cell one) I load the libInit.il. Now it works. thanks a lot!

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • ArbLouis
    ArbLouis over 1 year ago in reply to Andrew Beckett

    Thanks Andrew. I fixed it. . 

    MY_cell (folder)

        - MY_functions (folder)

       - libInit.il 

    The libInit.il file contains a single line: 

    load("./MY_cell/MY_functions/MY_viacreator.il")

    In the main Skill code (which is located in a folder different from the MY_cell one) I load the libInit.il. Now it works. thanks a lot!

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to ArbLouis

    The libInit.il can't just be anywhere you want. It has to be in the library directory as that's the only place it will be auto-loaded from.

    Also, the paths in any load() call either need to be full paths, or if relative they are relative to the SKILL path and not relative to the file from which they are loaded). You can use this approach in the library libInit.il :

    let((pathToMe dirPat dirPath)
      pathToMe=get_filename(piport)
      dirPat=pcreCompile("/[^/]*$")
      dirPath=pcreReplace(dirPat pathToMe "" 1)
      load(lsprintf("%s/fileToLoad.il" dirPath))
    )

    Ah, I now see you edited the post to say you fixed it (I really must get used to reading the posts rather than just the email notification...). Anyway, maybe the above will be useful.

    Andrew

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