• 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. Issue with CCShiHierLayerOps

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 11715
  • 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

Issue with CCShiHierLayerOps

Inarma
Inarma over 4 years ago

Hello All,

   I have been using a piece of community code to do hierarchical layer gen for a while. In general, the program works pretty well but there is one critical element that it has been failing me. The program will consistently give me ellipses that are not perfectly circular and are instead truncated into polygons. 

 My thoughts/testing:

  • The problem arises whether or not the object has been flattened or not (so probably doesn't have to do with dbFlattenInst)
  • The problem occurs regardless of which layer operation (mainly "AND" and "GROW BY" set to 0 were tested)
  • The problem occurs when making the scratch/dummy cell in both "s" and "a" mode
  • I tried testing to see if dbCopyFig would change the objType from ellipse to polygon and in general it did not have this effect. Maybe there is some condition we are triggering that is causing it to act this way?

RELEVENT CODE BELOW:

;-------------------------------------------------------------------------------------------------------------------------------------------------------------

 procedure(CCShierLayerOps(@key (cv geGetEditCellView())
layer1 layer2 outLayer op size (level 0) "dgggtgx")
let((newcv layer1Name layer2Name layerOp newInst newShapes)
when(and(cv equal(cv~>cellViewType "maskLayout"))
;; create a new scratch cell for intermediate operations
newcv = dbOpenCellViewByType(cv~>libName
symbolToString(gensym(cv~>cellName))
"layout"
"maskLayout" "s"
)
layer1Name = stringp(layer1)&&layer1 || pairp(layer1)&&car(layer1)
layer2Name = stringp(layer2)&&layer2 || pairp(layer2)&&car(layer2)
;; copy each shape & instance to the new scratch cell
;; NOTE: "textDisplays" will not be copied using this method
foreach(shape
setof(shp cv~>shapes shp~>objType!="textDisplay")
dbCopyFig(shape newcv)
)
;; when the hierarchy depth is greater than 0, copy the instances,
;; and then flatten each instance by the number of levels desired
;; Only perform the copy and flatten if level is greater than 0
when(level>0
foreach(inst cv~>instances
;; when the instance was copied, flatten the new instance
when(newInst=dbCopyFig(inst newcv)
dbFlattenInst(newInst level t nil t) ; was previously ....dbFlattenInst(newInst level t t t), but we don't care about pins
); when the instance is copied
); foreach
); when the hierarchy depth is > 0
;; create new shapes based on the interaction (AND in this
;; example) of shapes on certain layers ("metal1" and "poly1"
;; in this example) and store the list for the copy back
layerOp = case(op
("AND" 'dbLayerAnd)
("AND NOT" 'dbLayerAndNot)
("OR" 'dbLayerOr)
("XOR" 'dbLayerXor)
("GROW BY" 'dbLayerSize)
)
;; use "apply" to pass all the arguments to the appropraite
;; dbLayer function
newShapes = apply(layerOp list(newcv outLayer
setof(shape newcv~>shapes shape~>layerName == layer1Name)
;; if the size argument is non-nil use this for "grow by"
or(size setof(shape newcv~>shapes shape~>layerName == layer2Name)) )
)
;; copy back each new generated shape to the original layout
newShapes = foreach(mapcar shape newShapes dbCopyFig(shape cv))
;; close the scratch cellview
dbClose(newcv)
;; return the new shape list in the original cellview, this is
;; useful when this function is called directly (not via the UI)
newShapes
); when
); let
); procedure CCShierLayerOps

;-------------------------------------------------------------------------------------------------------------------------------------------------------------

   For those not familiar with the full piece of code follow the link below:

   How can I perform boolean or logical operations on layers across multiple hierarchy levels? (cadence.com)

Thank you,

Zack

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    Zack,

    This is inevitable. Whilst in theory some of the operations could in principle preserver ellipses (that would only be if the resulting shape remained untouched), in practice the boolean layer functions always convert to polygons (they convert paths to polygons too). Since the shapes would need merging if there were overlapping shapes and so on, it would be a very special case to handle ellipses and preserve them - such objects are fairly rare in an IC environment.

    You could deal with this by explicitly calling dbConvertEllipseToPolygon which has control over the number of sides in the resulting polygon, and using that prior to the dbLayer functions. That gives you some control over the smoothness.

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    Zack,

    This is inevitable. Whilst in theory some of the operations could in principle preserver ellipses (that would only be if the resulting shape remained untouched), in practice the boolean layer functions always convert to polygons (they convert paths to polygons too). Since the shapes would need merging if there were overlapping shapes and so on, it would be a very special case to handle ellipses and preserve them - such objects are fairly rare in an IC environment.

    You could deal with this by explicitly calling dbConvertEllipseToPolygon which has control over the number of sides in the resulting polygon, and using that prior to the dbLayer functions. That gives you some control over the smoothness.

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Children
  • Inarma
    Inarma over 4 years ago in reply to Andrew Beckett

    Hi Andrew,

       Thank you for your help. This fixed my problem and didn't add too much additional computation time to the algorithm.

       On an unrelated note, you have already helped me 2 times on this forum and most of the times I google things for help you are the person answering the questions. How do you have the time to help seemingly everyone in the Cadence community with their questions? I have been coding in skill for almost 3 years now and I don't think I'd be half as good without your forum posts.

    Thanks,

    Zack

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to Inarma
    Inarma said:
    How do you have the time to help seemingly everyone in the Cadence community with their questions?

    It's a struggle at times! I try to spend a few minutes each day quickly answering questions, but you will see me pointing anything that's likely to take longer to customer support because obviously I can't answer everything (and do my actual job at Cadence too).

    Anyway, glad to be able to help!

    Andrew.

    • 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