• 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 10121
  • 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
Parents
  • 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
Reply
  • 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
Children
No Data

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