Reading pin shapes & labels from LEF

I would like to read pin labels together with their shapes from standard-cells in a LEF file (such as the one in FreePDK45). I noticed that when I open the LEF KLayout creates metalX.LABEL and metalX.PIN layers. Now I could get all text labels on metalX.LABEL and find the intersecting shapes on metalX.PIN.
I just wondered: is there a more elegant solution?
In the end I'd like to have something like a dictionary: {'pin name': db.Shape, ...}



  • Some design systems create a pin label, but pin connectivity is taken from the pin object property list and the label is just for the user's convenience. The label is often offset from the box / polygon object and often on another layer (like "text" or "textInfo").

    I used to lose all that when going from Cadence to GDS-II and back. The pin objects would be streamed back in, but minus all of their non-geometry properties. I would always make a layout copy of all of the topcell pin objects, so I could copy them back onto the top level layout for re-LVSing blowback DBs from the mask shop.

    Other systems like Silvaco just use same-layer texts as connectivity identifiers. This I think is more suited to GDS-II as a primary design platform (not just a medium of exchange).

    I think any scheme that tries to assign label-derived connectivity to a layout object would need some sense of the relation between the two, if they are not (as I have seen) located with text origin inside pin object extents. Although if you have a for-sure match between layer.PIN and layer.LABEL then maybe a clever "find the closest label" script run on the layer.PIN objects might be able to get a decent "right choice rate". But I know nothing about how that would actually get done.

    There could be things that are better off done at the source-DB end (like copying
    metal1/label data onto metal1/drawing, and there's your drawing-layer connectivity, assigned - provided the text is sized and located right, not to violate DRC and so on). If there is consistency about label relation to pin then maybe it's easier, but I'd not bet on that across source-CAD-systems, foundry PDK developers etc.

  • Thanks for the extensive answer! Yes, for now by best guess is to geometrically relate the pin labels (text objects) with metal shapes. The easiest way is to check which shapes touch a certain pin label.

  • Hi Thomas (@dick_freebird: thanks for answering),

    right now the geometrical relation is the best way I'm afraid.

    Some metadata is translated into properties, such as DEF net names. But pin names are not. They are only translated into labels. I have created a ticket to initiate a discussion:

    Best regards,


  • Thanks Matthias! Do you have an example on how DEF net names are translated into properties? I did not play around with DEF import yet, but it could become interesting.

  • Hi Thomas,

    you can configure the way, net names are translated.

    There is a big section in the "Reader options" for this:

    In this examples net names are translated into properties with key "#1" (integer 1) and attached to shapes. Instance names are also translated into properties with key "#1" and are attached to instances.

    Best regards,


  • Cool! Thanks! :)

Sign In or Register to comment.