Klayout impoprt multi-GDS

Hi sir,
When Klayout import multi GDS files into same library.
Klayout will change the cell-name if file1 / file2 have same cell , (just add a $1 ...)
That is fine ( we need to rename that cell if it have same name)
[But , $ will been some issue , cause we have another software for GDS , "$ " will make some issue]
But can we change the (new)cell name as OOOO_1 ?
original :smile:
file1- cell :OOOO
file2- cell :OOOO

when we import both file into same libray (3rd file), that will been change to
file3 , cell:OOO and cell:OOO$1
we want to change that as
file3 , cell:OOO and cell:OOO_1

does Klayout have any option to control that ?
or , we just using a scribe to change the cell name?

Comments

  • Hello,

    What I normally do before importing multiple gds files into one layout is giving each cell of each one of them a unique prefix like "file1_", "file2_", ... It keeps things more organized after the merging and you clearly see which cells belong to which imported file... I use this script to rename the cells:

    https://www.klayout.de/useful_scripts.html#rename_cells.lym

    Cheers,

    Tomas

  • Hi Tomas,
    Thanks for your reply , I knew that we can using a script to rename any cell.
    What the question is --- if "$" word can be a option , our designer just need to import all the GDS.
    And no -need any script , that will make they confuse.....
    Sometimes they need script , sometimes didn't need that...(not all case using same cell name in multi GDS file)
    that is reason I ask for . if script is only way , I need to Training and make some SOP....

  • Hello,

    The "$" thingy is something internal and I'm don't think the user can change it, so only Matthias can answer...

    Cheers,

    Tomas

  • edited September 25

    Yes, "$" is internal and cannot be changed be the user.

    But "$" is often used inside GDS cell names - for example Cadence also uses "$" and I have not seen other tools that have trouble reading such files.

    If you want to change the names, here is a custom query which changes "$" to "_":

    with cells * do cell.name=gsub(cell.name, "$", "_")
    

    But beware of cell name clashes - this method does not check if this substitution would create duplicate names.

    Matthias

  • Hi @Matthias
    Got it , Thanks.
    in our side , we have 2 kind of tools to process GDS ,
    Klayout in first , and other softwafer in second that using tcl script.
    In Tcl, the $ character is used to denote a variable.
    we using tcl programming for script to process something base on our format/fix cellname.
    such as "Map" ,"reticle"...
    We are bumping house , the original cell (such as the RDL layout) created by our customer --IC design house.
    we just base on that to process and make it into our reticle Mask for internal photo process.
    We cannot control the format of the original GDS—it is determined by the customer.
    Additionally, we have specific cell names that are used in other software.
    Therefore, when a customer's cell name conflicts with our predefined names, we need to rename it.
    The $ character is another example also , since it affects the behavior of downstream Tcl scripts, it must be handled at the start.
    Of course, there are other ways to handle it, but those approaches will impack many scripts we've already completed.

  • I script that replaces the dollars would be this:

    ly = RBA::Layout::new
    top1 = ly.create_cell("TOP")
    # actually creates "TOP$1"
    top2 = ly.create_cell("TOP")
    # Would conflict with TOP$1
    # top3 = ly.create_cell("TOP_DOLLAR_1")
    
    puts "Original cell names:"
    ly.each_cell do |cell|
      puts cell.name
    end
    
    replace = "$"
    by = "_DOLLAR_"
    
    ly.each_cell do |cell|
      cn = cell.name
      cn_new = cn.gsub(replace, by)
      if cn != cn_new
        if ly.has_cell?(cn_new)
          raise("Name conflict for cell #{cn_new} after renaming '#{replace}' to '#{by}' in cell #{cn}")
        end
        cell.name = cn_new
      end
    end
    
    puts "New cell names:"
    ly.each_cell do |cell|
      puts cell.name
    end
    

    In this case, it replaces $ with _DOLLAR_. You should check if the new name conflicts with existing cells, just to be on the safe side.

    Matthias

Sign In or Register to comment.