• 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. Callback function in EDIT cdf

Stats

  • Replies 3
  • Subscribers 143
  • Views 1835
  • Members are here 0

Callback function in EDIT cdf

NickJ
NickJ 5 months ago

I'm trying to edit a cell so that when I instantiate the symbol in a schematic, there are 2 custom parameters, bits and pixles, the product of these 2 integers should be used to append <(bits*pixels)-1:0> to the instance name.

I've added the parameters in the Edit CDF tool (opening it from the ciw window. These fields now appear in the edit object properties window and I can change thier values.

I have written a callback function so that when these fields are changed the instance name automatically updates. the code is as follows 

(defun renameInstanceOnParamChange (cdfParam cdfId paramName value)
    let( (cv inst paramValues bits pixels newValue numStr newName) 
        cv = geGetEditCellView() ;; Get the current schematic cell view
        inst = dbFindAnyInstByName(cv cdfGetInstCDF(cdfId)) ;; Find the instance
        paramValues = cdfGetParamValues(cdfId) ;; Get all CDF parameter values
        bits = cdr(assoc('bits paramValues)) ;; Extract 'bits' parameter
        pixels = cdr(assoc('pixels paramValues)) ;; Extract 'pixels' parameter
        if( bits && pixels then
            newValue = ((bits * pixels) - 1) ;; Correct SKILL assignment
            numStr = sprintf(nil "%d" newValue) ;; Convert to string
            newName = strcat("instName<" numStr ">") ;; Generate new name
            dbSet(inst 'name newName) ;; Set new instance name
            geUpdateAll() ;; Refresh GUI
            printf("Instance renamed to: %s\n" newName)
        else
            warn("Error: Missing 'bits' or 'pixels' parameter in CDF.")
        )
    )
)
(defun setBitsCallback (cdfParam cdfId paramName value)
    renameInstanceOnParamChange(cdfParam cdfId paramName value)
    printf("did tbitscallback work?")
)
(defun setPixelsCallback (cdfParam cdfId paramName value)
    renameInstanceOnParamChange(cdfParam cdfId paramName value)
)
I've entered the names of the callback functions setBitsCallback and setPixlesCallback into the callback field in the Edit CDF tool.
When I change the values in the Edit object propeties dialog I get an error,
Message:  *Error* eval: unbound variable - setPixelsCallback
CDF: An error occurred when evaluating callback.
    Callback: bits->callback => setBitsCallback
I'm not sure whether this is my SKILL code or whether I'm using the Edit CDF tool incorrectly.
Any help would be appreciated.
Cheers.
  • Sign in to reply
  • Cancel
  • Andrew Beckett
    Andrew Beckett 5 months ago

    There are numerous reasons why this won't work:

    1. The callback in the CDF is not just the name of the function; it's a string which is the full expression to be evaluated (it would have to be documented that it was expecting a function with the signature cdfParam cdfId paramName value - and that's not the case). Because of that, it would just see the function name as an attempt to reference a SKILL variable (which doesn't exist) - hence the error.
    2. Even if there was a way to call the function this way, it won't work for numerous other reasons, including...
    3. The function tries to find an existing instance using dbFindAnyInstByName(cv cdfGetInstCDF(cdfId)) - well, cdfGetInstCDF is not the name of an instance, so this will fail.
    4. There is no such function called cdfGetParamValues
    5. newName won't be the correct syntax for an iterated instance (and the prefix would always be instName)
    6. dbSet has the arguments in the wrong order
    7. Anyway, this won't work as the callback also gets called when you use Create Instance - at that time, the instance doesn't yet exist

    In general, there isn't really support for changing the instance name as part of a CDF callback... you might be able to get it to work via a hack of some sort (probably in the CDF doneProc would be the place to do it, if anywhere)

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • NickJ
    NickJ 5 months ago in reply to Andrew Beckett

    OK cheers.

    Is there any way to achieve this functionality?

    adding cdf parameters that when altered append <result-1:0> to the instance name?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Andrew Beckett
    Andrew Beckett 5 months ago in reply to NickJ

    As I said, potentially this could be done in the CDF done proc. The benefit of the done proc is that you know the instance then (if it's on a create instance, the instance will have been created; if editing properties you still have the instance). Also, any parameter updates will have been applied by then - so rather than you having to hunt down the instance you know it, and if done in a conventional CDF callback, the parameters have not yet been applied so it would be premature to change the instance name.

    Andrew

    • 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