• 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. does skill support if else if loop ?

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 144
  • Views 15482
  • 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

does skill support if else if loop ?

GDCRA
GDCRA over 3 years ago

Hi

My skill procedure is reading file line by line and based on line content, I need to execute different actions on schematic design. In short,  I have more than one test condition but only the statements of one test need to be executed.

I have all necessary command to execute my task, it just I am not able to use if else if or cond statement.

My questions are , Does skill support if else if statements ? If yes, can someone body syntax skeleton or point to example ?

If, if else if is not supported, what other construct i can use ?

Thanks

GD

  • Cancel
  • mbracht
    mbracht over 3 years ago

    Hi,

    SKILL does not explicitly support an elseif branch but it can easily be achieved in terms of a nested if statement:

    (if <condition> then
        <do something...>
    else
       (if <someOtherCondition>
          <do something else...>
       )
    )

    Personally I would prefer   a case statement though...

    (case
       (<condition1>
          ...do something
       )
       (<condition2>
          ...do something else
       )
       ...
       ...
       )
       (<conditionN>
          ...do whatever
       )
    )

    regards
    Max

    • Cancel
    • Vote Up -1 Vote Down
    • Cancel
  • drdanmc
    drdanmc over 3 years ago in reply to mbracht

    Here is an example of cond().  I use cond if I want somewhat arbitrary tests.  For example

    x = -3.2

    msg = "save"

    cond(

        ( x > 1.0

            printf("x > 1.0 is true\n")

        )

        (msg == "open"

            printf("msg is \"open\"\n)

        )

        ( stringp(msg)

           printf("msg is a string that is not handled:  %L\n" msg)

       )

       (t

          printf("default action\n")

        )

    )

    in the above, the first matching condition and only the first matching condition is executed.

    for the situation where each condition is checking the same variable but against different values, I use case or caseq as Max suggests.

    -Dan

        

    • 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