• 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. Change behavior according to current directory

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 11402
  • 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

Change behavior according to current directory

ichiro
ichiro over 4 years ago

Hi all,

I'd like to change behavior according to where I run a ocean script. And I got what I'd like to do with next script.

Can I use "case" in case of adding "proc_C" without using else if...else if...?

if( nindex(getWorkingDir() "proc_A")
then
        process_select=0    ; proc_A
else
        process_select=1    ; proc_B
)

regards,

Ichiro

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    You can't use a case() function for something that is in an indeterminate position like this - because you need nindex() to find a string which presumably could appear anywhere throughout. However, you could use cond() instead to avoid a multiway if-then-else:

    cond(
      (nindex(getWorkingDir() "proc_A")
        process_select=0
      )
      (nindex(getWorkingDir() "proc_B")
        process_select=1
      )
      (nindex(getWorkingDir() "proc_C")
        process_select=2
      )
      (t ; catch-all
        process_select=3
      )
    )

    You could also avoid the variable assignment in each branch simply by doing:

    process_select=cond(
      (nindex(getWorkingDir() "proc_A")
       0
      )
      (nindex(getWorkingDir() "proc_B")
        1
      )
      (nindex(getWorkingDir() "proc_C")
        2
      )
      (t ; catch-all
        3
      )
    )

    Hope that helps!

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • ichiro
    ichiro over 4 years ago in reply to Andrew Beckett

    Hi Andrew,

    It's a very good idea in case of addition of new process.

    Thanks,

    Ichiro

    • 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