Rounding of floats to database units

Hello,

I have written a small library of parametric cells in Python and have routinely worked with micrometer float database units. Now we have found that we have rounding issues when out PCells are converted to database units. We get small gaps like (this is from two PCells that should have no gap, the blue regions belong to two different PCells):

I wonder if someone in the forum has tips on how to handle this? In later processing steps, we do Boolean joins on these shapes, and would like to have no gaps like this. What is best practice?

Thanks for your advice!

Comments

  • Hi @ravn,

    There is no simple answer to that question.

    Basically, when you create a float-typed object inside a PCell, it is stored inside a remote cell that lives inside the library. In that step, the object is converted to database units. For this it uses the database unit the library is defined with - or more precisely, the DBU of the layout object that is attached to the library.

    This process should be fairly safe. Rounding is always performed in the same way, so same float coordinates should be translated to same database unit coordinates. There is still the risk of a numerical jitter, like 0.5 DBU being rounding up and down, but apart from that the process should be safe.

    When you instantiate cells inside the PCell, the cell placement vector is also subject to rounding. If you are not careful there, a cell may get shifted and it my not attach properly to its neighborhood. If you can rule out this case, then the PCell is good from the perspective of the library.

    Now, if you instantiate the PCell in some layout, KLayout will synchronize the library version of the PCell with your instantiated version. While it does, the PCell may get scaled. This is needed if the client layout and the library use different database units. This scaling may introduce some additional rounding and may be responsible for gaps, if instances are involved. Flat layout should be scaled in a predictable way that does not render gaps.

    Matthias

Sign In or Register to comment.