• 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. how to use schProduceUniqueCVHier in Scheme

Stats

  • Replies 4
  • Subscribers 142
  • Views 1757
  • Members are here 0

how to use schProduceUniqueCVHier in Scheme

kkdesbois
kkdesbois 4 months ago

Hello,

I'd like to use schProduceUniqueCVHier in a Scheme script.

My first intention was to write something like that :

(defun mainFun (lib cell view)
(let ( (cv (dbOpenCellViewByType lib cell view))
        (viewList (myGetViewList)) ; myGetViewList is a skill function
        (paramTbl (makeTable "paramTbl")) )

  (defun visitCB (cell depth hierPath stopCv)
    ;;; append paramTbl with found parameters in cell
  )

  (schProduceUniqueCVHier 'visitCB cv viewList  nil nil)

))

But I get the following error : *Error* eval: undefined function - visitCB 

The only way I found to make it work is to define visitCB with defglobalfun but I lose the benefit of the shared variable paramTbl.

Is there a way to do without using a global function?

Laurent.

  • Sign in to reply
  • Cancel
  • Andrew Beckett
    Andrew Beckett 4 months ago

    Laurent,

    Two things. First of all, even if you use defglobalfun, the function is still defined within the lexical scope and so can access lexically scoped variables (i.e. paramTbl). This mild modification of your code (just to record something in the visitor function) works fine:

    (defun mainFun (lib cell view)
      (let ( (cv (dbOpenCellViewByType lib cell view))
            (viewList (myGetViewList)) ; myGetViewList is a skill function
            (paramTbl (makeTable "paramTbl")) )
    
        (defglobalfun visitCB (cell depth hierPath stopCv)
          ;;; append paramTbl with found parameters in cell
          ;;; just doing a dummy update for now
          (setarray paramTbl cell t)
          )
    
        (schProduceUniqueCVHier 'visitCB cv viewList  nil nil)
        paramTbl
    
        ))
    
    (setq tbl (mainFun "ether" "top" "schematic"))

    However, schProduceUnqueCVHier also accepts a function object as the first argument. Because of this, you can do:

    (defun mainFun (lib cell view)
      (let ( (cv (dbOpenCellViewByType lib cell view))
            (viewList (myGetViewList)) ; myGetViewList is a skill function
            (paramTbl (makeTable "paramTbl")) )
    
        (defun visitCB (cell depth hierPath stopCv)
          ;;; append paramTbl with found parameters in cell
          ;;; just doing a dummy update for now
          (setarray paramTbl cell t)
          )
    
        (schProduceUniqueCVHier visitCB cv viewList  nil nil)
        paramTbl
    
        ))
    
    (setq tbl (mainFun "ether" "top" "schematic"))

    No global functions were needed here.

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • kkdesbois
    kkdesbois 4 months ago in reply to Andrew Beckett

    Hello Andrew,

    Thank you for the asnwers.

    1. My understanding of lexical scoping is still weak and I didn't realize that even the global function (defglobalfun) accesses the parameters defined  in the same scope

    2. I had tried the syntax without the quote in schProduceUniqueCVHier. When I use defun instead for defining the function and use the syntax with the function object in schProduceUniqueCVHier, I get the foolowing error :

    *** Error in routine schProduceUniqueCVHier:
    Message: *Error* schProduceUniqueCVHier: argument #1 should be a symbol (type template = "sdggllg") at line 55 of file ... 
    - funobj@0x4dfa02f0

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Andrew Beckett
    Andrew Beckett 4 months ago in reply to kkdesbois
    kkdesbois said:
    2. I had tried the syntax without the quote in schProduceUniqueCVHier

    Ah, this was a more recent change. In IC23.1 ISR5 (released end of February 2024) the function was updated to allow a function object to be passed; before that it was a symbol only as you have discovered. I assume you must be using an older version...

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • kkdesbois
    kkdesbois 4 months ago in reply to Andrew Beckett

    Exact.

    I usually use the last IC version available (I've been well educated by Cadence AEs ;))

    But exceptionnally, I was using IC20.1 ISR34 for testing other features of my code. So my trials of schProduceUniqueCVHier were in this current session.

    Finally, I'm a bit lucky because the final user of the code may use 20.1 or 23.1. So I will use defglobalfun which seems  to work with all ic versions.

    Thanks again for the support.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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