• 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 Design
  3. A file needs to know it's place in the world

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 125
  • Views 587
  • 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

A file needs to know it's place in the world

CADcasualty
CADcasualty over 7 years ago

I have a file that contains skill code that can modify it's behavior based in where it exists within the file system. Is there a way for the file to determine the name of its unix parent folder?

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    Yes. See this forum thread - essentially using get_filename(piport) in your script. Well, that's returning the filename being read - from which you could of course determine the containing directory. That thread also talks about being able to do it inside a function defined within a SKILL file (rather than defining a global variable to determine where the file is) - which wasn't documented at the time. It is now documented in the SKILL Language User Guide, in a section headed "Read-time Evaluation" which says:

    Read-time Evaluation

    SKILL provides the read-time eval operator #. for evaluating expressions at read-time.
    When this operator is encountered, the expression following the dot is evaluated and the
    result of this evaluation replaces the #. For example, in the code below
    get_filename(piport) is evaluated at read-time and the results are inserted when the
    entire expression is compiled:

    procedure(printFileThisWasFrom()
      printf( "The file is:%s\n" #.get_filename(piport) )
    )


    If this function was defined within a file "code.il" then after the read-time evaluation, the
    expression would expand to the following, before being passed to the SKILL evaluator:

    procedure(printFileThisWasFrom()
      printf( "The file is:%s\n" "code.il" )
    )

    Regards,

    Andrew

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

    As always - thanks for your swift and perfect response!

    • 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