modify CDF for all pcells in library

Discussion in 'Cadence' started by vtcad, Aug 28, 2009.

  1. vtcad

    vtcad Guest

    I would like to go through all the pcells in my library and change all
    the ?editable "nil" to ?editable "t", is it possible to use a skill
    script to do this, instead of the edit->CDF menu in the CIW?
     
    vtcad, Aug 28, 2009
    #1
  2. vtcad

    Riad KACED Guest

    Hi vtcad,

    You might be interested in trying the following code.
    Just load it and give a try as following:
    CIW> RKsetCdfAttribute(libName 'editable t)

    ; RKsetCdfAttribute.il Skill file Starts here
    procedure( RKsetCdfAttribute(libName attribute value)
    foreach(cell ddGetObj(libName)~>cells~>name
    RKsetCdfAttributeByCell(libName cell attribute value)
    )
    t
    )

    procedure( RKsetCdfAttributeByCell(libName cellName attribute value)
    let((cellId cdfId (needSave nil))
    printf("Processing cell %s - %s \n" libName cellName)
    cellId=ddGetObj(libName cellName)
    when(and(cellId cellId~>isWritable)
    cdfId=cdfGetBaseCellCDF(cellId)
    foreach(parameter cdfId->parameters
    when(member(attribute getq(parameter ?))
    unless(getq(parameter attribute)==value
    putpropq(parameter value attribute)
    printf("%s->%s has been set to %L\n"
    parameter->name attribute getq(parameter attribute))
    )
    )
    )
    when(needSave
    cdfSaveCDF(cellId)
    )
    )
    t
    )
    )
    ; Skill ends here

    Cheers,
    Riad.
     
    Riad KACED, Aug 28, 2009
    #2
  3. vtcad

    Riad KACED Guest

    Hi vtcad,

    Do you want to set the ?editable "t" for all the CDF parameters ?
    You are very likely to end up with a read-only components ...

    Anyway, here after a Skill script that does what you are asking.
    Just copy/paste the code into a file, load it and try the following
    into the CIW:
    CIW> RKsetCdfAttribute(libName 'editable t)
    This command will parse all the cells of a lib and sets the editable
    attributes to t when needed. Again, this will do it for all the
    parameters, which is not a good idea unless there is a specific need.
    In case you want to process a certain parameter only, then try:
    CIW>

    In case you want to run the script on a given parameter only, then try
    something similar to:
    CIW> RKsetCdfAttributeByParam("myLib" "w" 'editable t)

    Also, this script parses all the cells in the lib, not aonly those
    with pcells. You my need to add a setof to run the script on cells
    with layout view only if you want.
    I unfortunately don't know how to tell whether a layout view
    corresponds to a Pcell, Someone may help on this to make it more
    optimized. In fact, the only thing I know that tells me a layout is
    Pcell is one I select an instance and find the superMaster on it,
    which is not the case in here. I'm pretty much sure there would be
    something to do this ...

    ; RKsetCdfAttribute.il
    ; Entry function to parse a whole library, setting
    ; a CDF attribute to a velue defined by user.
    ; This fucntion operates on all CDF parameters
    ; Run example:
    ; CIW> RKsetCdfAttribute("myLib" 'editable t)
    procedure( RKsetCdfAttribute(libName attribute value)
    foreach(cell ddGetObj(libName)~>cells~>name
    RKsetCdfAttributeByCell(libName cell attribute value)
    )
    )
    ; Function called by RKsetCdfAttribute, sets
    ; a CDF attribute to a velue defined by user.
    ; This fucntion operates on all CDF parameters
    procedure( RKsetCdfAttributeByCell(libName cellName attribute value)
    let((cellId cdfId (needSave nil))
    printf("Processing cell %s - %s \n" libName cellName)
    cellId=ddGetObj(libName cellName)
    when(and(cellId cellId~>isWritable)
    cdfId=cdfGetBaseCellCDF(cellId)
    foreach(paramId cdfId->parameters
    when(member(attribute getq(paramId ?))
    unless(getq(paramId attribute)==value
    putpropq(paramId value attribute)
    printf("%s->%s has been set to %L\n"
    paramId->name attribute getq(paramId attribute))
    needSave=t
    )
    )
    )
    when(needSave
    cdfSaveCDF(cdfId)
    )
    )
    t
    )
    )
    ; Entry function to parse a whole library, setting
    ; a CDF attribute to a velue defined by user.
    ; This fucntion operates on parameter given by user
    ; Run example:
    ; CIW> RKsetCdfAttributeByParam("myLib" "w" 'editable t)
    procedure( RKsetCdfAttributeByParam(libName param attribute value)
    foreach(cell ddGetObj(libName)~>cells~>name
    RKsetCdfAttributeByParamByCell(libName cell param attribute value)
    )
    )
    ; Function called by RKsetCdfAttributeByParam, sets
    ; a CDF attribute to a velue defined by user.
    ; This fucntion operates on parameter given by user
    procedure( RKsetCdfAttributeByParamByCell(libName cellName param
    attribute value)
    let((paramId cellId cdfId (needSave nil))
    printf("Processing cell %s - %s \n" libName cellName)
    cellId=ddGetObj(libName cellName)
    when(and(cellId cellId~>isWritable)
    cdfId=cdfGetBaseCellCDF(cellId)
    when(cdfId
    paramId=cdfFindParamByName(cdfId param)
    when(and(paramId member(attribute getq(paramId ?)))
    unless(getq(paramId attribute)==value
    putpropq(paramId value attribute)
    printf("%s->%s has been set to %L\n"
    paramId->name attribute getq(paramId attribute))
    needSave=t
    )
    )
    when(needSave
    cdfSaveCDF(cdfId)
    )
    )
    )
    t
    )
    )

    Cheers,
    Riad.
     
    Riad KACED, Aug 29, 2009
    #3
  4. vtcad

    Riad KACED Guest

    Hi vtcad,

    Do you want to set the ?editable "t" for all the CDF parameters ?
    You are very likely to end up with some unexpected behaviour ...

    Anyway, here after a Skill script that does what you are asking.
    Just copy/paste the code into a file, load it and try the following
    into the CIW:
    CIW> RKsetCdfAttribute(libName 'editable t)
    This command will parse all the cells of a lib and sets the editable
    attributes to t when needed. Again, this will do it for all the
    parameters, which is not a good idea unless there is a specific need.
    In case you want to process a certain parameter only, then try:
    CIW>

    In case you want to run the script on a given parameter only, then try
    something similar to:
    CIW> RKsetCdfAttributeByParam("myLib" "w" 'editable t)

    Also, this script parses all the cells in the lib, not aonly those
    with pcells. You my need to add a setof to run the script on cells
    with layout view only if you want.
    I unfortunately don't know how to tell whether a layout view
    corresponds to a Pcell, Someone may help on this to make it more
    optimized. In fact, the only thing I know that tells me a layout is
    Pcell is one I select an instance and find the superMaster on it,
    which is not the case in here. I'm pretty much sure there would be
    something to do this ...

    ; RKsetCdfAttribute.il
    ; Entry function to parse a whole library, setting
    ; a CDF attribute to a velue defined by user.
    ; This fucntion operates on all CDF parameters
    ; Run example:
    ; CIW> RKsetCdfAttribute("myLib" 'editable t)
    procedure( RKsetCdfAttribute(libName attribute value)
    foreach(cell ddGetObj(libName)~>cells~>name
    RKsetCdfAttributeByCell(libName cell attribute value)
    )
    )
    ; Function called by RKsetCdfAttribute, sets
    ; a CDF attribute to a velue defined by user.
    ; This fucntion operates on all CDF parameters
    procedure( RKsetCdfAttributeByCell(libName cellName attribute value)
    let((cellId cdfId (needSave nil))
    printf("Processing cell %s - %s \n" libName cellName)
    cellId=ddGetObj(libName cellName)
    when(and(cellId cellId~>isWritable)
    cdfId=cdfGetBaseCellCDF(cellId)
    foreach(paramId cdfId->parameters
    when(member(attribute getq(paramId ?))
    unless(getq(paramId attribute)==value
    putpropq(paramId value attribute)
    printf("%s->%s has been set to %L\n"
    paramId->name attribute getq(paramId attribute))
    needSave=t
    )
    )
    )
    when(needSave
    cdfSaveCDF(cdfId)
    )
    )
    t
    )
    )
    ; Entry function to parse a whole library, setting
    ; a CDF attribute to a velue defined by user.
    ; This fucntion operates on parameter given by user
    ; Run example:
    ; CIW> RKsetCdfAttributeByParam("myLib" "w" 'editable t)
    procedure( RKsetCdfAttributeByParam(libName param attribute value)
    foreach(cell ddGetObj(libName)~>cells~>name
    RKsetCdfAttributeByParamByCell(libName cell param attribute value)
    )
    )
    ; Function called by RKsetCdfAttributeByParam, sets
    ; a CDF attribute to a velue defined by user.
    ; This fucntion operates on parameter given by user
    procedure( RKsetCdfAttributeByParamByCell(libName cellName param
    attribute value)
    let((paramId cellId cdfId (needSave nil))
    printf("Processing cell %s - %s \n" libName cellName)
    cellId=ddGetObj(libName cellName)
    when(and(cellId cellId~>isWritable)
    cdfId=cdfGetBaseCellCDF(cellId)
    when(cdfId
    paramId=cdfFindParamByName(cdfId param)
    when(and(paramId member(attribute getq(paramId ?)))
    unless(getq(paramId attribute)==value
    putpropq(paramId value attribute)
    printf("%s->%s has been set to %L\n"
    paramId->name attribute getq(paramId attribute))
    needSave=t
    )
    )
    when(needSave
    cdfSaveCDF(cdfId)
    )
    )
    )
    t
    )
    )

    Cheers,
    Riad.
     
    Riad KACED, Aug 30, 2009
    #4
  5. Riad KACED wrote, on 08/30/09 00:14:
    I suspect the term "pcell" was not necessarily being used accurately - he may
    not have been referring to pcells after all.

    Anyway, to find out whether a layout master is a pcell, do:

    cv=dbOpenCellViewByType("libName" "cellName" "viewName")
    cv~>isParamCell

    This will return t if it's a pcell.

    Regards,

    Andrew.
     
    Andrew Beckett, Sep 1, 2009
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.