• 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. unload skill code in CIW

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 4558
  • 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

unload skill code in CIW

Monarch03116
Monarch03116 over 1 year ago

hi , 

  i have load("test.il"), and how can i unload or remove this from CIW ?  It seems there is no unload command for this.

  • Cancel
  • AurelBuche
    AurelBuche over 1 year ago

    Hi,

    When you load SKILL code, everything is interpreted and the associated objects are generated and assigned to variables.

    Unfortunately, there is no safe way to unload a file (except restarting Virtuoso).

    The closest you could do is :

    1. Turn on debug mode : (sstatus debugMode t)

    2. Load the file.

    3. Use `getFunctions' and `putd' to remove the defined functions.

    4. Turn off debug mode.

    This implies loading the file twice (or turning debugMode on before loading it the first time), you might not be aware of everything that happens when loading the file and you cannot guarantee that everything will be back to the state before loading the file.

    For instance, this does not unset variables (you could remove them using `unbindVar' but you have to find a way of deducing them).

    Also, you cannot guarantee that variables and functions have not been overwritten when loading the file.

    And last but not least, turning debugMode on decreases performances and uses more licences.

    Hope this helps,

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AurelBuche
    AurelBuche over 1 year ago in reply to AurelBuche

    For the sake of it, I made a script to load a SKILL file in a sub-shell and return the list of global changes it makes.

    This is still unsafe :

    For example, If the script you load is calling rm commands at top level they will be executed!

    It is also limited as the SKILL interpreter used is not equivalent to Virtuoso SKILL environment (it is not aware of any graphic function for instance)

    Here is the bin script, to be placed in a file like ./bin/get_global_skill_changes :

    Make sure it is executable using chmod +x and do not forget to replace <install_path> in the shebang.

    #!<install_path>/bin/skill
    ;; Replace <install_path> by the result of (car (getInstallPath))
    
    ;; Use SKILL interpreter to deduce what changed after loading a file
    
    (let ( (functions (makeTable t ()))
           (variables (makeTable t ()))
           (scheme    (makeTable t ()))
           (file      (argv 1))
           (port      poport)
           )
    
      ;; Make sure stdin is not polluted when loading the script
      (setguard 'poport (lambda _ (outfile "/dev/null")))
      (setq poport nil)
    
      ;; Save current state of variables
      (foreach sym oblist
        (errset
          (unless (eq sym 'oblist)
            (when (isCallable sym) (setf functions[sym] (getd sym)))
            (when (boundp     sym) (setf variables[sym] (symeval sym)))
            (when (boundp sym (schemeTopLevelEnv))
              (setf scheme[sym] (symeval sym (schemeTopLevelEnv))))
            )))
    
      (assert (stringp    file) "%A requires a file path as first argument" (argv 0))
      (assert (isFile     file) "%A is not a valid file path"               file    )
      (assert (isReadable file) "%A is not readable"                        file    )
    
      (loadi file)
    
      ;; Compare oblist with saved state
      (let ( __functions__
             __variables__
             __scheme__
             )
        (foreach sym oblist
          (errset
            (unless (memq sym '(oblist __functions__ __variables__ __scheme__))
              (and (isCallable sym) (nequal (getd    sym) functions[sym]) (push sym __functions__))
              (and (boundp     sym) (nequal (symeval sym) variables[sym]) (push sym __variables__))
              (and (boundp sym (schemeTopLevelEnv))
                   (not (isCallable sym))
                   (nequal scheme[sym] (symeval sym (schemeTopLevelEnv)))
                   (push sym __scheme__)
                   )
              )))
        ;; Print difference between the two states
        (sstatus printinfix ())
        (println (list __functions__ __variables__ __scheme__) port)
        )
    
      )
    
    (exit 0)

    And here is the function to call it :

    (inScheme
    (let ( (script "./bin/get_global_skill_changes")
           )
    
      (defglobalfun ab_get_global_definitions (file "t")
        "Return global definitions in FILE.
    Be very careful as FILE gets loaded by a SKILL interpreter in the process.
    Make sure it does not contain destructive commands.
    
    Returned value contains three lists of variables that are modified by FILE:
     - Global functions
     - Global SKILL variables
     - Global Scheme variables
    "
        (setq file (simplifyFilename file))
        (assert (isReadable file) "%A is not readable" file)
        ;; Run script and read its stdout
        (letseq ( (port (outstring))
                  (pid  (ipcBeginProcess
                          (lsprintf "%s %s" (simplifyFilename script) file)
                          ""
                          (lambda (_pid data) (fprintf port "%s" data))
                          (lambda (_pid data) (warn "%s" data))
                          ))
                  )
          (ipcWait pid)
          ;; Interprete script output as a SKILL list
          (car (linereadstring (prog1 (getOutstring port) (close port))))
          ))
    
      );let
    )
    • 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