Home > Community > Forums > Custom IC SKILL > SKILL examples to modify Virtuoso label text on schematic & layout

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 SKILL examples to modify Virtuoso label text on schematic & layout 

Last post Tue, Jun 27 2006 8:33 AM by archive. 4 replies.
Started by archive 27 Jun 2006 08:33 AM. Topic has 4 replies and 9680 views
Page 1 of 1 (5 items)
Sort Posts:
  • Tue, Jun 27 2006 8:33 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    SKILL examples to modify Virtuoso label text on schematic & layout Reply

    So others benefit...

    Here is a simple SKILL code example for modifying label text in Virtuoso schematic or layout based on a thread from comp.cad.cadence thanks to our good friend Bernd Fischer...

    procedure(MyReplaceLabels( libName viewName "tt" )
            let( ( d_libId d_cvId l_cellList l_labelList )

    d_libId = ddGetObj( libName )
    l_cellList = setof(
                    d_cell d_libId~>cells
                    member( viewName d_cell~>views~>name )
                    )

    foreach( d_cell l_cellList

         d_cvId = dbOpenCellViewByType( libName d_cell~>name viewName nil "a" )        

         l_labelList = setof( d_shape d_cvId~>shapes  d_shape~>objType == "label" )

         foreach( d_label l_labelList
            case( d_label~>theLabel
                            ( "VDD"
                                    d_label~>theLabel = "vdd!"

                            )
                            ( "VSS"
                                    d_label~>theLabel = "gnd!"
                            )
                    ) ;; close case
         )

       dbSave( d_cvId )
       dbClose( d_cvId )
    )

    )

    )
    ;; End of MyReplaceLabels.il


    Originally posted in cdnusers.org by John
    • Post Points: 0
  • Tue, Jun 27 2006 8:37 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: SKILL examples to modify Virtuoso label text on schematic & layout Reply

    So others benefit...

    Here is another simple SKILL code example for modifying label text in Virtuoso based on a recent thread from comp.cad.cadence asking...

    > I have a library with a few hundred cells, half of which have layouts
    > that contain multiple labels whose text I would like to change. 
    > In each layout, there is one label with text 'VDD' that I would like to
    > change to 'vdd!', and there is another label with text 'VSS' that I
    > would like to change to 'gnd!'.  The schematics are already correct.
    > Is there a way to do this with SKILL code? 

    /*
    TrChangeStrings.il

    This SKILL sample will search all the labels in your layout view,
    and judge whether the labels contain the old-string you want
    to replace, and then rename them to the desired new-string.

    TrChangeStrings( "oldString" "newString" )
    -OR-
    TrChangeStrings( "oldString" "newString" t );==> test mode won't save
    changes

    Ex. TrChangeStrings( "VDD" "vdd!" )
    Ex. TrChangeStrings( "VDD" "vdd!" t )

    The number of labels changed per cell will be reported along with
    the total number of labels changed.
    */

    procedure( TrChangeStrings( oldstring newstring @optional (test nil) )
      let( ( cv cnt (totalcnt 0) (view "layout") )
             cv=geGetEditCellView()
        cnt=0
        when( test printf("*** TEST MODE *** changes not saved\n") )
            foreach( shape cv~>shapes
              ;when( shape~>objType == "label" && shape~>theLabel ==
    oldstring
              when( shape~>objType == "label" && rexMatchp(oldstring
    shape~>theLabel
    )
                ;shape~>theLabel = newstring
                rexCompile(oldstring)
                shape~>theLabel = rexReplace(shape~>theLabel newstring 0)
                cnt++
              ) ; when label
            ) ; foreach shape
            unless( test dbSave( cv ))
            printf("%s %s : %d labels changed\n" cv~>cellName view cnt)
            totalcnt = totalcnt + cnt
        printf("** Total labels changed : %d\n" totalcnt)
        when( test printf("*** TEST MODE *** changes not saved\n") )
      ) ; let
    ) ;
    ;; End of TrChangeLabels.il


    Originally posted in cdnusers.org by John
    • Post Points: 0
  • Tue, Jun 27 2006 8:50 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: SKILL examples to modify Virtuoso label text on schematic & layout Reply

    So others benefit...

    This SKILL code sample for changing label text, kindly provided by our good
    friend Jay Singh, is more generic than the previous two examples in that
    it can easily be modified to get the desired functionality for any object
    in the design database.

    Prior to posting, this code has passed the Virtuoso SKILL Survey
    CIW: Tools -> SKILL -> Survey
    for all releases from IC400 to IC610 (beta) to date.


    /*************************************************************************
    * DISCLAIMER: The following code is provided for Cadence customers *
    * to use at their own risk. The code may require modification to *
    * satisfy the requirements of any user. The code and any modifications *
    * to the code may not be compatible with current or future versions of *
    * Cadence products. THE CODE IS PROVIDED "AS IS" AND WITH NO WARRANTIES, *
    * INCLUDING WITHOUT LIMITATION ANY EXPRESS WARRANTIES OR IMPLIED *
    * WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. *
    *************************************************************************/

    ;; Author : Cadence Design Systems
    ;; FileName: JayChangeLabel.il
    ;; Tested : IC442 IC443
    ;;
    ;; This procedure may be used to traverse through the hierarchy of a library.
    ;; If cellList is specified then the operation will be performed only on cellList.
    ;; default is all cells in the library.
    ;; viewName = layout or schematic
    ;;
    ;; Usage In CIW:
    ;; JayChangeLabel("library_name" "schematic" "old_label" "new_label")
    ;; SKILL LINT SCORE 100 (BEST MAXIMUM IS 100)

    procedure(JayChangeLabel(libName viewName oldLabel newLabel @optional listOfCells)

    let((cv libId cellId cellList)

    libId = ddGetObj(libName)
    if(!listOfCells then
    cellList = libId~>cells
    else
    cellList = nil
    foreach(cellName listOfCells
    cellId = ddGetObj(libName cellName)
    cellList = append(list(cellId) cellList)
    );end foreach
    );end if

    foreach(cell cellList
    foreach(view cell~>views
    ;; using views matching viewName variable.
    if(view~>name == viewName && (cv = dbOpenCellViewByType(libName cell->name
    view~>name "" "a")) then
    printf("\nOpened view %L from cell %L of library %L for edit.\n"
    cv~>viewName cv~>cellName cv~>libName)
    ;; Operate on the desired objects, Here it's shape with the property
    ;; theLabel = oldLabel
    foreach(shape cv~>shapes
    if(shape~>theLabel && (shape~>theLabel == oldLabel) then
    printf("\n Changing the label %L with %L. " shape~>theLabel newLabel )
    shape~>theLabel = newLabel
    );end if
    );end foreach

    dbSave(cv)
    dbClose(cv)
    );end if
    );end foreach view
    );end foreach cell

    ddReleaseObj(libId)
    );let
    );proc JayChangeLabel
    ;; End of JayChangeLabel.il


    Originally posted in cdnusers.org by John
    • Post Points: 0
  • Tue, Jun 27 2006 9:00 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: SKILL examples to modify Virtuoso label text on schematic & layout Reply

    So others benefit...

    Here is sample SKILL code to replace all occurances of slash '/' in a given
    layout hierarchy with the underscore '_' that can be modified to fit specific
    requirements as needed.

    If a text label is i_iopad/tied1_75, this program will change that text label
    to i_iopads_tied1_75 for text labels on all levels of the layout hierarchy.

    This SKILL had passed a Virtuoso CIW: Tools -> SKILL -> Survey before posting.

    /*******************************************************************************
    * DISCLAIMER: The following code is provided for Cadence customers to use at *
    * their own risk. The code may require modification to satisfy the *
    * requirements of any user. The code and any modifications to the code may *
    * not be compatible with current or future versions of Cadence products. *
    * THE CODE IS PROVIDED "AS IS" AND WITH NO WARRANTIES, INCLUDING WITHOUT *
    * LIMITATION ANY EXPRESS WARRANTIES OR IMPLIED WARRANTIES OF MERCHANTABILITY *
    * OR FITNESS FOR A PARTICULAR USE. *
    *******************************************************************************/

    procedure(CCSchangeCharInLabel(srcChar dstChar "tt")
    let( (cv mylabels myUniquelabels tmpcv labelText newlab )
    cv = geGetEditCellView()
    ;; search the cell hierarchy for labels that contain 'srcChar'
    ;; The third argument defines the number of hierarchy levels you wish to search
    mylabels=leSearchHierarchy( cv cv~>bBox 32 "label"
    list( list("text" "==" buildString(list(srcChar ) "") ))
    )
    ;; create a list of unique labels
    myUniquelabels = nil
    foreach(x mylabels
    unless(member(x myUniquelabels)
    myUniquelabels = cons(x myUniquelabels)
    )
    )
    ;
    ;
    ;; Do the actual change of labels
    foreach(lab myUniquelabels
    labelText = lab~>theLabel
    newlab = buildString(parseString(labelText srcChar) dstChar)
    printf("Original Label was %s\n" labelText)
    printf("The new Label would be %s\n" newlab)
    ;
    ;
    ;; if label is not in top level, we need to open the instance master in
    ;;edit
    ;; mode to modify the label
    ;
    ;
    if(lab~>cellView~>cellName != cv~>cellName then
    tmpcv = dbOpenCellViewByType(lab~>cellView~>libName lab~>cellView~>cellName
    lab~>cellView~>viewName nil "a")
    lab~>theLabel = newlab
    dbSave(tmpcv)
    dbClose(tmpcv)
    else
    ;; for top level labels
    lab~>theLabel = newlab
    );if
    );foreach
    dbSave(cv)
    ;dbClose(cv)
    );let
    );procedure
    ;
    ; Please make a backup of your original layout data before testing the script.
    ; Thescript actually alters the layout database.
    ; - Save the above SKILL script in a file.
    ; - Load the saved file into the CIW window with the command : load ""
    ; - Open the top level layout cellview in edit mode.
    ; - Type the following command in CIW window to execute the SKILL script:
    ; CCSchangeCharInLabel("/" "_")
    ;
    ;; End of CCSchangeCharInLabel.il


    Originally posted in cdnusers.org by John
    • Post Points: 0
  • Tue, Jun 27 2006 9:16 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: SKILL examples to modify Virtuoso label text on schematic & layout Reply

    So others benefit...

    This SKILL code example from Cadence solution #11094824 will convert symbolic
    pin angle brackets "< >" text to square brackets "[ ]" in a Virtuoso layout.

    Specifically, this sample SKILL code replaces all labels starting with "A"
    and ending with ">" to have delimiters replaced with "[ ]".

    Please note this sample SKILL changes ONLY the labels and does not modify the
    connectivity information on a pin that may have been created using the
    original label.

    This sample SKILL code passed a Virtuoso CIW: Tools -> SKILL -> Survey prior to
    posting.

    /*******************************************************************************
    * DISCLAIMER: The following code is provided for Cadence customers to use at *
    * their own risk. The code may require modification to satisfy the *
    * requirements of any user. The code and any modifications to the code may *
    * not be compatible with current or future versions of Cadence products. *
    * THE CODE IS PROVIDED "AS IS" AND WITH NO WARRANTIES, INCLUDING WITHOUT *
    * LIMITATION ANY EXPRESS WARRANTIES OR IMPLIED WARRANTIES OF MERCHANTABILITY *
    * OR FITNESS FOR A PARTICULAR USE. *
    *******************************************************************************/
    ; *Solution_No: 11094824
    ; *Title: How to change Pin labels from "<>" to "[]"
    ; Name: CCSchangeLabelDelimiter.il
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Save this code to a file such as CCSchangeLabelDelimiter.il
    ; and then load in CIW as
    ; load("CCSchangeLabelDelimiter.il").
    ; Then type CCSchangeLabelDelimiter() in CIW.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    procedure(CCSchangeLabelDelimiter()
    let( (cv mylabels myUniquelabels tmpcv labelText name
    index newlab)
    ;;cv = geGetEditCellView()
    cv = dbOpenCellViewByType("master" "MUX"
    "layout_test" nil "a")
    ;;search the cell hierarchy for labels that start
    with "A" and end with ">"
    ;;The third argument defines the number of hierarchy
    levels you wish to search
    mylabels=leSearchHierarchy( cv cv~>bBox 32
    "label"
    list( list( "text" "==" "^A" ) list("text"
    "==" ">$"))
    )
    ;;create a list of unique labels
    myUniquelabels = nil
    foreach(x mylabels
    unless(member(x myUniquelabels)
    myUniquelabels = cons(x
    myUniquelabels)
    )
    )
    foreach(lab myUniquelabels
    labelText =
    lab~>theLabel
    name =
    car(parseString(labelText
    "["))
    index=
    car(parseString(cadr(parseString(labelText
    "<")) ">"))
    newlab=
    buildString(list(buildString(list(name
    index ) "[") "]") "")
    printf("Original Label was %s\n"
    labelText)
    printf("The new Label would be
    %s\n" newlab)
    ;;if label is not in top level, we need to
    open the instance master in edit
    ;;mode to modify the label
    if(lab~>cellView~>cellName !=
    cv~>cellName then
    tmpcv =
    dbOpenCellViewByType(lab~>cellView~>libName
    lab~>cellView~>cellName
    lab~>cellView~>viewName
    nil "a")
    ;;println(lab~>name)
    lab~>theLabel = newlab
    dbSave(tmpcv)
    dbClose(tmpcv)
    )
    ;; for top level labels
    ;;println(lab~>name)
    lab~>theLabel = newlab
    )
    dbSave(cv)
    dbClose(cv)
    );let
    );procedure
    ;
    ; Save this code to a file such as CCSchangeLabelDelimiter.il
    ; Load in the Virtuoso CIW using load("CCSchangeLabelDelimiter.il")
    ; Then type CCSchangeLabelDelimiter() in the CIW.
    ;
    ;; End of CCSchangeLabelDelimiter.il


    Originally posted in cdnusers.org by John
    • Post Points: 0
Page 1 of 1 (5 items)
Sort Posts:
Started by archive at 27 Jun 2006 08:33 AM. Topic has 4 replies.