• 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. the behavior of operator (inplace operator & binary operator...

Stats

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

the behavior of operator (inplace operator & binary operator)

sbkuizlzl
sbkuizlzl over 3 years ago

Hi all.

I'm using Virtuoso IC6.1.8-500.19 and my SKILL script returns unintended results when I use the inplace operator (+=, in my case).

A toy example of the case is as below.


a = 1

b = 3

c = 2

a += b - c


In this case, the expected value of 'a' is 2, I think, but the actual value is 4.

I checked the operation by SKILL IDE and I found that it is translated as (a = (a + b)) - c.

I know that I can get the intended value if I change the line 4 to a += (b - c), but I wonder this unexpected result comes from the nature of SKILL language, which is unlike any other programming languages.

Furthermore, when the binary operator is used with no blank with the secondary argument, it also returns unexpected value.


a = b - c    ; the value of a is 1

a = b-c      ; the value of a is 1

a = b -c     ; the value of a is 3


The last operation treats '-' operator as unary, I think, and it also differs from my expectation.

Will these behavoir be fixed later or is it just the rule for the SKILL?

I cannot find the guideline of it in the SKILL manual.

Thanks.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago

    For the first issue, I agree, the inplace operators have the wrong precedence (strictly speaking the issue is that they appear to be left-to-right associative rather than right-to-left like the assignment operator, =). There's an existing CCR for this, 2132643 (filed by one of my team). Perhaps you should contact customer support and request a duplicate be filed. The challenge with fixing this, however, will be that doing so would break existing code that depends on the incorrect precedence.

    The second issue is expected. This is because SKILL doesn't have syntax to mark the end of a statement (e.g. like ";" in C), and so you can have multiple statements on the same line. If you do that, then the last statement is actually two statements, a=b and -c, with the overall return value (e.g. if used at the end of a function) being the -c. Given that you can do "a = b c = d" and that's valid, it would be rather hard to know your intent - so the multiple statements on a single line wins. You just have to be careful with whitespace in SKILL - it's not C (it's a LISP really, and the infix operators are designed to make it more C-like).

    Regards,

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • sbkuizlzl
    sbkuizlzl over 3 years ago in reply to Andrew Beckett

    Andrew:

    Thank you for your quick response!

    I will use the inplace operators more carefully (with parenthesis), rather than submit a duplicate request. Slight smile

    And I didn't notice that multiple statements can be in a single line separated by blank! It's the issue that I'm familiar with C language but not with LISP.

    Thanks.

    • 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