Home > Community > Forums > Custom IC SKILL > How to copy and rotate a shape with special angle like 30 degree in skill coding?

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

 How to copy and rotate a shape with special angle like 30 degree in skill coding? 

Last post Tue, Jan 14 2014 5:39 PM by richardyuan. 12 replies.
Started by richardyuan 02 Dec 2013 06:46 AM. Topic has 12 replies and 4964 views
Page 1 of 1 (13 items)
Sort Posts:
  • Mon, Dec 2 2013 6:46 AM

    • richardyuan
    • Top 500 Contributor
    • Joined on Mon, Nov 25 2013
    • Shanghai, Shanghai
    • Posts 20
    • Points 310
    How to copy and rotate a shape with special angle like 30 degree in skill coding? Reply

    Hello, 

    I failed to search the manual and the forum to find a way to copy and rotate a shape I created with any agle like 15, 30, 45 etc.

    I noticed some posts said that rotate with any angle may raise lithography issues. But in MEMS application, it's very popular to use all kinds of "strange" shapes. As the line/space is over 1um, the litho problem can be neglected. Then, what can I do in skill code?

     Thanks. 

    • Post Points: 35
  • Tue, Dec 3 2013 7:46 AM

    • psill000
    • Top 500 Contributor
    • Joined on Sat, Jun 1 2013
    • Posts 31
    • Points 605
    Re: How to copy and rotate a shape with any angle in skill ? Reply

     Not sure of your application but have you tried

    dbCopyFig(
    d_fig
    d_cellView
    [ l_transform ]
     )

    Use the transform option to rotate the object. '((0 0) "R90" 1.0) would rotate the object 90 degrees.

    • Post Points: 20
  • Tue, Dec 3 2013 4:52 PM

    • richardyuan
    • Top 500 Contributor
    • Joined on Mon, Nov 25 2013
    • Shanghai, Shanghai
    • Posts 20
    • Points 310
    Re: How to copy and rotate a shape with any angle in skill ? Reply
    I know the "l_transform" only support rotation angle of R0,R90,R270... But what about angle of 30, 45, and any other angles?
    • Post Points: 5
  • Thu, Dec 5 2013 5:38 PM

    • richardyuan
    • Top 500 Contributor
    • Joined on Mon, Nov 25 2013
    • Shanghai, Shanghai
    • Posts 20
    • Points 310
    Re: How to copy and rotate a shape with any angle in skill ? Reply
    Nobody give me some hints?
    • Post Points: 20
  • Fri, Dec 6 2013 2:07 AM

    Re: How to copy and rotate a shape with any angle in skill ? Reply

    Hi Richard,

    There's dbTransformCellView which will transform everything in a cellView by the specified magnification and angle. Note that this cannot transform objects which are constrained to only be at 90 degree multiples (such as instances), so you should normally do this on flat layout.

    So if you want to transform selected shapes, what you could do is write a function which moves them (using dbMoveFig) to a temporary cellView, does a dbTransformCellView() and then moves them back to the original cellView.

    This is probably easier than trying to write your own  code to transform every kind of shape by arbitrary angles. There's leHiRotate, but this is an "hi" function and doesn't have a procedural equivalent.

    Regards,

    Andrew.

    • Post Points: 20
  • Fri, Dec 6 2013 4:35 AM

    • ztzg
    • Not Ranked
    • Joined on Fri, Dec 31 2010
    • München, Bavaria
    • Posts 15
    • Points 225
    Re: How to copy and rotate a shape with special angle like 30 degree in skill coding? Reply

    Hi Richard, Andrew,

    Ha; I did not know dbTransformCellView could do that! Andrew is right, of course; that is indeed the easiest solution—provided that function is available in your version of Virtuoso.

    I had started writing a small solution; I’ll append it here in case it helps. It basically implements arbitrary affine transformations on points, plus a small dbCopyFig-like helper function:

    matrix = VedaGeomAffineMakeIdentity()
    matrix = VedaGeomAffineScale(matrix 2.0 0.5)
    matrix = VedaGeomAffineRotate(matrix 30*degrees)
    
    VedaGeomAffineCopyFig(fig cv matrix)

    I’ve included a tiny demo in the source tree; it draws some shapes on the y* layers of a given cell view:

    load("path/to/geom-affine.ils")
    load("path/to/demo/demo.ils")
    VedaGeomAffineDemo(geGetEditCellView())

    You can find the code (full of TODOs) here (Git repository, snapshot):

    The license is MIT/Expat. Let me know if you need more info… or have some patches :)

    Cheers, -D


    http://www.crosstwine.com tel: +49 89 2189 2939 cell: +49 174 3489 428
    • Post Points: 20
  • Tue, Dec 24 2013 6:26 AM

    • richardyuan
    • Top 500 Contributor
    • Joined on Mon, Nov 25 2013
    • Shanghai, Shanghai
    • Posts 20
    • Points 310
    Re: How to copy and rotate a shape with special angle like 30 degree in skill coding? Reply

    ztzg, 

    Thank you for your help. As a beginner and not dedicate to layout, it seems hard for me to ultilize your code.

    I'll try it when I have time.

    • Post Points: 5
  • Tue, Dec 24 2013 6:52 AM

    • richardyuan
    • Top 500 Contributor
    • Joined on Mon, Nov 25 2013
    • Shanghai, Shanghai
    • Posts 20
    • Points 310
    Re: How to copy and rotate a shape with any angle in skill ? Reply

    Hi Andrew,

     I tried your solution. It seems have precision issues.

    When the rotation angle can divide 360 exactly, like 20,30,60 etc., It looks great.

    But when I try to place 19 semilar shapes  along a circular edge with same interval, it doesn't work well. 

     

    • Post Points: 5
  • Tue, Dec 24 2013 7:00 AM

    • richardyuan
    • Top 500 Contributor
    • Joined on Mon, Nov 25 2013
    • Shanghai, Shanghai
    • Posts 20
    • Points 310
    Re: How to copy and rotate a shape with any angle in skill ? Reply
    Here is the result when I use dbTransFormCellView to copy and rotate a shape 19 times with equal interval.
    • Post Points: 20
  • Fri, Dec 27 2013 1:20 AM

    Re: How to copy and rotate a shape with any angle in skill ? Reply

    I'm guessing that you're rotating each shape incrementally, which would mean you accumulate rounding errors. You didn't share your code, so that's purely a guess.

    I wrote the following:

    procedure(CCFcreateRotatedShape(cv layerName angle inner outer width)
        let((tempCv)
            tempCv=dbOpenCellViewByType(cv~>libName cv~>cellName "scratch" "maskLayout" "w")
            dbCreateRect(tempCv layerName list(inner:-width/2.0 outer:width/2.0))
            dbTransformCellView(tempCv 1.0 angle)
            foreach(shape tempCv~>shapes
                dbCopyFig(shape cv list(0:0 "R0" 1))
            )
            dbClose(tempCv)
            t
        )
    )

    procedure(CCFrotateExample(@key (cv geGetEditCellView()) (spines 20) (inner 25) (outer 45) (width 4)
                (layer1 "Metal3") (layer2 "Metal2"))
        let((radius)
            radius=(inner+outer)/2.0
            dbCreateEllipse(cv layer1 list(-radius:-radius radius:radius))
            for(i 0 sub1(spines)
                CCFcreateRotatedShape(cv layer2 i*360.0/spines inner outer width)
            )
        )
    )

    And then ran (using gpdk090):

    CCFrotateExample(?spines 19 ?layer1 "Via2" ?layer2 "Via5")

    (purely to get some pretty colours). As you can see, this looks pretty evenly spaced and the shapes look regular:

    The setup has 2000 DBUPerUU so has a good level of resolution - I don't know what your database resolution is compared with the size of your structure.

    Regards,

    Andrew.


    • Post Points: 20
  • Sun, Jan 5 2014 10:05 PM

    • richardyuan
    • Top 500 Contributor
    • Joined on Mon, Nov 25 2013
    • Shanghai, Shanghai
    • Posts 20
    • Points 310
    Re: How to copy and rotate a shape with any angle in skill ? Reply
    Hi  Andrew,
     
    I used the code below to make my pCell. I don't know why it doesn't work well for some special division of 360 degree.
     
     
    pcDefinePCell(list(ddGetObj("TTA") "ycRotate" "layout") 
        (   (p2_r1 float 300.0)    
    (p2_gapl float 280.0)
    (p2_gapa float 70.0)
    (p2_gapb float 25.0)

    (SETS int 20)

        ) 
        let((i x0 div_angle p2_base p2_rect p2_gap yctView
    pcInst  pcParameters pcParamProp pcLayer pcPurpose 
    ) ;local parameters 

    (pcLib = (pcCellView~>lib)) 

    ;Retrieve pCell parameters
    (pcParameters = ((pcCellView~>parameters)~>value)) 
    (pcPurpose = "drawing") 
    div_angle = 360/SETS

    (p2_base = dbCreateEllipse(pcCellView 
    list(4 pcPurpose) 
    list(((-p2_r1):(-p2_r1)) (p2_r1:p2_r1))
       )) 

    (p2_rect = dbCreateRect(pcCellView 
    list(64 pcPurpose) 
    list((p2_gapl:(-p2_gapb)) ((p2_gapl + 2*p2_gapa):p2_gapb))
       ))  
    yctView = dbOpenCellViewByType("Mic" "YCTemp" "layout" "maskLayout" "s")
    p2_gap = dbCopyFig(p2_rect yctView)

    for(i 2 SETS
    dbTransformCellView(yctView 1 div_angle)
    dbCopyFig(p2_gap pcCellView)
    ); for i
    dbClose(yctView)
        ); let
             
    ); Pcell define


    • Post Points: 20
  • Sun, Jan 5 2014 11:01 PM

    Re: How to copy and rotate a shape with any angle in skill ? Reply

    Your code has two sources of rounding errors.

    The first is that you compute the angle as 360/SETS. Since SETS is an integer, and 360 is a literal integer, this is an integer division. So if SETS is 19, this ends up with an angle of 18 rather than 18.94. If you change the expression to 360.0/SETS then this will eliminate this source of rounding error.

    The second (much smaller) source is that each time it does a transform cellview, copies the figure and then transforms again. At each transform there will be a small rounding error of each point in the transformed shape to snap it to the database units used because of the resolution of the database. Because you are doing a series of transformations, each starting from the result of the previous transformation, these small errors will accumulate. They may be small enough that you can ignore, but the approach I showed was to transform from the original shape each time and vary the angle each time (so the first rotates by angle, second by 2*angle and so on) and so the small rounding errors would not accumulate.

    Kind Regards,

    Andrew 

    • Post Points: 20
  • Tue, Jan 14 2014 5:39 PM

    • richardyuan
    • Top 500 Contributor
    • Joined on Mon, Nov 25 2013
    • Shanghai, Shanghai
    • Posts 20
    • Points 310
    Re: How to copy and rotate a shape with any angle in skill ? Reply

    Oh, what a stupid mistake I've made. Integer divided by integer gets an integer, the skill rule...

    That really helps. Thank you andrew.

    Regards,

    Richard 

    • Post Points: 5
Page 1 of 1 (13 items)
Sort Posts:
Started by richardyuan at 02 Dec 2013 06:46 AM. Topic has 12 replies.