• 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 copy and rotate a shape with special angle like 30...

Stats

  • Locked Locked
  • Replies 12
  • Subscribers 144
  • Views 24954
  • 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 copy and rotate a shape with special angle like 30 degree in skill coding?

richardyuan
richardyuan over 11 years ago

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. 

  • Cancel
  • psill000
    psill000 over 11 years ago

     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.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • richardyuan
    richardyuan over 11 years ago
    I know the "l_transform" only support rotation angle of R0,R90,R270... But what about angle of 30, 45, and any other angles?
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • richardyuan
    richardyuan over 11 years ago
    Nobody give me some hints?
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    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.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ztzg
    ztzg over 11 years ago

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

    • http://dd.crosstwine.com/git/?p=veda/misc/geom-affine.git

    • http://dd.crosstwine.com/git?p=veda/misc/geom-affine.git;a=snapshot;h=HEAD;sf=tgz

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

    Cheers, -D

    • Bildschirmfoto_vom.png
    • View
    • Hide
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • richardyuan
    richardyuan over 11 years ago

    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.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • richardyuan
    richardyuan over 11 years ago

    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. 

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • richardyuan
    richardyuan over 11 years ago
    Here is the result when I use dbTransFormCellView to copy and rotate a shape 19 times with equal interval.
    • cadence schematic.jpg
    • View
    • Hide
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    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.

    • cartwheel.png
    • View
    • Hide
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • richardyuan
    richardyuan over 11 years ago
    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

    • rotate.jpg
    • View
    • Hide
    • 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