Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  
    I am trying to merge multiple GDS files into one parent cell with given XY offset. I am having trouble with my "cell.insert" i get an error "No overload with matching arguments in CellInstArray::initialize" . Any help would be greatly appreciated.


    Thanks,
    Keil


    <code>

    module MyMacro

    include RBA

    ly = RBA::Layout::new
    ly.read("firstFile.gds")
    ly.read("secondFile.gds")
    ly.read("thirdFile.gds")
    X = [0,100,1000]
    Y = [0,100,1000]
    i = 0
    # create new cell TOP
    cell_index = ly.add_cell("TOP")
    cell = ly.cell(cell_index)


    #Get top cell of file
    top_cell_name = ""
    ly.top_cells.each { |curCell|


    p "topcell: " + curCell.name + " and index:" + curCell.cell_index.to_s + " " + cell.name
    if top_cell_name == "TOP"
    next
    else

    #Add top cell to main layout
    x = (0.5 + X[i] / ly.dbu).to_i
    y = (0.5 + Y[i] / ly.dbu).to_i
    p "x:" + x.to_s + " y:" + y.to_s
    cell.insert(RBA::CellInstArray::new(ly.cell(curCell.cell_index), RBA::Trans::new(RBA::Point::new(x, y))))

    ly.delete_cell_rec(cur_cell)
    i = i + 1
    end
    }

    ly.write("my_layout.gds")
    end

    </code>
    • CommentAuthorMatthias
    • CommentTimeNov 7th 2015 edited
     

    Hi Keil,

    The message says there are multiple versions and none is accepting the arguments that you provide. It refers to "RBA::CellInstArray::new" (it says "initialize" instead of "new" - that's Ruby slang for the constructor).

    The version you require is the one that accepts a cell index(!) and a transformation. You converted to the index to a cell reference using ly.cell(..) already and since the constructor takes a cell index, it does not accept these arguments.

    The right way is:

    cell.insert(RBA::CellInstArray::new(curCell.cell_index, RBA::Trans::new(RBA::Point::new(x, y))))
    

    Matthias

  2.  
    Thank you sir. That fixed it. How do you post code like you do? I tried <code> </code> like some other forums but that did not work.

    Thanks again,
    Keil
  3.  

    This forum uses Markdown. Precede each line of code with at least four spaces.

    • CommentAuthorkeilboring
    • CommentTimeNov 10th 2015 edited
     

    Thanks guys. This is what i ended up using.

     module MyMacro
     #klayout_app.exe -b -r mergeFiles.lym -rd files=firstFile.gds,seconldFile.gds,thirdFile.gds -rd outputFile=my_layout4.gds     -rd X_cord=0,30000,60000 -rd Y_cord=0,0,0
    #Each file should have a unique top cell.
    include RBA
    ly = RBA::Layout::new
    
    #read in each file
    $files.split(",").each do |file|
         ly.read(file)
    end
    
    X = $X_cord.split(",")
    Y = $Y_cord.split(",")
    i = 0
    
     # create new cell TOP
    cell_index = ly.add_cell("TOP")
    cell = ly.cell(cell_index)
    
    
    #Get top cell of file
    ly.top_cells.each { |curCell|
    
    
          p "topcell: " + curCell.name + " and index:" + curCell.cell_index.to_s + "   "  + cell.name               
          #skip TOP so we dont add it to self
          if curCell.name == "TOP"  
            next 
          else
    
            #Add top cell to main layout
            x = (0.5 + X[i].to_i / ly.dbu).to_i
            y = (0.5 + Y[i].to_i / ly.dbu).to_i
            p "x:" + x.to_s + " y:" + y.to_s
            cell.insert(RBA::CellInstArray::new(curCell.cell_index, RBA::Trans::new(RBA::Point::new(x, y))))
    
            i = i + 1
          end
        }
    
      ly.write($outputFile)
    end
    
    • CommentAuthorhoanghai
    • CommentTimeNov 2nd 2017
     
    I tried Keil's code with Mathias's correction, but ran into a different problem.

    Line:
    ly.write("my_layout.gds")

    Error:
    "Internal error: /usr/src/packages/BUILD/klayout-0.24.9/src/dbLayout.cc:1289 topological_sort () was not true in Layout::write (Class RuntimeError)"

    Can you give me some suggestion?

    Thanks,
    Hai
    • CommentAuthorMatthias
    • CommentTimeNov 3rd 2017 edited
     

    Hi Hai,

    this exception is thrown when you managed to create a recursive hierarchy.

    I assume there already is a TOP cell in your layout. In this case, the new top cell created will be called "TOP$1", not "TOP", and the code fails.

    Here is a somewhat enhanced version of the above code (note a few enhancements)

    module MyMacro
    
      ly = RBA::Layout::new
    
      # Read in each file
      $files.split(",").each do |file|
        ly.read(file)
      end
    
      X = $X_cord.split(",")
      Y = $Y_cord.split(",")
      i = 0
    
      # Create new cell TOP (or similar unique name)
      cell_index = ly.add_cell("TOP")
      cell = ly.cell(cell_index)
    
      # Get top cells of the file
      ly.top_cells.each do |curCell|
    
        # Skip TOP so we dont add it to self
        if curCell.cell_index != cell.cell_index
    
          # Add top cell to main layout
          x = (0.5 + X[i].to_f / ly.dbu).to_i
          y = (0.5 + Y[i].to_f / ly.dbu).to_i
          cell.insert(RBA::CellInstArray::new(curCell.cell_index, RBA::Trans::new(RBA::Point::new(x, y))))
    
          i += 1
    
        end
    
      end
    
      ly.write($outputFile)
    
    end
    

    Please note that the "read multiple layout into one object" bears the risk of cell collisions: if two cells of different layout files carry the same name, their contents will be merged. This will usually spoil the layout.

    Matthias