• 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. Variable by itself on a line: meaning?

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 14080
  • 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

Variable by itself on a line: meaning?

Proto
Proto over 5 years ago

Dear SKILL experts,

I am going through a SKILL code written by another person, and I noticed a few instances in which there was a variable by itself on the entire line of code. Initially, I thought this was the way to return a value in a function, but there is a return() construct, so that may not be it. Is it simply a syntax mishap or is there a valid purpose behind it? If it's the latter, could you please kindly explain what it is?

Kind regards,

Proto

  • Cancel
Parents
  • skillUser
    skillUser over 5 years ago

    Hi Proto,

    Yes, the variable on its own line, if it is the last thing in a let, procedure etc. will return the value of that variable from that block (procedure, let, progn, ...).  The return() statement is for the prog() construct. Note also that some programming constructs have useful return values, such as 'case' and 'cond', but others are not so useful (e.g. 'for' and 'foreach' unless it is used with another construct like 'mapcar'). I do not personally like 'prog-return' blocks as it can be difficult to work out the flow of control with arbitrary exits in the middle of the prog code block.

    Best regards,

    Lawrence.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Proto
    Proto over 5 years ago in reply to skillUser

    Hi Lawrence,

    Thank you for your detailed explanation -- it makes sense now. I am fairly experienced with different programming languages (C/C++, Python, Tcl), but SKILL is just something else. It has some unusual syntax that still confuses the heck out of me Astonished

    Cheers,

    Proto

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Proto
    Proto over 5 years ago in reply to skillUser

    Hi Lawrence,

    Thank you for your detailed explanation -- it makes sense now. I am fairly experienced with different programming languages (C/C++, Python, Tcl), but SKILL is just something else. It has some unusual syntax that still confuses the heck out of me Astonished

    Cheers,

    Proto

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to Proto

    Hi Proto,

    SKILL is essentially a LISP underneath - it just has some alternative input syntax to make the code look more C-like by allowing infix operators - so that you can use (for example):

    a=a+2*3

    rather than:

    (setq a (plus a (times 2 3)))

    (both work in SKILL though and are entirely equivalent). One key principle to understand in SKILL is that everything is a function (so every operator, everything you call, corresponds to a function) and all functions have a return value, whether you use it or not. Because of that, there is a principle in most expressions that the return value is the last thing computed - so the return value of a let() is the last thing computed, as is the return value of a procedure(). There are a few exceptions to this, such as prog() which returns nil unless you call the return() function within to indicate the return value, but I'm less keep on arbitrary jumps out of the middle of a block of code because it's harder to follow, as Lawrence said (it's "spaghetti programming").

    You might want to take a look at my video: Writing Good SKILL Code (Video)

    By the way, LISP is one of the oldest high level languages, and whilst old has been quite innovative over the years and has influenced a lot of other languages (there are quite a few concepts in Python that originate from LISP, for example).

    So yes, I agree - it's quite different from C/C++, Python and Tcl, but then again Python and Tcl are quite different from C/C++ too!

    Andrew.

    • 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