• 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. Can SKILL++ symbols be unbound?

Stats

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

Can SKILL++ symbols be unbound?

tweeks
tweeks over 10 years ago

In SKILL mode, you can unbind a symbol's value slot by assigning the special symbol unbound to it:

> f = 3
3
> boundp 'f
t
> f = 'unbound
unbound
> f
*Error* toplevel: undefined variable - f
<<< Stack Trace >>>
> boundp 'f
nil

You can also unbind the function slot by putting nil there:

> putd 'f (getd 'car)
primop:car
> fboundp 'f
primop:car
> (f '(1 2 3))
1
> putd 'f nil
nil
> fboundp 'f
nil
> (f '(1 2 3))
*Error* eval: undefined function - f

However, in SKILL++ mode, symbols use the function slot exclusively, so putting nil there is the same as assigning the symbol to nil.  Continuing from the previous example:

> toplevel 'ils
ILS-> f
nil

Is there a way to actually undefine a SKILL++ symbol?  It seems you would need to unintern it from the SKILL oblist and/or remove it from the toplevel environment frame.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Tom,

    It's slightly tricky - you have to define a SKILL (not SKILL++ function) with the same name, and then putd() the symbol to nil. Since this is an internal implementation detail and not exactly obvious, I've been talking with R&D about providing a macro or syntax form to do this which works in both SKILL and SKILL++ (ILS) modes.

    Here's a macro that I wrote that you can use in the meantime which does the job:

    (defmacro CCFunbind (varName)
      `(if (theEnvironment)
         (inSkill 
           ;-----------------------------------------------------------------
           ; Bit messy as can't swallow warning from the defun.
           ; The idea is that it defines a function for the variable name
           ; and then sets it to nil afterwards.
           ;-----------------------------------------------------------------
           (let ((nullport (outfile "/dev/null")))
             (unwindProtect
               (let ((woport nullport))
                 (defun ,varName () nil) 
                 (putd (quote ,varName) nil))
               (close nullport)
               )))
         (setq ,varName 'unbound)))
    With this, you can just do:

     

    a=23
    CCFunbind(a)

    and it will work in either mode - it will unbind a top level variable.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    The CCR number for my request for such a function in SKILL is 1320516.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • tweeks
    tweeks over 10 years ago

    This is cool.  :)  Thanks Andrew!

    I learned another trick from you: temporarily rebinding woport for situations where getWarn isn't enough.

    Also, using (if (theEnvironment) ...) to check for SKILL++ mode.

    • 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