• 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. Runtime Stack Overflow in Recursive Functions

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 143
  • Views 17187
  • 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

Runtime Stack Overflow in Recursive Functions

zmleitao
zmleitao over 11 years ago

I have implemented a recursive function to explore a circuit hierarchically at the schematic level.

However, for large circuits, such as top-level blocks, I get the following error:

*Error* myRecursiveFunc: Runtime Stack Overflow!!!

 

Is there any way to increase the stack size or the only workaround is to make a non-recursive implementation of the function?

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Normally the stack limits in SKILL are big enough that you should never hit these limits for recursing a design hierarchy. Sure, if you're writing a heavily recursive function, it might run out of stack. Also if you have lots of arguments to your recursive function, that eats into the stack space. I just wrote a simple function with 9 arguments and still could cope with over 1600 deep recursive calls... which ought to be enough for a hierarchical design!

    Usually these errors occur because you've made a mistake in the code and the recursion is running away. 

    There's no way to increase the stack size. However, if the recursive function is suitable, you can take advantage of tail call optimization. The function has to be written in "ils" mode (e.g. in a file with a .ils suffix), and you need to turn on:

    sstatus(optimizeTailCall t)

    Also, you may find that even writing the code in SKILL++ mode (ils mode) buys you a bit more stack space too (does in my simple examples).

    Regards,

    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