Library cell names

edited May 2014 in Ruby Scripting

Is there a way to return all the cell names of a library via Ruby scripting? For example to return the names of the PCells inside the Basic library.

Thanks!

Comments

  • edited May 2014

    Hi David,

    almost .. There is no method to iterate the PCell declarations currently (I simply forgot).

    But there is a workaround: although not documented explicitly, the PCell ID's are assigned as consecutive numbers 0, 1, 2, ... (disclaimer: I don't guarantee that for the future, but then there will be a method to iterate explicitly).

    Since the pcell_declaration method will return nil for invalid ID's, it's possible to iterate by trying ID 0, 1, ... and so forth:

    RBA::Library::library_names.each do |lib_name|
    
      puts "Library #{lib_name}:"
    
      lib = RBA::Library::library_by_name(lib_name)
    
      layout = lib.layout
    
      puts "  Static cells:"
      layout.each_cell do |cell|
        attr = ""
        if cell.is_proxy?
          attr += " (proxy)"
        end
        if cell.is_ghost_cell?
          attr += " (ghost)"
        end
        puts "    " + cell.name + attr
      end
    
      puts "  PCells:"
      # workaround: missing iterator for PCell's
      pcell_id = 0
      while pcell_decl = layout.pcell_declaration(pcell_id)
        puts "    " + pcell_decl.name
        pcell_id += 1
      end
    
    end
    

    Please also note, that this script will show some static cells you probably don't expect. These proxy cells act as placeholders for PCell's and cells imported from other libraries and are listed with a "(proxy)" attribute. There are also "ghost" cells which act as placeholders for cells instantiated but not defined in a GDS2 file.

    Matthias

  • edited November -1

    That works great for now. Thanks.

    David

Sign In or Register to comment.