search and replace in SKILL

Discussion in 'Cadence' started by Arnold, May 4, 2004.

  1. Arnold

    Arnold Guest

    Hi

    can someone show me how can I search an instance and replace it by an
    other instance ? In the schematic editor it is only possible to search
    for an instance but not to change from this instance the libName and
    the cellName at the same time. But this should be possible in SKILL. I
    know how to search for the instance, but not how to replace it.

    THX

    CU
    Arny
     
    Arnold, May 4, 2004
    #1
  2. This is a very old script of me, us at your on risk.

    Bernd

    /*******************************************************************************
    *File Name : BfReplaceInstance.il
    *Function(s) : BfReplaceInstance
    *Author : Bernd Fischer
    *Date : Thu, 01 Dec 2001
    *Revision : 1.0
    *SW Release : 4.4.5
    *SKILL Lint : PASSed, IQ=100, 0 short-list errors, 0 long-list-errors
    *Synopsis : BfReplaceInstance(
    * t_sourceLibName t_sourceCellName
    * t_sourceViewName t_destLibName
    * t_destCellName t_destViewName
    * )
    *Modification :
    *Description : This skill function replaces all instances in a cell view
    * for the given source library cell and view name to the
    * given destination library cell and view name.
    * An asterisk "*" can be used as a wildcard for the source and
    * destination cell name.
    * If the source cell names value is an asterisk "*" and the
    * desination cell names value is a valid string, all instances
    * in the current cell view will be replaced to the given
    * destination cell name.
    * If the source cell names value is a asterisk "*" and the
    * desination cell names value is an asterisk "*" too,
    * all instances in the current cell view
    * will be replaced by the given destination cell view only.
    *
    *******************************************************************************/

    procedure( BfReplaceInstance(
    t_sourceLibName
    t_sourceCellName
    t_sourceViewName
    t_destLibName
    t_destCellName
    t_destViewName
    "tttttt"
    )
    let( (
    d_cvId d_destInstance l_cellList t_tmpDestCellName
    )

    /* assigment of local variables */

    d_cvId = geGetWindowCellView( ) /* celview Id of current cell view */
    t_tmpDestCellName = t_destCellName

    /* if source cell name is asterisk then build a list of all instance cell names
    in the cell view */

    if( t_sourceCellName == "*" then
    l_cellList = d_cvId~>instances~>cellName
    else
    l_cellList = nil
    ) /* if */


    /* replacement of every instance in the cell view for valid source or destination
    specifications */

    foreach( d_instance d_cvId~>instances

    if(
    d_instance~>libName == t_sourceLibName
    &&
    ( d_instance~>cellName == t_sourceCellName
    ||
    rexMatchList( d_instance~>cellName l_cellList ) )
    &&
    d_instance~>viewName == t_sourceViewName
    then
    /* when the destination cell name is asterisk then use the
    cell name of the current instance as destination cell name */

    when( t_tmpDestCellName == "*"
    t_destCellName = d_instance~>cellName
    ) /* when */

    printf( "*INFO* BfReplaceInstance: " )
    printf( "Instance (%s) " d_instance~>name )
    printf( "(%s " d_instance~>libName )
    printf( "%s " d_instance~>cellName )
    printf( "%s) " d_instance~>viewName )

    /* open the destination cell view */

    d_destInstance =
    dbOpenCellViewByType(
    t_destLibName
    t_destCellName
    t_destViewName
    )
    /* assign the instance master to its new value,
    the destination cell view */

    d_instance~>master = d_destInstance

    /* print information */

    printf( "was replaced by " )
    printf( "(%s " d_instance~>libName )
    printf( "%s " d_instance~>cellName )
    printf( "%s).\n" d_instance~>viewName )

    /* no valid source or destination specification */

    else
    /* instance will not be replaced, print warning */

    printf( "*WARNING* BfReplaceInstance: " )
    printf( "Instance (%s) " d_instance~>name )
    printf( "(%s " d_instance~>libName )
    printf( "%s " d_instance~>cellName )
    printf( "%s) " d_instance~>viewName )
    printf( "was not replaced, wrong source or destination specifications.\n" )
    ) /* if */
    ) /* foreach */

    ) /* let */

    )
     
    Bernd Fischer, May 4, 2004
    #2
  3. Arnold

    S. Badel Guest

    here is an example to replace instances of one cell
    with instances of another one :

    ; open the cellview
    cv = dbOpenCellViewByType( ... )

    ; walk through all the instances
    foreach( inst cv~>instances
    when( ( inst~>libName == "LIB_FROM" && inst~>cellName == "CELL_FROM" )
    dbSetInstHeaderMasterName( inst~>instHeader "LIB_TO" "CELL_TO" "VIEW_TO" )
    ) ; when
    ) ; foreach

    dbSave( cv )
    dbClose( cv )

    find all the documentation you need in the "Cadence
    Design Framework II SKILL Functions Reference".

    Stéphane
     
    S. Badel, May 4, 2004
    #3
  4. Arnold

    S. Badel Guest

    Note also that in the schematic editor, you can search
    for the instance, then click "select" to select them all,
    edit the properties with "Apply To" set to "all selected"
    and change the instance name. but skill is definitely
    more powerful for automating or doing more complex
    tasks.

    Stéphane
     
    S. Badel, May 4, 2004
    #4
  5. Arnold

    Arnold Guest

    Hi Bernd and Stéphane

    THANK YOU very much for your help !!!
    both SKILL scripts work.

    Stéphane do you work in Lausanne ? I will be there in August. There is
    a "Low Noise Analog IC Design" Cource which I will visit. Maye we will
    see us :)

    CU

    Arny
     
    Arnold, May 5, 2004
    #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.