• 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. Finding of polygons SKILL.

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 142
  • Views 10120
  • 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

Finding of polygons SKILL.

Serjik
Serjik over 8 years ago

Hello.

I've got a layout with containce polygons of certan layer, i need to find the coordinats of that polygons (center) and put them in to file.

Here is the cod, but the outpu file is empty.

myPort = outfile( "~/Desktop/pllist" )
foreach(polygon geGetEditCellView()~>polygons
if(polygon~>fig~>lpp=="metal1" then
fprintf(myPort "\t%L\n" centerBox(polygon~>shapes~>bBox(points)))
)
)
close( myPort)
sh( "gedit ~/Desktop/pllist &" )

Can you help me ?

Regards,

Sergey.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    This won't work for numerous reasons:

    1. There is no attribute called polygons on a cellView so geGetEditCellView()~>polygons will return nil
    2. Even if you'd managed to find an object for a polygon, it presumably would be a polygon object, so polygon~>fig would return nil
    3. The lpp attribute on a shape object is a list (e.g. ("metal1" "drawing")) so your comparison for metal1 would never be true
    4. A single polygon wouldn't have a shapes attribute, so that's not going to work either.
    5. The bBox attribute isn't a function so doesn't take an argument of points.

    If you really only want the polygons, you'd use:

    foreach(shape geGetEditCellView()~>shapes
      when(shape~>objType=="polygon"
        when(shape~>layerName=="metal1"
          fprintf(myPort "\t%L\n" centerBox(shape~>bBox))
        )
      )
    )

    Something like that.

    Regards,

    Andrew.

          

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Serjik
    Serjik over 8 years ago
    Thenk you Andrew.
    It works fine.
    And if i want to travel by hierarchy, how can i do it.
    Where can i read some info about shapes ?

    Regards,
    Sergey
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    Hi Sergey,

    There are numerous examples on this forum of how to traverse hierarchy in SKILL. I'd give a simple example, but it's not clear what you want here - if you need the coordinate of the centre point to be relative to the top level cellView, or relative to the cellView that the polygon is in.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Serjik
    Serjik over 8 years ago

    You are right, i need the coordinats of the centre point to be relative to the top level of cellView, can you pleas help me with that ?

    Regards,
    Sergey

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Serjik
    Serjik over 8 years ago

    I have solved the problem, but in the other way. First of all i flat all cell by hierarchy, and then use your cod to find out the center. But on a big layout with a hierarchy level near 7 including pcells it doesnt work. After runing my script the ciw window does not respond. On the small layouts it works perfect. Can you help to find the solution ?

    Here is my cod:
    procedure( Myflat(libName cellName )
    let( (cv topInstList )
    if( ddGetObj( libName cellName "layout" ) then
    cv = dbOpenCellViewByType( libName cellName "layout" "maskLayout" "a")
    )
    topInstList = cv~>instances
    ;get a list of all instances in the cellview
    foreach(inst topInstList
    if(inst~>mosaic then
    leFlattenInst( inst~>mosaic 31 t nil nil )
    ;flatten the mosaic instance
    );if
    leFlattenInst( inst 31 t nil nil )
    );foreach
    );let
    );procedure

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    You don't want to flatten the design, because that will create a huge cellView with lots of objects and will be slow and consume lots of memory. As I said, you want to recursively visit the instances throughout the hierarchy, and collect their transformations.

    Apologies for not replying to your earlier reply - there's a bug in the forums which affects some mail clients which means that sometimes you only see one of the responses not all of them (it should get fixed at some point, I hope, when we move to a newer version).

    Here's some code (not particularly thoroughly tested) which I think does what you want. The complicated part is dealing with mosaics (arrays) if you have any):

    /* CCFoutputPolygonCentres.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Jan 18, 2017 
    Modified   
    By         
    
    This code traverses the hierarchy, collecting the transformations
    as it goes, and outputs the centre point of any matching object
    (you can search given the objType and/or layerName). If either are
    set to be nil, then it matches all objects or all layers.
    
    e.g.
    
    port=outfile("./report.txt")
    cv=geGetEditCellView()
    
    ; outputs all polygons on metal1
    CCFoutputPolygonCentres(cv port)
    ; outputs all shapes on metal1
    CCFoutputPolygonCentres(cv port ?objType nil)
    ; outputs all rectangles on metal2
    CCFoutputPolygonCentres(cv port ?objType "rect" ?layerName "metal2") 
    
    close(port)
    
    Handles mosaics (for OA releases only - decided not to include the
    code to cope with IC5141 mosaics which were represented differently
    in the database).
    
    ***************************************************
    
    SCCS Info: @(#) CCFoutputPolygonCentres.il 01/18/17.11:31:39 1.1
    
    */
    
    
    /***********************************************************************
    *                                                                      *
    *       CCFoutputPolygonCentres(cvId myPort [?objType "polygon"]       *
    *          [?layerName "metal1"] [?transform transformation]           *
    *                                                                      *
    * Outputs the centre of matching objects. The ?transform argument will *
    *   typically not be passed by the user - it's passed internally as    *
    *                      it is called recursively.                       *
    *                                                                      *
    ***********************************************************************/
    
    procedure(CCFoutputPolygonCentres(cvId myPort @key 
      (objType "polygon") (layerName "metal1")
      (transform list(0:0 "R0" 1))
      )
      ;----------------------------------------------------------------------
      ; Print out the actual shape centres
      ;----------------------------------------------------------------------
      foreach(shape cvId~>shapes
        when(!objType || shape~>objType==objType
          when(!layerName || shape~>layerName==layerName
            fprintf(myPort "\t%L\n" 
              dbTransformPoint(centerBox(shape~>bBox) transform)
            )
          )
        )
      ) 
      ;----------------------------------------------------------------------
      ; Recursively traverse the instances
      ;----------------------------------------------------------------------
      foreach(inst cvId~>instances
        when(inst~>objType=="inst"
          CCFoutputPolygonCentres(inst~>master myPort
            ?objType objType ?layerName layerName
            ?transform dbConcatTransform(inst~>transform transform)
          )
        )
      )
      ;----------------------------------------------------------------------
      ; Recursively traverse the mosaics (arrays). This is the most
      ; complicated part because you have to visit each row and column
      ;----------------------------------------------------------------------
      foreach(mosaic cvId~>mosaics
        let((master orient xy newTransform mosaicTransform)
          master=car(mosaic~>instanceList)~>master
          orient=car(mosaic~>tileArray)
          mosaicTransform=
            dbConcatTransform(
              dbConcatTransform(
                list(mapcar('minus mosaic~>xy) "R0" 1)
                list(0:0 orient 1)
              )
              list(mosaic~>xy "R0" 1)
            )
          ;------------------------------------------------------------------
          ; Iterate over the rows and columns, flattening each
          ; sub-instance in the simple mosaic
          ;------------------------------------------------------------------
          for(row 0 mosaic~>rows-1
            for(col 0 mosaic~>columns-1
              xy=xCoord(mosaic~>xy)+col*mosaic~>uX:yCoord(mosaic~>xy)+row*mosaic~>uY
              ;--------------------------------------------------------------
              ; Compute the transformation of the sub-instance
              ;--------------------------------------------------------------
              newTransform=
                dbConcatTransform(
                  dbConcatTransform( list(xy "R0" 1) mosaicTransform)
                  transform
                )
              CCFoutputPolygonCentres(master myPort
                ?objType objType ?layerName layerName
                ?transform newTransform
              )
            )
          )
        )
      )
      t
    )
    
    
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Serjik
    Serjik over 8 years ago
    Thenk you Anrew, it works how i want, but after the third time (after first and second time output file is empty, and after the third time report.txt got the coordinats repeated 3 times).

    Regards,
    Sergey.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    Sergey,

    Did you close the file after each call to the function - i.e. call the close() function? The output is buffered in SKILL (as with C stdio) and so it may just be that the buffer doesn't get flushed until there is enough data in it. 

    So in other words, call:

    port=outfile("./report.txt")
    cv=geGetEditCellView()|
    CCFoutputPolygonCentres(cv port ?objType "rect" ?layerName "metal2")
    close(port)

    each time you wish to try it out (pick the right argument values for ?objType and ?layerName).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Serjik
    Serjik over 8 years ago
    Sorry, my mistake, now everything is great.
    Thenk you for help.

    Regards,
    Sergey.
    • 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