How to extract TOP cell name without opening GDS

I have some GDS with 2GB size. When using klayout script to read topcell name, it needs 5~6 minutes to read the whole GDS. I Also tried to parse GDS text but it seems TOPCELL do not have special record header. Is there any method to get topcell name without loading whole GDS.

Thank you,
Bing

Comments

  • edited September 2022

    No, the top cells are not marked specially in GDS. You have to analyze the hierarchy.

    5-6 minutes is kind of long for reading 2GB binary GDS. GDS loading is usually limited by the file transfer rate. At moderate 50 MB/s I'd expect 40s max. Are you maybe reading through a slow network connection?

    As you talk about text files - maybe you're trying to read 2GB GDS text files? I think you should switch to binary then.

    If you run a script, you can basically skip the layers so you can save some memory. Still the whole file needs to be scanned and file transfer rates apply:

    ly = pya.Layout()
    
    options = pya.LoadLayoutOptions()
    options.create_other_layers = False
    
    ly.read("your_file.gds", options)
    print(ly.top_cell().name)
    

    Matthias

  • Hi Matthias,
    Thank you for your suggestion.
    For OASIS format, can I use "S_TOP_CELL" record to parse topcell name?

    Thank you,
    Bing

  • edited October 2022

    Hi Bing,

    not with KLayout. KLayout is intended to read and process layout files. The top cell information available as S_TOP_CELL is of little use. It can be determined efficiently as a side effect of the layout sorting step. Beside that, S_TOP_CELL is optional and if your layout has multiple top cells there is no way of representing that with standard properties in OASIS.

    You can basically write a parser with the purpose of extracting this information only, but in the general case this is not trivial and as mentioned it will not provide you with an universal solution.

    Matthias

  • The idea behind oasis S_TOP_CELL and S_BOUNDING_BOX, S_BOUNDING_BOX_AVAILABLE properties was to allow a viewer to load the top cell and the first level bounding boxes to show these while continuing to load the rest of the file in the background. But it's optional for oasis, not an option for gds and one has to trust the tools which wrote that information.

    I have yet to see any viewer taking advantage of these properties. As Matthias rightfully pointed out, finding the top and computing bounding boxes is part of building the cell hierarchy. The only drawback being that the whole file has to be loaded first.

    if your layout has multiple top cells there is no way of representing that with standard properties in OASIS

    Afaik it is possible to have multiple file level S_TOP_CELL properties for files with multiple top cells.

  • I see ... But honestly I was not aware that placing a property multiple times generates multiple instances of the same property. Right now, I'm treating properties as key/values with the implicit constraint that the key is unique. Not always, but in most cases.

    Matthias

  • edited October 2022

    Instead of a file property, I think S_TOP_CELL only makes sense as a property for CELLNAME. Multiple CELLNAME in the cellname table of a strict oasis file can have a S_TOP_CELL property, all but unresolved references have the S_CELL_OFFSET property.
    A case where this is useful is for reticle data. In order to process a single stripe one would only have to read the tables, toplevel cell and the one stripe cell. Much faster then reading the whole file. This would also require the bbox property for all cellnames.

Sign In or Register to comment.