• 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. exiting let block early due to errors opening files

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 146
  • Views 11542
  • 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

exiting let block early due to errors opening files

MOSFET
MOSFET over 4 years ago

The documentation for let and prog says that let is generally preferred for performance reasons but prog allows you to break out of the prog block early using a return() call, whereas let does not have this functionality.  My question is: if I want to use let for performance reasons, how would I break out of the entire procedure if I encounter an error due to a file that can't be opened, copied, written, etc.?  For example, suppose I have the following:

procedure(foo(libName cellName)

    prog(()

        cv = dbOpenCellViewByType(libName cellName "layout" "maskLayout" "r" )

        if((scv == nil) then

            printf("ERROR: Unable to open lib %L, cell %L, view layout, viewType maskLayout for read, exiting...\n" libName cellName)

            return()

        )

    )

)

Suppose I used let instead of prog in the example above and dbOpenCellViewByType returned nil.  How would I break out of the procedure foo given that return() is not available in a let() block?

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    I talk a bit about this in my Writing Good SKILL Code (Video). I have a bit of an aversion to using prog, which dates from it having worse performance than let, but nowadays that difference is very small and probably not worth worrying about. My main issue is that it's effectively a glorified goto and is "spaghetti programming" - hard to follow the flow (this is probably a philosophical thing that was drummed into me by a high school computer science teacher!).

    Anyway, you could use make the code conditional, or you could use the catch/throw mechanism - but probably it's simplest just to continue using prog and return.

    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