• 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. layout shape migration

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 144
  • Views 14966
  • 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

layout shape migration

stuso
stuso over 14 years ago

Hi All, i've written a simple script that grabs all shapes and changes the layerName and purpose as required (to map from one PDK to another). It works fine on small test cells. However i tried it out on a larger layout that has 52000 shapes (MPP's guard rings, looks llike each contact is a shape) & cadence crashes complaining of memory stack.

I think the code itself is efficient, but perhaps not:

foreach( shape_item cv~>shapes

 cond(
  (( nth( 0 shape_item~>lpp ) == "VTLN" && nth( 1 shape_item~>lpp )) == "drawing"
  shape_item~>layerName="OD" 
  shape_item~>purpose="drawing"
  )

nth( 0 shape_item~>lpp ) == "OD" && nth( 1 shape_item~>lpp )) == "drawing"

  shape_item~>layerName="NWELL" 
  shape_item~>purpose="drawing"
  )

...etc

 );end cond

);end foreach

So it sticks all the shapes in a list and then with the foreach it goes through each element of the list and change its layerName and purpose accordingly. If its not ok to have such a large list is it trivial to handle a list in say 500 elements at a time?

Or could it be that in layout land i am changing all these thousands of layer properties without a save and its too much data for the cadence to handle (or the undo stack becomes massive)?

Many thanks

Stu 

 

 

 

  • Cancel
  • Austin CAD Guy
    Austin CAD Guy over 14 years ago


    Hi Stu

     You are probably running out of memory by trying to process 52000 shapes in a single list. Process them one lpp at a time and let the garbage collection take care of freeing memory:

    lpps = cvId~>lpps
    foreach( lpp lpps
      cond(
        ( lpp~>layerName == "OD" && lpp~>purpose == "drawing"
            newLayer = "NWELL"
            newPurpose = "drawing"
        )
        .... Put your layer/purpose mapping here
      )

      foreach( shape lpps~>shapes
        shape~>layerName = newLayer
        shape~>purpose = newPurpose
      )

    )

    Ted (Signature not part of the code)

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

    Stu,

    Not sure - 52000 should be simple to handle. I can't really see why you're doing all those nth() calls - surely it would be easier to do:

    cond(
      (shape_item~>layerName=="VTLN" && shape_item~>purpose=="drawing"
        shape_item~>layerName="OD" ...

    That would cut down the garbage created. But I doubt that's the problem.

    It would also be more efficient to do:

    shapeTable=makeTable('shapeTable nil)
    foreach(lpp cv~>lpps
      shapeTable[list(lpp~>layerName lpp~>purpose)]=lpp~>shapes
    )
    foreach(lpp shapeTable
      cond(
        (car(lpp)=="VTLN" && cadr(lpp)=="drawing"
          shapeTable[lpp]~>layerName="OD"
        )
        (car(lpp)=="OD" && cadr(lpp)=="drawing"
          shapeTable[lpp]~>layerName="NWELL"
        )
     )
    )
    shapeTable=nil

    The reason for storing it all in a table first is because if you update the lpps as you go along, you'll be modifying lpps that you've not got to yet - so if I store the list of the original shapes for each layer purpose pair, they won't clobber each other. Also directly updating the layerName or purpose of a list of shapes in one go should be more efficient.

    Regards,

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Austin CAD Guy
    Austin CAD Guy over 14 years ago

     I forgot, this processing will move shapes to the new lpps and then if you process the new lpps you will move ALL of those shapes to the even newer lpps. The best way to do this is to make sure you are processing the lpps in an order where the shapes are always moved to an open layer. That requires sorting the lpp list and you may have to move the first lpp shapes to a temporary layer then move them again to the final layer after everything is moved.

    BE SURE YOU MAKE A BACKUP BEFORE RUNNING THE CODE!!!! 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dmay
    dmay over 14 years ago

    I'm surprised you are running out of memory, since 52,000 doesn't seem that huge, but I do have several suggestions for performance improvement and simplicity of code.

    If your conditional is quite large (I'm assuming it is filled with many layer mappings), then you are making too many accesses to shape_item~>lpp. For example, if there are 20 checks in your conditional, they you are accessing this attribute 40 times if only the last item in the conditional matches. Generally speaking, try using car instead of nth(0 and cadr instead of nth(1. However, in this case I wouldn't do either. First of all, if you are not changing the purpose, then just check the layer name and save some trouble.

    (shape_item~>layerName == "VTLN" 
      shape_item~>layerName = "OD"
    )

    Again, you don't want to access that attribute more time than necessary, so try a case statement:

    case(shape_item~>layerName
      ("VTLN" 
        shape_item~>layerName = "OD")
      ("OD"
        shape_item~>layerName = "NWELL")
    )

    You could also loop through the cellview lpps attribute and then process the shapes one lpp at a time. Looks like Ted posted before me, so check out his solution.

    Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Austin CAD Guy
    Austin CAD Guy over 14 years ago

     Using tables is pretty effecient, Andrew.

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

    Ted, our posts crossed - that's why I'm doing the table approach - to avoid them clobbering each other as you go along.

    Looks as if you, Derek and I have all come up with the same answer - so there would seem a strong likelihood that it's the right way to solve it!

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • stuso
    stuso over 14 years ago

    Hi guys, thanks for the advice so far. I agree my skill code is inefficent & i'll tidy it up. I have heard from one guy who says he has known a list of 8 million elements.

    I tried an experiment putting a dbSave in my foreach so in effect it would save EVERY time it went round the loop, very inefficient i know. However, it did run (for at least 8 hours!!!) BUT it did not crash. Something interesting happened with the MPP's (multi-part path) , the base layer got changed but the subparts (e.g contacts) did not. I guess this ties in with when you "q" the properties of an MPP, you as the shapes other than the base layer are sub-parts that cannot be directly modified. 

    So thinking out loud the options could be:

    1) subpart shapes are editable in a mpp, i just need to allow this somehow

    2) shapes (subparts) are not directly editable in  a mpp, therefore i could select all MPP's, get their required data ( co-ords, layers ..etc) then delete the mpp, do my layer translation, then re-draw the new mpp ( i have the skill for the new mpp's). I see some similar SR's which i need to look into.

    3) flatten the mpp's, highly undesirable 

    I'm guessing that in my test run that the routine is attempting to edit shapes which are not editable and thats an issue.

    Thanks

    Stu 

     

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 14 years ago

    Hi Stu,

    since an MPP is a rod object, you can obtain the rod object id and then the subaprts are all visible from there - you should be able to alter them through SKILL in a similar fashion to editing them using the Edit Path Properties form -> "Subparts" form.  There are bound to be some solutions that discuss modifying an MPP's subparts.

    Hope this helps,

    Lawrence.

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

    Stu,

    You can't directly edit the shapes in the subparts (you'd have to flatten it, or reconstruct it), but you can (in IC615) use rodGetSubPart(), rodDeleteSubPart() and rodAddSubPart().

    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