• 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 I add condition to ?choices on cdf

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 14451
  • 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 I add condition to ?choices on cdf

srikumarDA
srikumarDA over 6 years ago

HI,

I need the output like below on cdf form.

when AspectRatio=t the choices to be display as '("1" "2" "3") 

         AspectRatio=nil the choices to be display as '("5" "6" "7" "8"))

EXAMPLE:

cdfCreateParam(cdfId
      ?name          "AspectRatio"
      ?prompt        "Aspect Ratio Switch"
      ?defValue      t  
      ?type          "boolean"
      ?storeDefault  "yes"
      ?display       "t"
    )

cdfCreateParam( cdfId
      ?name              "aspect_ratio"
      ?prompt            "Aspect Ratio"
      ?defValue          "1.0"
      ?type              "cyclic"
      ?choices           if(cdfgData->AspectRatio->value then '("1" "2" "3") else '("5" "6" "7" "8"))
      ?parseAsCEL        "yes"
      ?storeDefault      "yes"
    )

?choices           if(cdfgData->AspectRatio->value then '("1" "2" "3") else '("5" "6" "7" "8")) is not working it is always picking the first one('("1" "2" "3") ).

  • Cancel
  • mbracht
    mbracht over 6 years ago

    Hi Srikumar,

    Of course the value of ?choices can be any valid SKILL expression - so the if() statement for itself is ok. The problem is the use of the global variable cdfgData - the system automatically assigns the cdf description to this variable whenever you open the 'Edit Instance properties' window on an instance or create a new instance. So the above code works only if at the time of it's execution cdfgData is set and pointing to the right cdf description - not a safe assumption! You should implement the behaviour you want in terms of a cdf callback for the AspectRatio cdf parameter. That callback should then set the choices  for the aspect_ratio parameter.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mbracht
    mbracht over 6 years ago

    I played a little trying to implement this in terms of CDF callbacks:

    cdfId=(cdfCreateBaseCellCDF (ddGetObj <lib> <cell>))
    cdfCreateParam(cdfId
       ?name          "AspectRatio"
       ?prompt        "Aspect Ratio Switch"
       ?defValue      t
       ?type          "boolean"
       ?storeDefault  "yes"
       ?display       "t"
       ?callback      "AspectRatioCB()")

    cdfCreateParam( cdfId
       ?name              "aspect_ratio"
       ?prompt            "Aspect Ratio"
       ?defValue          "1"
       ?type              "cyclic"
       ?choices           '("1" "2" "3")
       ?parseAsCEL        "yes"
       ?storeDefault      "yes")

    (defun AspectRatioCB ()
       (let (aspect_ratio AspectRatio)
          AspectRatio = (car (setof param cdfgData~>parameters param~>name=="AspectRatio"))
          aspect_ratio = (car (setof param cdfgData~>parameters param~>name=="aspect_ratio"))
          aspect_ratio~>choices = (if AspectRatio~>value '("1" "2" "3") '("5" "6" "7" "8"))))

    The above code does work with the new property assistant for an instance of the corresponding cell but unfortunately not for the 'Edit Instance Properties' dialog were modification of the the choices isn't reflected before you close the window and open it again

    • 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