• 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. Changeing choices and defaultvalue of cdfParameter through...

Stats

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

Changeing choices and defaultvalue of cdfParameter through callback

KHaas
KHaas over 2 years ago

I have a question regarding the change of choices in an cyclic cdfParameter as well as setting a new defaultvalue using a callback from an other parameter when creating PCells with SKILL.

Right now i am working on a design where I have a cyclic parameter, which sets a metallayer. According to this parameter a second cyclic parameter should only have the options of the metallayer above and below the first parameter. For example when the first one is using M4, the options of the second parameter should be M3 and M5. I achievd this using a global variable (I know, that this is bad), which means that when I restart Virtuoso, the state is lost, because the global variable is unknown. And also when opening a second design and using the generated PCell the global variables are already set to the values of the first design. A code example would look like this.

library = ddGetObj("examplelib")
cell = "examplecell"
layeroptions = list("M4")
Lay = "M4"

PCellLayoutId = pcDefinePCell(
list( library cell "layout" "maskLayout")
; Parameters
    (
    (layer1 "M3")
    (layer2 Lay)
    )
    let(()
        cv = pcCellView
        dbCreateRect(cv list(Lay "drawing") list(x1:y1 x2:y2))
        dbCreateRect(cv list(layer1 "drawing") list(x3:y3 x4:y4))
    )
dbSave(PCellLayoutId)
dbClose(PCellLayoutId)

let(
    ( cellId cdfId ) ; searching the cell name
    unless( cellId = ddGetObj( library~>name cell )
    error( "Could not find cell %s." cell ) ; error, if cell not in library
    )
    when( cdfId = cdfGetBaseCellCDF( cellId )
    cdfDeleteCDF( cdfId )
    )
    cdfId = cdfCreateBaseCellCDF( cellId )

cdfCreateParam(cdfId
    ?name "layer1"
    ?type "cyclic"
    ?prompt "Layer 1"
    ?defValue "M3"
    ?choices list("M1" "M2" "M3" "M4" "M5" "M6" "M7" "M8")
    ?callback "layeroptions = list(\"\")

   
    ; (this code kills the submission mask of the support website)

    print(layeroptions)
    cdfgData~>layer2~>choices = layeroptions
    Lay = \"\"
    "
    )

cdfCreateParam( cdfId
    ?name "layer2"
    ?type "cyclic"
    ?prompt " Layer 2"
    ?defValue Lay
    ?choices layeroptions
    ?callback "
    Lay = cdfgData~>layer2~>value
    print(cdfgData~>layer2~>value)"
    )

    cdfId->simInfo = list( nil )
    cdfId->simInfo->UltraSim = '( nil )
    cdfId->simInfo->ams = '( nil )
    cdfId->simInfo->auCdl = '( nil )
    cdfId->simInfo->auLvs = '( nil )
    cdfId->simInfo->cdsSpice = '( nil )
    cdfId->simInfo->hspiceD = '( nil )
    cdfId->simInfo->hspiceS = '( nil )
    cdfId->simInfo->spectre = '( nil )
    cdfId->simInfo->spectreS = '( nil )
    cdfSaveCDF(cdfId)
)

Is there an intentional way to change the parameter options and defaults without using a global variable? And if not, does anyone have an idea how to change the options without using the global variables?

Thanks in advance, any help is appreciated.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago

    This is rather confused as the code above is not complete (there's no pcDefinePCell, for example). Also the code following the second "; More PCell code" comment would not be part of the PCell code (you can't or rather shouldn't update the CDF within the PCell body).

    Instead, you can define the CDF once, and then in the callback for a relevant parameter, change the choices of another parameter. This is covered in this article Unable to change choices of a cyclic CDF parameter through callback, example layer choices (the title is referring to the fact that many releases ago this was not possible, but it's been possible for more than 10 years now). No global variables would be needed to achieve this.

    Since your code is rather incomplete, I can't adapt your code to show you how it could work in your case. Hopefully you can figure it out from reading the article instead.

    Andrew 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • KHaas
    KHaas over 1 year ago in reply to Andrew Beckett

    Hello Andrew,

    thanks to the article I have now got it working. I also updated the code above to be more clear if other people would be looking for this. My solution looks like this.

    library = ddGetObj("examplelib")
    cell = "examplecell"

    PCellLayoutId = pcDefinePCell(
    list( library cell "layout" "maskLayout")
    ; Parameters
        (
        (layer1 "M3")
        (layer2 Lay)
        )
        let(()
            cv = pcCellView
            dbCreateRect(cv list(layer1 "drawing") list(x1:y1 x2:y2))
            dbCreateRect(cv list(layer1 "drawing") list(x3:y3 x4:y4))
        )
    dbSave(PCellLayoutId)
    dbClose(PCellLayoutId)

    let(
        ( cellId cdfId ) ; searching the cell name
        unless( cellId = ddGetObj( library~>name cell )
        error( "Could not find cell %s." cell ) ; error, if cell not in library
        )
        when( cdfId = cdfGetBaseCellCDF( cellId )
        cdfDeleteCDF( cdfId )
        )
        cdfId = cdfCreateBaseCellCDF( cellId )

    cdfCreateParam(cdfId
        ?name "layer1"
        ?type "cyclic"
        ?prompt "Layer 1"
        ?defValue "M3"
        ?choices list("M1" "M2" "M3" "M4" "M5" "M6" "M7" "M8")
        ?callback "layeroptions = list(\"\")
        
        cdfgData~>layer2~>value = \"\"
        cdfgData~>layer2~>choices = layeroptions
        "
        )

    cdfCreateParam( cdfId
        ?name "layer2"
        ?type "cyclic"
        ?prompt "Layer 2"
        ?defValue ""
        ?choices list("" "M1" "M2" "M3" "M4" "M5" "M6" "M7" "M8" "M9")
        )

        cdfId->simInfo = list( nil )
        cdfId->simInfo->UltraSim = '( nil )
        cdfId->simInfo->ams = '( nil )
        cdfId->simInfo->auCdl = '( nil )
        cdfId->simInfo->auLvs = '( nil )
        cdfId->simInfo->cdsSpice = '( nil )
        cdfId->simInfo->hspiceD = '( nil )
        cdfId->simInfo->hspiceS = '( nil )
        cdfId->simInfo->spectre = '( nil )
        cdfId->simInfo->spectreS = '( nil )
        cdfSaveCDF(cdfId)
    )

    This warning \w *WARNING* Can't modify attributes of effective CDF parameters. was the reason I started using the global variables, but now it works. So thanks again.

    KHaas

    • 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