• 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 Design
  3. About function define

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 125
  • Views 15036
  • 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

About function define

bobbygang
bobbygang over 14 years ago

Hi, I wrote function define code like this :

procedure(MMM(A B C D E)
                   setplist(A '(B D C E))
                   F=getqq(A B)
                   F
)

I want to achieve that when I input :    MMM(bobby xx (1 2 ) yy (3 4))

it will give me the result :        (1 2)

But it always tell me          *Error* eval : unbound variable  -bobby

Does it mean that when I use the function MMM I should define symbol "bobby" "xx" "yy" first?

I think it's too cumbersome. How to solve this problem ?

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    nprocedures are not the right way to do this really because usually they rely on runtime evaluation - in this case they don't, but nprocedures don't generally work properly in SKILL++ code (in this case it does work, but you still get a warning). BTW, there's a typo in Lawrence's code anyway - the getqq should be a get (no "q" at all) otherwise it doesn't work.

    Assuming you didn't really want a global variable F in the code, I  would do this as a macro (which is the right way to do this):

     defmacro(MMM (A B C D E)
      `{
        setplist(',A '(,B ,C ,D ,E))
        getqq(,A ,B)
        }
    )

    (be careful about the quotes here - the one  before the open curly bracket is a backquote; this allows selective evaluation within the macro). Macros are evaluated at "compile" time - so they will be expanded in place.

    If you really want the variable F to be assigned, just put F= before the getqq in the macro.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    nprocedures are not the right way to do this really because usually they rely on runtime evaluation - in this case they don't, but nprocedures don't generally work properly in SKILL++ code (in this case it does work, but you still get a warning). BTW, there's a typo in Lawrence's code anyway - the getqq should be a get (no "q" at all) otherwise it doesn't work.

    Assuming you didn't really want a global variable F in the code, I  would do this as a macro (which is the right way to do this):

     defmacro(MMM (A B C D E)
      `{
        setplist(',A '(,B ,C ,D ,E))
        getqq(,A ,B)
        }
    )

    (be careful about the quotes here - the one  before the open curly bracket is a backquote; this allows selective evaluation within the macro). Macros are evaluated at "compile" time - so they will be expanded in place.

    If you really want the variable F to be assigned, just put F= before the getqq in the macro.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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