• 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. defining local procedures

Stats

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

defining local procedures

mtwadeCU
mtwadeCU over 10 years ago

I'm confused about local functions. In the Cadence Help documentation, there is a section called "Using procedures to Declare Local Functions." Let's look at Example 1 in that section. 

procedure( trParity( x )
    procedure( isEven(x) 
        x == 0 || isOdd( x-1 )
        ) 
    procedure( isOdd(x) 
        x > 0 && isEven(x-1) 
        ) 
    if( isEven( x ) then 'even else 'odd )
    ) ; procedure

I assumed that isEven and isOdd are only accessible inside of trParity. However, if I go to the CIW after loading that procedure, I can call isOdd and isEven -- i.e. it seems those functions are not local to trParity. I was hoping to use local functions in some of my own custom procedures, but this same problem comes up. Am I missing something? 

Thanks,

Mark

  • Cancel
  • skillUser
    skillUser over 10 years ago

    Hi Mark,

    I have not really read through the section that you are talking about, but it is in the SKILL++ section of the manual.  As such, for this to work as you expect (a locally defined procedure only valid inside the parent procedure) then it needs to be evaluated in the SKILL++ environment.  One way to do this is to use toplevel('ils) before entering the code.  Another way is to save the procedure in a filename <something>.ils which tells the parser to use SKILL++ lexical scoping.  Without this, this is just regular SKILL, and SKILL only has one 'namespace' so to speak, and so all procedures are declared at the same 'global' scope.  I'm probably getting the terminology wrong, but the above information should answer your question and hopefully get you working.  Refer back to the start of the section "About SKILL++ and SKILL" for more information.

    Best regards,

    Lawrence.

    • 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