• 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. Moving Layers Through Hierarchy

Stats

  • Locked Locked
  • Replies 12
  • Subscribers 145
  • Views 22490
  • 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

Moving Layers Through Hierarchy

shayansh
shayansh over 13 years ago

 Hi,

I am looking for a way to move some components through hiearchy in layout. For example, i have drawn some metal 1 path in the first level of hiearchy, and would like to 'pop' it out to the second level of hiearchy. Is there any default feature in Cadence that does this? If someone could kindly guide me to setting this up i would appreciate it. Basically i want something close to the YANK command, but CUT instead of copy. 

I am using Cadence: Virtuoso: 6.1.4

 

Thanks,

Shayan

  • Cancel
Parents
  • dmay
    dmay over 13 years ago

    Here is code to do that. You'll want to replace all the code I sent you earlier since I tweaked several of the functions to handle it. This time, use ctrl-e to copy the shapes down.

    Derek

    procedure(myGetItemsToMove(@optional (win hiGetCurrentWindow()))
      let((transList items sourceCv level)
        transList =  reverse(mapcar('lambda((x) car(x)~>transform) geGetHierMemInst(win)))
        items = geGetSelSet()
        level = deGetEditLevel(win)
        sourceCv = geGetEditCellView()
        list(nil 'transList transList 'items items 'sourceCv sourceCv 'win win 'level level)
      ) ;let
    ) ;proc


    procedure(myMoveItemsHierarchically(data)
      let((newLevel destCv transList transform dir)
        newLevel = deGetEditLevel(data->win)
        if(newLevel > data->level
            dir="down"
            dir="up"
        )
        destCv = geGetEditCellView()
        cond(
            (newLevel==0
                transList = data->transList
            )
            (dir=="up"
                transList = reverse(nthcdr(newLevel reverse(data->transList)))
            )
            (dir=="down"
                transList = reverse(mapcar('lambda((x) car(x)~>transform) geGetHierMemInst(data->win)))
                transList = reverse(nthcdr(data->level reverse(transList)))
            )
        )
        transform = myConcatTransforms(transList)
        when(dir=="down"
            transform=myReverseTransform(transform)
        )
        dbReopen(data->sourceCv "a")
        foreach(item data->items
            ;use dbMoveFig to move the items
            dbCopyFig(item destCv transform)
        )
        ;dbSave(sourceCv)
      ) ;let
    ) ;proc

    procedure(myConcatTransforms(transList)
        let((newTrans trans)
            newTrans=list('(0.0 0.0) "R0" 1.0)
            ;transList is in order from bottom of hierarchy to top
            foreach(trans transList
                newTrans=dbConcatTransform(newTrans trans)
            )
            newTrans
        )
    )

    procedure(myReverseTransform(trans)
        let((pt rot mag newPt)
            pt=car(trans)
            rot=cadr(trans)
            mag=caddr(trans)
            ;Think of the logic in this manner:  given that an instance is
            ;rotated, translated and magnified in the top level, what do you
            ;need to do to get it back to normal orientation.  If it is R90
            ;at the top, you need to R270 to get back.
            case(rot
                ("R0"    newPt=list(xCoord(pt)*-1.0 yCoord(pt)*-1.0) rot="R0"  )
                ("R90"   newPt=list(yCoord(pt)*-1.0 xCoord(pt))      rot="R270")
                ("R180"  newPt=list(xCoord(pt)      yCoord(pt))      rot="R180")
                ("R270"  newPt=list(yCoord(pt)      xCoord(pt)*-1.0) rot="R90" )
                ("MX"    newPt=list(xCoord(pt)*-1.0 yCoord(pt))      rot="MX")
                ("MY"    newPt=list(xCoord(pt)      yCoord(pt)*-1.0) rot="MY")
                ("MXR90" newPt=list(yCoord(pt)*-1.0 xCoord(pt)*-1.0) rot="MXR90")
                ("MYR90" newPt=list(yCoord(pt)      xCoord(pt))      rot="MYR90")
                (t newPt=pt)
            )
            list(newPt rot mag)
        )
    )

    hiSetBindKey("Layout" "Ctrl<Key>b" "let((data) data=myGetItemsToMove() geReturnToLevel() myMoveItemsHierarchically(data))")
    hiSetBindKey("Layout" "Ctrl<Key>e" "let((data) data=myGetItemsToMove() leHiEditInPlace() myMoveItemsHierarchically(data))")

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • dmay
    dmay over 13 years ago

    Here is code to do that. You'll want to replace all the code I sent you earlier since I tweaked several of the functions to handle it. This time, use ctrl-e to copy the shapes down.

    Derek

    procedure(myGetItemsToMove(@optional (win hiGetCurrentWindow()))
      let((transList items sourceCv level)
        transList =  reverse(mapcar('lambda((x) car(x)~>transform) geGetHierMemInst(win)))
        items = geGetSelSet()
        level = deGetEditLevel(win)
        sourceCv = geGetEditCellView()
        list(nil 'transList transList 'items items 'sourceCv sourceCv 'win win 'level level)
      ) ;let
    ) ;proc


    procedure(myMoveItemsHierarchically(data)
      let((newLevel destCv transList transform dir)
        newLevel = deGetEditLevel(data->win)
        if(newLevel > data->level
            dir="down"
            dir="up"
        )
        destCv = geGetEditCellView()
        cond(
            (newLevel==0
                transList = data->transList
            )
            (dir=="up"
                transList = reverse(nthcdr(newLevel reverse(data->transList)))
            )
            (dir=="down"
                transList = reverse(mapcar('lambda((x) car(x)~>transform) geGetHierMemInst(data->win)))
                transList = reverse(nthcdr(data->level reverse(transList)))
            )
        )
        transform = myConcatTransforms(transList)
        when(dir=="down"
            transform=myReverseTransform(transform)
        )
        dbReopen(data->sourceCv "a")
        foreach(item data->items
            ;use dbMoveFig to move the items
            dbCopyFig(item destCv transform)
        )
        ;dbSave(sourceCv)
      ) ;let
    ) ;proc

    procedure(myConcatTransforms(transList)
        let((newTrans trans)
            newTrans=list('(0.0 0.0) "R0" 1.0)
            ;transList is in order from bottom of hierarchy to top
            foreach(trans transList
                newTrans=dbConcatTransform(newTrans trans)
            )
            newTrans
        )
    )

    procedure(myReverseTransform(trans)
        let((pt rot mag newPt)
            pt=car(trans)
            rot=cadr(trans)
            mag=caddr(trans)
            ;Think of the logic in this manner:  given that an instance is
            ;rotated, translated and magnified in the top level, what do you
            ;need to do to get it back to normal orientation.  If it is R90
            ;at the top, you need to R270 to get back.
            case(rot
                ("R0"    newPt=list(xCoord(pt)*-1.0 yCoord(pt)*-1.0) rot="R0"  )
                ("R90"   newPt=list(yCoord(pt)*-1.0 xCoord(pt))      rot="R270")
                ("R180"  newPt=list(xCoord(pt)      yCoord(pt))      rot="R180")
                ("R270"  newPt=list(yCoord(pt)      xCoord(pt)*-1.0) rot="R90" )
                ("MX"    newPt=list(xCoord(pt)*-1.0 yCoord(pt))      rot="MX")
                ("MY"    newPt=list(xCoord(pt)      yCoord(pt)*-1.0) rot="MY")
                ("MXR90" newPt=list(yCoord(pt)*-1.0 xCoord(pt)*-1.0) rot="MXR90")
                ("MYR90" newPt=list(yCoord(pt)      xCoord(pt))      rot="MYR90")
                (t newPt=pt)
            )
            list(newPt rot mag)
        )
    )

    hiSetBindKey("Layout" "Ctrl<Key>b" "let((data) data=myGetItemsToMove() geReturnToLevel() myMoveItemsHierarchically(data))")
    hiSetBindKey("Layout" "Ctrl<Key>e" "let((data) data=myGetItemsToMove() leHiEditInPlace() myMoveItemsHierarchically(data))")

    • 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