• 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 22488
  • 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
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    It's not clear to me what you really want here - maybe you want the "make cell" or "flatten cell" capability?

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • shayansh
    shayansh over 13 years ago

     Hi Andrew,

    Thank you for your reply. Maybe i can give a scenerio to help clarify what i am referring to. 

    I place an instance in layout and connect some modules together. I use the Edit in place command to draw some additional paths in the lower level instance. I was wondering then is there a way to just bring what is drawn through the hiearchy to the higher level. So basically "cutting" the new drawn path and moving it to the higher level in hiearchy? I would mainly be interested in this for extraction and considering the loading of different nodes. 

     Thanks,

    Shayan

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

    There are many factors that come into play when you want to do this type of operation.

    1. Are you moving shapes from a lower level to the top level, or to some intermediate level of hierarchy?
    2. Is the shape you are moving  placed in an instanced that has multiple placements? If so, this is a more complicated algorithm because you need to make multiple copies of the shape and know all of the locations where it should be placed.
    3. Do you use mosaics in your layout? This complicates the process since getting the transformation information is more complicated.

    Here is some basic code to allow you to move a shape up the hierarchy. It doesn't handle mosaics and only moves the objects for one placement of an instance. In the code below, I used dbCopyFig to copy the data instead of dbMoveFig. This will let you see what is going on without being destructive to the source cellview. If you change it to do a move, you'll need to save the source cellview. I already have the code making the source cellview editable.

    To use this, load the code in your CIW. Edit in place down the hierarchy to your lower level cell. Select the shapes you want to move. Press the ctrl-b bindkey. Choose the level you want to return to. You should have a copy of those shapes at the new level.

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


    procedure(myMoveItemsHierarchically(data)
      let((newLevel destCv transList transform)
        newLevel = deGetEditLevel(data->win)
        destCv = geGetEditCellView()
        if(newLevel==0
            transList=data->transList
            transList=reverse(nthcdr(newLevel reverse(data->transList)))
        )
        transform = myConcatTransforms(transList)
        dbReopen(data->sourceCv "a")
        dbReopen(destCv "a")
        foreach(item data->items
            ;use dbMoveFig to move the items
            dbCopyFig(item destCv transform)
        )
        ;dbSave(data->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
        )
    )

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

    Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • shayansh
    shayansh over 13 years ago

    Wow Derek, that is Fantastic, Thank you. It did EXACLY what i wanted. One other thing i am wondering about, Is it possible to also make it be able to push something i have selected down in hiearchy? When i use your shortcut, it gives me the layers, but only lists the ones in above hiearchy. I can imagine it would be more complicated to go the other way, so im just wondering if that is possible?

     

    Thanks again!

    Shayan

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • 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
  • shayansh
    shayansh over 13 years ago

     Hi Derek,

     This is absolutely amazing. It does exactly what i want now. I talked to some of my friends and we feel this a noble prize worthy contribution!

     Thanks a lot,

    Shayan

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

    Shayan,

    Glad you like it. We've been doing this for years. I just had to extract the relevant parts from our code and simplify it a little bit for the forum.

    Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • SkVlsi
    SkVlsi over 12 years ago

    HI Derek,

    I have used this scripts, it works very well for moving/copying Hierarchy upwards. However i have notice that if i want to move any instance or pcell down, i get an errror "cannot edit pcell" something like that, can you please check it .

     Thanks 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dmay
    dmay over 12 years ago

    This is actually pretty easy to solve. The leHiEditInPlace command wants to work on the selected instance, so you need to deselect the instance in the myGetItemsToMove command and then it should work:

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

    Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • SkVlsi
    SkVlsi over 12 years ago

    Hi derek,

    Thanks, now it is working perfectly.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
>

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