• 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. How to update references using cdsCopyShell?

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 142
  • Views 13533
  • 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

How to update references using cdsCopyShell?

dmay
dmay over 13 years ago

I have a large design with many libraries and cellviews that needs to have library references changed. I'm currently working in 5.1.41, but will eventually be working in 6.1.5. It looks like the cdsCopy Skill commands have all the capabilities to do the rereferencing but I haven't found any good examples to do what I need to do. Is there anyone out there familiar with these commands that could briefly explain how to do the following using cdsCopyShell:

For a list of libraries
Rename library references from a list of old names to a list of new names (there is a one-to-one correspondence for old/new lib names).

OR

For a particular hierarchy (I specify the top cell)
Rename library references from a list of old names to a list of new names (there is a one-to-one correspondence for old/new lib names).

I have done this sort of stuff in Skill code, but it seems to run much slower than rereferencing operations in the Library Manager. I'm hoping that using the cdsCopy routines, I can speed up all this rereferencing work.

Thanks,

Derek

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Derek,

    Not something I have code for - I've used some of the ccp functions in the past, but not really for the purposes you describe.

    There is an example in this solution on using rename reference library, which might get you started.

    For the second item, you could probably use the ccp functions to expand the hierarchy (or maybe you could use the pcdb functions to efficiently expand the hierarchy, and then create your gdmSpec objects from that to do the rename reference library operations on?). Some code - might be useful:

    /* abPcdbHierarchy.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Nov 05, 2010 
    Modified   A.D.Beckett
    By         Nov 17, 2010 
    
    Using a pcdb based approach (which avoids having to open the entire
    database), traverse the hierarchy to find all the lib/cell/view used
    
    Examples:
    
    ;------------------------------------------------------------------------
    ; Print the sorted results of traversing a layout to a file dump.txt
    ;------------------------------------------------------------------------
    abPcdbPrintSorted(
        abPcdbHierarchy(?libName "ether" ?cellName "top" ?viewName "layout" ?useViewList nil) 
        "./dump.txt"
    )
    
    ;------------------------------------------------------------------------
    ; Print the sorted results of traversing a schematic hierarchy with the 
    ; default switch and stop lists to standard output
    ;------------------------------------------------------------------------
    abPcdbPrintSorted(
        abPcdbHierarchy(?libName "ether" ?cellName "top" ?viewName "schematic")
    )
    
    ;------------------------------------------------------------------------
    ; Use a different switch and stop list and include pins, sheets etc
    ;------------------------------------------------------------------------
    abPcdbPrintSorted(
        abPcdbHierarchy(?libName "ether" ?cellName "top" ?viewName "schematic"
            ?switchViewList "hspiceD schematic symbol" ?stopViewList "hspiceD symbol"
            ?includeIgnored t
        )
    )
    
    ***************************************************
    
    SCCS Info: @(#) abPcdbHierarchy.il 11/17/10.17:25:53 1.3
    
    */
    
    
    /***************************************************************************************
    *                                                                                      *
    *                    abPcdbHierarchy(@key libName cellName viewName                    *
    *        (switchViewList "spectre cmos_sch cmos.sch schematic veriloga symbol")        *
    *                           (stopViewList "spectre symbol")                            *
    *                                   (useViewList t)                                    *
    *                    (cellViewTable (makeTable 'cellViewTable nil))                    *
    *                                 (includeIgnored nil)                                 *
    *                                          )                                           *
    *                                                                                      *
    * Traverse the hierarchy starting from the cellView given by libName/cellName/viewName *
    *       arguments, either using a switchViewList/stopViewList approach, or using       *
    *         direct views (as for layout, where no view switching is needed). The         *
    *        ?useViewList argument is used to control that. The cellViewTable would        *
    * not get passed when called by a user - this is used inside the function when called  *
    *                                     recursively.                                     *
    *  The result is a hash table with keys which are a lib/cell/view tuple (i.e. a list)  *
    *            with values of t to indicate that that cellView is referenced.            *
    *                                                                                      *
    ***************************************************************************************/
    
    procedure(abPcdbHierarchy(@key libName cellName viewName 
            (switchViewList "spectre cmos_sch cmos.sch schematic veriloga symbol")
            (stopViewList "spectre symbol")
            (useViewList t)
            (cellViewTable (makeTable 'cellViewTable nil))
            (includeIgnored nil)
            "tttg"
            )
        let((pcId master newViewName key descend)
            ;----------------------------------------------------------------
            ; Convert view lists to lists if specified as strings
            ;----------------------------------------------------------------
            when(stringp(switchViewList)
                switchViewList=parseString(switchViewList)
            ) 
            when(stringp(stopViewList)
                stopViewList=parseString(stopViewList)
            )
            ;----------------------------------------------------------------
            ; Open the parent-child database part of the view
            ;----------------------------------------------------------------
            pcId=pcdbOpen(libName cellName viewName "r")
            when(pcId
                ;------------------------------------------------------------
                ; Create an iterator over all the masters within the cellView
                ; and then iterate over them with a while loop. This loops 
                ; over one or two iterators, depending on whether "ignored"
                ; components (e.g. pins, sheets etc) are included
                ; The second arg in the loop is whether view switching should
                ; be potentially used (not for ignored instances)
                ;------------------------------------------------------------
                foreach((masterGen expand) 
                    `(,pcdbGetInstMasterGen(pcId) 
                    ,@(includeIgnored && list(pcdbGetIgnoredInstMasterGen(pcId))))
                    '(t nil)
                    while(master=pcdbNextInstMaster(masterGen)
                        ;----------------------------------------------------
                        ; Collate the lib/cell/view of the instMaster into
                        ; a list that can be used as a key into the association 
                        ; table
                        ;----------------------------------------------------
                        key=list(
                            pcdbInstMasterLib(master)
                            pcdbInstMasterCell(master)
                            pcdbInstMasterView(master)
                        )
                        ;----------------------------------------------------
                        ; Only visit if the cellView has not already been visited
                        ;----------------------------------------------------
                        unless(cellViewTable[key]
                            ;------------------------------------------------
                            ; Figure out the new view name. This depends on whether
                            ; the view list is being used (so for layout, you don't
                            ; switch views). If the viewList is being used, then 
                            ; look for the first view which has pcdb info available.
                            ;------------------------------------------------
                            newViewName=
                                if(useViewList  && expand
                                    ; then
                                    car(exists(switchView switchViewList 
                                        pcdbViewHasPcdbInfo(car(key) cadr(key) switchView)))
                                    ; else
                                    caddr(key)
                                )
                            unless(ddGetObj(car(key) cadr(key) caddr(key))
                                warn("Cannot read master %s/%s/%s referenced within %s/%s/%s\n"
                                    car(key) cadr(key) caddr(key)
                                    libName cellName viewName)
                                unless(useViewList && expand
                                    newViewName=nil
                                )
                            )
                            ;------------------------------------------------
                            ; Determine whether we need to descend into the 
                            ; cellView found
                            ;------------------------------------------------
                            descend=
                                newViewName && !cellViewTable[key] && 
                                !member(newViewName stopViewList)
                            ;------------------------------------------------
                            ; Record that this cellView has been visited
                            ;------------------------------------------------
                            cellViewTable[key]=t
                            when(newViewName
                                ;--------------------------------------------
                                ; Record that the new cellView has been visited
                                ; (even if we don't descend - this is to record
                                ; the switch master too)
                                ;--------------------------------------------
                                cellViewTable[list(car(key) cadr(key) newViewName)]=t
                                ;--------------------------------------------
                                ; And then call recursively
                                ;--------------------------------------------
                                when(descend
                                    abPcdbHierarchy(
                                        ?libName car(key)
                                        ?cellName cadr(key)
                                        ?viewName newViewName
                                        ?switchViewList switchViewList
                                        ?stopViewList stopViewList
                                        ?useViewList useViewList
                                        ?cellViewTable cellViewTable
                                        ?includeIgnored includeIgnored
                                    )
                                ) ; when descend
                            ) ; when newViewName
                        ) ; unless already visited
                    ) ; while next master
                ) ; foreach masterGen
                pcdbClose(pcId)
            ) ; when pcId
            ;----------------------------------------------------------------
            ; Force warnings to be flushed (just in case)
            ;----------------------------------------------------------------
            warn("") getWarn()
            ;----------------------------------------------------------------
            ; Return the hash table produced
            ;----------------------------------------------------------------
            cellViewTable
        ) ; let
    ) ; procedure abPcdbHierarchy
    
    /***************************************************************
    *                                                              *
    *         abPcdbPrintSorted(cellViewTable [fileName])          *
    *                                                              *
    *  Print the results of abPcdbHierarchy in a sorted fashion.   *
    *  Can be written either to the output (e.g. stdout) or to a   *
    *                          named file                          *
    *                                                              *
    ***************************************************************/
    
    procedure(abPcdbPrintSorted(cellViewTable @optional fileName)
        let((keys port)
            ;----------------------------------------------------------------
            ; Write to either the fileName given, or normal output
            ;----------------------------------------------------------------
            port=
                if(stringp(fileName) outfile(fileName) poport)
            unless(port error("Could not write to file %L\n" fileName))
            ;----------------------------------------------------------------
            ; The keys are lists of lib/cell/view
            ;----------------------------------------------------------------
            keys=cellViewTable->?
            ;----------------------------------------------------------------
            ; Sort the keys by lib, then cell, then view
            ;----------------------------------------------------------------
            keys=sort(keys 
                lambda((a b)
                    if(car(a)==car(b) 
                        if(cadr(a)==cadr(b)
                            alphalessp(caddr(a) caddr(b))
                            alphalessp(cadr(a) cadr(b))
                        )
                        alphalessp(car(a) car(b))
                    )
                )
            ) ; sort
            ;----------------------------------------------------------------
            ; Print everything
            ;----------------------------------------------------------------
            foreach(key keys
                fprintf(port "%s %s %s\n" car(key) cadr(key) caddr(key))
            )
            ;----------------------------------------------------------------
            ; Cleanup
            ;----------------------------------------------------------------
            when(stringp(fileName) close(port))
        t
        )
    ) ; procedure abPcdbPrintSorted 
    

     

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Derek,

    Not something I have code for - I've used some of the ccp functions in the past, but not really for the purposes you describe.

    There is an example in this solution on using rename reference library, which might get you started.

    For the second item, you could probably use the ccp functions to expand the hierarchy (or maybe you could use the pcdb functions to efficiently expand the hierarchy, and then create your gdmSpec objects from that to do the rename reference library operations on?). Some code - might be useful:

    /* abPcdbHierarchy.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Nov 05, 2010 
    Modified   A.D.Beckett
    By         Nov 17, 2010 
    
    Using a pcdb based approach (which avoids having to open the entire
    database), traverse the hierarchy to find all the lib/cell/view used
    
    Examples:
    
    ;------------------------------------------------------------------------
    ; Print the sorted results of traversing a layout to a file dump.txt
    ;------------------------------------------------------------------------
    abPcdbPrintSorted(
        abPcdbHierarchy(?libName "ether" ?cellName "top" ?viewName "layout" ?useViewList nil) 
        "./dump.txt"
    )
    
    ;------------------------------------------------------------------------
    ; Print the sorted results of traversing a schematic hierarchy with the 
    ; default switch and stop lists to standard output
    ;------------------------------------------------------------------------
    abPcdbPrintSorted(
        abPcdbHierarchy(?libName "ether" ?cellName "top" ?viewName "schematic")
    )
    
    ;------------------------------------------------------------------------
    ; Use a different switch and stop list and include pins, sheets etc
    ;------------------------------------------------------------------------
    abPcdbPrintSorted(
        abPcdbHierarchy(?libName "ether" ?cellName "top" ?viewName "schematic"
            ?switchViewList "hspiceD schematic symbol" ?stopViewList "hspiceD symbol"
            ?includeIgnored t
        )
    )
    
    ***************************************************
    
    SCCS Info: @(#) abPcdbHierarchy.il 11/17/10.17:25:53 1.3
    
    */
    
    
    /***************************************************************************************
    *                                                                                      *
    *                    abPcdbHierarchy(@key libName cellName viewName                    *
    *        (switchViewList "spectre cmos_sch cmos.sch schematic veriloga symbol")        *
    *                           (stopViewList "spectre symbol")                            *
    *                                   (useViewList t)                                    *
    *                    (cellViewTable (makeTable 'cellViewTable nil))                    *
    *                                 (includeIgnored nil)                                 *
    *                                          )                                           *
    *                                                                                      *
    * Traverse the hierarchy starting from the cellView given by libName/cellName/viewName *
    *       arguments, either using a switchViewList/stopViewList approach, or using       *
    *         direct views (as for layout, where no view switching is needed). The         *
    *        ?useViewList argument is used to control that. The cellViewTable would        *
    * not get passed when called by a user - this is used inside the function when called  *
    *                                     recursively.                                     *
    *  The result is a hash table with keys which are a lib/cell/view tuple (i.e. a list)  *
    *            with values of t to indicate that that cellView is referenced.            *
    *                                                                                      *
    ***************************************************************************************/
    
    procedure(abPcdbHierarchy(@key libName cellName viewName 
            (switchViewList "spectre cmos_sch cmos.sch schematic veriloga symbol")
            (stopViewList "spectre symbol")
            (useViewList t)
            (cellViewTable (makeTable 'cellViewTable nil))
            (includeIgnored nil)
            "tttg"
            )
        let((pcId master newViewName key descend)
            ;----------------------------------------------------------------
            ; Convert view lists to lists if specified as strings
            ;----------------------------------------------------------------
            when(stringp(switchViewList)
                switchViewList=parseString(switchViewList)
            ) 
            when(stringp(stopViewList)
                stopViewList=parseString(stopViewList)
            )
            ;----------------------------------------------------------------
            ; Open the parent-child database part of the view
            ;----------------------------------------------------------------
            pcId=pcdbOpen(libName cellName viewName "r")
            when(pcId
                ;------------------------------------------------------------
                ; Create an iterator over all the masters within the cellView
                ; and then iterate over them with a while loop. This loops 
                ; over one or two iterators, depending on whether "ignored"
                ; components (e.g. pins, sheets etc) are included
                ; The second arg in the loop is whether view switching should
                ; be potentially used (not for ignored instances)
                ;------------------------------------------------------------
                foreach((masterGen expand) 
                    `(,pcdbGetInstMasterGen(pcId) 
                    ,@(includeIgnored && list(pcdbGetIgnoredInstMasterGen(pcId))))
                    '(t nil)
                    while(master=pcdbNextInstMaster(masterGen)
                        ;----------------------------------------------------
                        ; Collate the lib/cell/view of the instMaster into
                        ; a list that can be used as a key into the association 
                        ; table
                        ;----------------------------------------------------
                        key=list(
                            pcdbInstMasterLib(master)
                            pcdbInstMasterCell(master)
                            pcdbInstMasterView(master)
                        )
                        ;----------------------------------------------------
                        ; Only visit if the cellView has not already been visited
                        ;----------------------------------------------------
                        unless(cellViewTable[key]
                            ;------------------------------------------------
                            ; Figure out the new view name. This depends on whether
                            ; the view list is being used (so for layout, you don't
                            ; switch views). If the viewList is being used, then 
                            ; look for the first view which has pcdb info available.
                            ;------------------------------------------------
                            newViewName=
                                if(useViewList  && expand
                                    ; then
                                    car(exists(switchView switchViewList 
                                        pcdbViewHasPcdbInfo(car(key) cadr(key) switchView)))
                                    ; else
                                    caddr(key)
                                )
                            unless(ddGetObj(car(key) cadr(key) caddr(key))
                                warn("Cannot read master %s/%s/%s referenced within %s/%s/%s\n"
                                    car(key) cadr(key) caddr(key)
                                    libName cellName viewName)
                                unless(useViewList && expand
                                    newViewName=nil
                                )
                            )
                            ;------------------------------------------------
                            ; Determine whether we need to descend into the 
                            ; cellView found
                            ;------------------------------------------------
                            descend=
                                newViewName && !cellViewTable[key] && 
                                !member(newViewName stopViewList)
                            ;------------------------------------------------
                            ; Record that this cellView has been visited
                            ;------------------------------------------------
                            cellViewTable[key]=t
                            when(newViewName
                                ;--------------------------------------------
                                ; Record that the new cellView has been visited
                                ; (even if we don't descend - this is to record
                                ; the switch master too)
                                ;--------------------------------------------
                                cellViewTable[list(car(key) cadr(key) newViewName)]=t
                                ;--------------------------------------------
                                ; And then call recursively
                                ;--------------------------------------------
                                when(descend
                                    abPcdbHierarchy(
                                        ?libName car(key)
                                        ?cellName cadr(key)
                                        ?viewName newViewName
                                        ?switchViewList switchViewList
                                        ?stopViewList stopViewList
                                        ?useViewList useViewList
                                        ?cellViewTable cellViewTable
                                        ?includeIgnored includeIgnored
                                    )
                                ) ; when descend
                            ) ; when newViewName
                        ) ; unless already visited
                    ) ; while next master
                ) ; foreach masterGen
                pcdbClose(pcId)
            ) ; when pcId
            ;----------------------------------------------------------------
            ; Force warnings to be flushed (just in case)
            ;----------------------------------------------------------------
            warn("") getWarn()
            ;----------------------------------------------------------------
            ; Return the hash table produced
            ;----------------------------------------------------------------
            cellViewTable
        ) ; let
    ) ; procedure abPcdbHierarchy
    
    /***************************************************************
    *                                                              *
    *         abPcdbPrintSorted(cellViewTable [fileName])          *
    *                                                              *
    *  Print the results of abPcdbHierarchy in a sorted fashion.   *
    *  Can be written either to the output (e.g. stdout) or to a   *
    *                          named file                          *
    *                                                              *
    ***************************************************************/
    
    procedure(abPcdbPrintSorted(cellViewTable @optional fileName)
        let((keys port)
            ;----------------------------------------------------------------
            ; Write to either the fileName given, or normal output
            ;----------------------------------------------------------------
            port=
                if(stringp(fileName) outfile(fileName) poport)
            unless(port error("Could not write to file %L\n" fileName))
            ;----------------------------------------------------------------
            ; The keys are lists of lib/cell/view
            ;----------------------------------------------------------------
            keys=cellViewTable->?
            ;----------------------------------------------------------------
            ; Sort the keys by lib, then cell, then view
            ;----------------------------------------------------------------
            keys=sort(keys 
                lambda((a b)
                    if(car(a)==car(b) 
                        if(cadr(a)==cadr(b)
                            alphalessp(caddr(a) caddr(b))
                            alphalessp(cadr(a) cadr(b))
                        )
                        alphalessp(car(a) car(b))
                    )
                )
            ) ; sort
            ;----------------------------------------------------------------
            ; Print everything
            ;----------------------------------------------------------------
            foreach(key keys
                fprintf(port "%s %s %s\n" car(key) cadr(key) caddr(key))
            )
            ;----------------------------------------------------------------
            ; Cleanup
            ;----------------------------------------------------------------
            when(stringp(fileName) close(port))
        t
        )
    ) ; procedure abPcdbPrintSorted 
    

     

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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