• 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. Creating a new PCell wrapper from a base PCell

Stats

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

Creating a new PCell wrapper from a base PCell

Naveen002
Naveen002 over 2 years ago

Hi Team,

We do have an requirement to develop a wrapper PCell (will mention as "destination cell" further) from an existing PCell (here onwards, will mention as "source cell"). In this case, we need all the cdf parameters of the source cell to be transferred to the destination cell and we will be adding some extra parameters through skill using cdf commands. 

Following are the things done.
i) Instantiated the source cell in a new layout (say cell1).
ii) Used "Tools->CDF->copy" to copy the parameters of the source to destination cell (cell1). Chosen CDF Type as "Base Cell" in the fields.
iii) Added a new CDF parameter to the cell (cell1) using "cdfCreateParam" and also saved the cdf. Compiling the p-cell and found no errors.
iv) Now, for testing the p-cell, placed an instance of it (cell1) in different layout (say cell2) and when queried it, the parameters of the source cell are reflected in the destination cell. Also, the newly added cdf parameter is visible.
v) When the value of newly added parameter is modified, the respective callback gets triggered and updates the field accordingly. But when the values of the copied parameters (copied from source to destination cell) are changed, the callbacks are not working as in the source cell (Just an extra point, we checked the cdf callback field, it's mapped to the valid callbacks).

Could you please point out where we are losing our control in this case? Also, let us know the way we are doing is correct or not.
Please let us know if further information is needed.

Thanks in advance!
Naveen Prasad


  • Cancel
  • p94todorov
    p94todorov over 2 years ago

    Hello Naveen,

    I will not comment on what you might be doing wrong since this might become a long discussion and instead I am posting the source code for the template of such a structure that I've been using numerous times without any issues. It's meant to be pretty clean and universal approach, so I suppose that it should work for you too:

    procedure(wrapperPcell(@key (wrapLibName "origLib") (wrapCellName "cellName") (newLibName "wrapLib") (newCellName "wrappedCellName") "tttt")
    let((wrapPCell cdfId dummyCV pcellParamList paramName paramType)
    ;;; delete the CDF if there is one
    wrapPCell = ddGetObj(newLibName newCellName)
    when(cdfId = cdfGetBaseCellCDF(wrapPCell) cdfDeleteCDF(cdfId))
    ;;; create temporary empty dummy layout so we can attach the CDF data to this cellView
    dummyCV = dbOpenCellViewByType(newLibName newCellName "layout" "maskLayout" "a")
    cdfId = cdfCopyCDF(ddGetObj(newLibName newCellName) "baseCellData" cdfGetBaseCellCDF(ddGetObj(wrapLibName wrapCellName)))
    dbSave(dummyCV)
    dbClose(dummyCV)

    ;;; add extra parameters on top of original CDF
    cdfCreateParam(cdfId
    ?name "addOutline"
    ?prompt "Add OUTLINE around M1"
    ?defValue "YES"
    ?type "radio"
    ?choices '("YES" "NO")
    ?storeDefault "yes"
    ?display "t"
    );addOutline
    ;;; save the CDF info
    cdfSaveCDF(cdfId)

    ;;; get the CDF info
    cdfId = cdfGetBaseCellCDF(ddGetObj(newLibName newCellName))
    ;;; build the parameter list directly from the CDF
    pcellParamList = sprintf(nil "'((wrapLibName string \"%s\") (wrapCellName string \"%s\")" wrapLibName wrapCellName)
    foreach(param setof(param cdfId->parameters param->paramType != "netSet")
    paramName = param->name
    paramType = param->paramType
    when(member(paramType list("cyclic" "radio")) paramType = "string")
    pcellParamList = strcat(pcellParamList sprintf(nil "(%s\t%s\tget(cdfId\t'%s\t)->defValue\t)\n" paramName paramType paramName))
    );foreach
    ;;; close the final bracket
    pcellParamList = evalstring(strcat(pcellParamList ")"))
    ;;; really tiny pcell shell
    pcDefinePCell(list(ddGetObj(newLibName) newCellName "layout") pcellParamList
    ;;; P-Cell Code
    let((cv paramList wrapCell wrapCellCDF paramName paramType wrapInst
    growMargin M1Layer sizedM1Layer
    )
    ;;; take short notation for the cellview
    cv = pcCellView
    paramList = "'("
    wrapCell = dbOpenCellViewByType(wrapLibName wrapCellName "layout" "maskLayout" "r")
    wrapCellCDF = cdfGetBaseCellCDF(ddGetObj(wrapLibName wrapCellName))
    ;;; fill-in the PDK pCell parameters
    foreach(param setof(param wrapCellCDF->parameters param->paramType != "netSet")
    paramName = param->name
    paramType = param->paramType
    when(member(paramType list("cyclic" "radio")) paramType = "string")
    paramList = strcat(paramList sprintf(nil "(\"%s\"\t\"%s\"\t%L)\n" paramName paramType evalstring(paramName)))
    );foreach
    ;;; close the bracket
    paramList = evalstring(strcat(paramList ")"))
    ;;; create the wrapped up instance
    wrapInst = dbCreateParamInst(cv wrapCell "origPCell" 0:0 "R0" 1 paramList)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;; ADD YOUR EXTRA CODE BELOW ;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    when(addOutline == "YES"
    ;;; just an ABE example for adding resized halo around M1 shapes (proof of concept)
    growMargin = 0.100
    abeInit(cv ?doInterrupts t )
    M1Layer = abeLayerFromCellView("M1" ?bbox pcGrowBox(cv->bBox growMargin) ?purpose "drawing")
    unless(M1Layer~>numTiles == 0
    sizedM1Layer = abeNewLayer()
    abeLayerSize(M1Layer sizedM1Layer growMargin)
    abeLayerToCellView(sizedM1Layer "OUTLINE" ?purpose "drawing")
    );unless
    abeDone()
    );when

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;; ADD YOUR EXTRA CODE ABOVE ;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    ;;; close the wrap cell
    dbClose(wrapCell)
    );let (inner)
    );pcDefinePCell
    );let
    );wrapperPcell

    I am sorry that the indentation is messed up, but you should be easily able to augment any existing pCell by simply calling the wrapperPcell function on top of it. I have only included a single new CDF parameter so you can see how it works and you can then augment the code of the function based on your needs.

    Regards,

    Petar

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Naveen002
    Naveen002 over 2 years ago in reply to p94todorov

    Hi Petar,

    Great, thanks!! It works fine when loaded and tested.
    But one thing I faced is, when instantiated the newly wrapped cell, the parameters are not getting modified when changed. So, what I did is I just moved the instance and tried, it worked. Might be it's due to the call-back. Even when tried to instantiate a new cell, I am getting this error (snip below). Did you too faced the same?


    Even though, I am just curious why the way I followed didn't worked. As it does the same way as you did with skill, such as cdf copy to wrapper cell from base cell and compiling it to a p-cell. Might be if you get to know, please share your suggestions.

    BTW, thanks a lot for your quick response and taking time to reply.

    Thanks,
    Naveen Prasad

    • 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