Home > Community > Forums > Custom IC SKILL > Moving Layers Through Hierarchy

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: *

 Moving Layers Through Hierarchy 

Last post Tue, Jun 3 2014 3:55 PM by tweeks. 12 replies.
Started by shayansh 17 Apr 2012 01:29 PM. Topic has 12 replies and 4710 views
Page 1 of 1 (13 items)
Sort Posts:
  • Tue, Apr 17 2012 1:29 PM

    • shayansh
    • Top 500 Contributor
    • Joined on Fri, Apr 2 2010
    • Posts 17
    • Points 325
    Moving Layers Through Hierarchy Reply

     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

    • Post Points: 20
  • Sat, Apr 21 2012 8:52 AM

    Re: Moving Layers Through Hierarchy Reply

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

    Andrew.

    • Post Points: 20
  • Mon, Apr 23 2012 8:12 AM

    • shayansh
    • Top 500 Contributor
    • Joined on Fri, Apr 2 2010
    • Posts 17
    • Points 325
    Re: Moving Layers Through Hierarchy Reply

     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

    • Post Points: 20
  • Tue, Apr 24 2012 7:33 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 393
    • Points 7,415
    Re: Moving Layers Through Hierarchy Reply

    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

    • Post Points: 20
  • Tue, Apr 24 2012 3:54 PM

    • shayansh
    • Top 500 Contributor
    • Joined on Fri, Apr 2 2010
    • Posts 17
    • Points 325
    Re: Moving Layers Through Hierarchy Reply

    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

    • Post Points: 20
  • Wed, Apr 25 2012 7:52 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 393
    • Points 7,415
    Re: Moving Layers Through Hierarchy Reply

    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))")

    • Post Points: 20
  • Wed, Apr 25 2012 8:19 AM

    • shayansh
    • Top 500 Contributor
    • Joined on Fri, Apr 2 2010
    • Posts 17
    • Points 325
    Re: Moving Layers Through Hierarchy Reply

     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

    • Post Points: 20
  • Wed, Apr 25 2012 9:22 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 393
    • Points 7,415
    Re: Moving Layers Through Hierarchy Reply

    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

    • Post Points: 20
  • Mon, Sep 17 2012 8:21 PM

    • SkVlsi
    • Not Ranked
    • Joined on Fri, Sep 14 2012
    • Posts 8
    • Points 145
    Re: Moving Layers Through Hierarchy Reply

    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 

    • Post Points: 20
  • Tue, Sep 18 2012 6:54 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 393
    • Points 7,415
    Re: Moving Layers Through Hierarchy Reply

    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

    • Post Points: 20
  • Wed, Sep 19 2012 10:02 AM

    • SkVlsi
    • Not Ranked
    • Joined on Fri, Sep 14 2012
    • Posts 8
    • Points 145
    Re: Moving Layers Through Hierarchy Reply

    Hi derek,

    Thanks, now it is working perfectly.

     

    • Post Points: 20
  • Tue, Jun 3 2014 2:30 PM

    • shayansh
    • Top 500 Contributor
    • Joined on Fri, Apr 2 2010
    • Posts 17
    • Points 325
    Re: Moving Layers Through Hierarchy Reply

    Hi Derek,

    There is one other thing i wanted to ask about the code. When i use it to copy and bring up Pin names, it copies the square for the pin, but the label is missing. It basically isn't bringing up the text for the pinname. I was wondering if it is something that is easy to fix or if it would take a lot more effort?

     Thanks,

    Shayan

    • Post Points: 20
  • Tue, Jun 3 2014 3:55 PM

    • tweeks
    • Top 50 Contributor
    • Joined on Fri, Jun 3 2011
    • Irvine, CA
    • Posts 122
    • Points 1,855
    Re: Moving Layers Through Hierarchy Reply

    The label is (usually) on car(pin->fig->children).

    Just apply the same logic to copy and transform it, too.

     

    Also: this thread is old.  Andrew will scold you for not starting a new one instead. 

    • Post Points: 5
Page 1 of 1 (13 items)
Sort Posts:
Started by shayansh at 17 Apr 2012 01:29 PM. Topic has 12 replies.