Get the layers names and the cells names and the cells above them in the hierarchy

Hello,
I have a big GDS file with a lot of cells organized in a tree hierarchy. I want to retrieve the lowest level cells and their names together with the names of the cells above them in the hierarchy.
To get the lowest level cells I'm doing a loop over all cells and search for cells with a specific string which associated with the cells I need, but I don't know how to also retrieve the names of the upper cells.

A second thing that I need is to get a list of the layers names and numbers (../..) related to specific the cell.

Comments

  • I assume you're looking for something like this:

    ly = pya.CellView.active().layout()
    
    def dump_parents(cell, ly, indent = ""):
      for parent_cell_index in cell.caller_cells():
        parent_cell = ly.cell(parent_cell_index)
        print(indent + parent_cell.name)
        dump_parents(parent_cell, ly, indent + " ")
    
    # just an example    
    initial_cell = ly.cell("contact_9")
    
    # dump parents
    print("Parents of " + initial_cell.name + ":")
    dump_parents(initial_cell, ly)
    
    # show layers in this cell
    for layer_index in ly.layer_indexes():
      layer_props = ly.get_info(layer_index)
      if not initial_cell.shapes(layer_index).is_empty():
        print(initial_cell.name + " has layer " + str(layer_props))
    

    In my test case, the "contact_9" cell is instantiated in various ways below a common top cell "pand2x4", and the result is that:

    Parents of contact_9:
    pinv
     pdriver
      pand2x4
     pand2x4
    pdriver
     pand2x4
    pnand2
     pand2x4
    pand2x4
    contact_9 has layer 49/0
    contact_9 has layer 63/0
    contact_9 has layer 46/0
    contact_9 has layer 47/0
    

    GDS does not have layer names, so you'll only get layer and datatype numbers.

    Matthias

Sign In or Register to comment.