building instance

edited September 2020 in KLayout Support

Hi sir,
Cause the GDSII file do I have , the file has been smashed(flatten) all level in previosly step .(in my customer side)
It is many pattern (polygon) in GDS file , such as layer # 154 / purpose #0 , 15um circle / totally 1500 , (location) random.
I need to re-building that as standard instance -- one by one.
We have no Netlist (pattern location by text format) , is is possible to make that process as ruby command?
such as search pattern , sort it by area / check the BBox(center of X , Center of Y) then make 1 cell into the location......

Comments

  • My first step would be to go back to the customer
    and see whether there's a layout saved from before
    the flatten-all step was taken.

  • bad news is.....my customer say that , they can't provide GDSII file with cell instance ALWAYS.
    How can I do for this request?

  • I agree with the previous comment - once a hierarchy is lost, it can hardy be recovered. A cell hierarchy is typically a logical composition - based on devices or library cells.

    You did not give details about the kind of mask you're trying to regenerate a hierarchy from. Maybe you can paste a screenshot of how the mask looks like after smash. Maybe it's possible to give more advice then.

    Matthias

  • Hi Matthias,
    If I know the sub-cell layout , such as that just a 30um circle , and I create a new cell named as "subcell"
    I also have the cell instance point.
    such as (0,0) / (0,50) / (50,80)....
    can we create cell instance (insert) comamnd as below ?

    cellx = layout.create_cell("TopCell")
    cellx.insert("SubCell"::(0,0)......)

  • It's slightly more text (this is Ruby):

    subcell_index = layout.cell("SubCell").cell_index()
    transformation = RBA::DTrans::new(x, y)   # x, y in micrometer units
    cellx.insert(RBA::DCellInstArray::new(subcell_index, transformation))
    

    Matthias

  • Hi Sir,
    my sub-cell named" original"
    my top-cell been open in current window and named by "DIE"

    so , I just change some wording...
    subcell_index = layout.cell("original").cell_index()
    transformation = RBA::DTrans::new(0,0) # x, y in micrometer units
    DIE.insert(RBA::DCellInstArray::new(subcell_index, transformation))

    but I got message as below...

    Script error window shown...
    undefined method "cell_index" for #...
    did you mean? cell_name

  • Hi Sir,
    I try other way to instance cell into current (opened) cell , but it is can't work.
    could you please help it?

    main_window = RBA::Application::instance.main_window
    layout = RBA::CellView::active.layout
    layout_view = main_window.current_view
    dbu = layout.dbu
    out_cell = layout_view.active_cellview.cell
    subcell_index = layout.cell(BumpCell).cell_index()
    inst = out_cell.insert( CellInstArray.new(subcell_index,Trans.new(-100/dbu,0/dbu)))

  • @jiunnweiyeh You're in the DRC section. Switch to the "Ruby" tab to write Ruby scripts.

    BTW: thanks for sharing the screenshot. Makes debugging easier :)

    Matthias

  • Hi Sir,
    it is work as code below , but It always put subcell (named "BumpCell") into (0,0) (even I make the value by 10,-336 or 40,-336)...
    can you help it ?
    Thanks very much for your help.

    main_window = RBA::Application::instance.main_window
    layout = RBA::CellView::active.layout
    layout_view = main_window.current_view
    dbu = layout.dbu
    out_cell = layout_view.active_cellview.cell
    subcell_index = layout.cell("BumpCell").cell_index()
    transformation = RBA::DTrans::new(10, -336)
    out_cell.insert(RBA::DCellInstArray::new(subcell_index, transformation))

    transformation = RBA::DTrans::new(40, -336)
    out_cell.insert(RBA::DCellInstArray::new(subcell_index, transformation))

  • Hi sir,
    as my question post at Nov/12 .
    I got answer , that is cause by dbu issue , I have to change the instance point to align what the dbu ratio.

    another question is...
    why some of Ruby (such as loop command) can been run in DRC
    some of Ruby can't (such as instance cell) .
    we have to make that command into Ruby page...

  • Hi Sir,
    I want to try to put instance cell into what the pattern I select
    the code as below , but it is not workable.
    could you please help to check it?

    include RBA
    mw = Application::instance.main_window
    lv =mw.current_view
    out_cell = lv.active_cellview.cell

    main_window = RBA::Application::instance.main_window
    layout = RBA::CellView::active.layout
    layout_view = main_window.current_view

    instance_cell = "Bump"
    subcell_index = layout.cell(instance_cell).cell_index()

    lv.each_object_selected do |sel|
    if !sel.is_cell_inst?
    shape = sel.shape
    point=shape.bbox.center
    transformation = RBA::DTrans::new(point)
    out_cell.insert(RBA::DCellInstArray::new(subcell_index, transformation))
    end
    end
    RBA::QMessageBox::information(mw, "BBOX Center", "the list as main window")

  • Hi,

    "DTrans" takes a Vector, not a Point (see here for the difference: https://www.klayout.de/doc-qt5/programming/geometry_api.html#k_2).

    And you should not use "DTrans", but "Trans". "DTrans" is for micron-units coordinates, but "bbox" gives a DBU-unit bounding box. If you want micron units, you can also use "dbbox" instead of "bbox". "dbbox.center" will give you a micron-unit point (DPoint).

    Either use "Trans::new(point.x(), point.y())" or "Trans::new(point - RBA::Point::new)". Or "DTrans::new(point - RBA::DPoint::new)" if you want to work in micron-unit space.

    Matthias

  • Hi Sir,
    Now, my code as below.
    I have no idea for these issue....
    1.DTrans::new(locationx , locationy))) is workable , but "Trans::new(point - RBA::Point::new)" is not work...
    2.how to do that , let me input a full layer (such as layer 151/1 ) not select the pattern in first?
    (such as ...
    Pattern = input( 151,1)
    than base on that layer to do instance?

    ------------------------------------------------

    include RBA
    mw = Application::instance.main_window
    lv =mw.current_view
    out_cell = lv.active_cellview.cell

    main_window = RBA::Application::instance.main_window
    layout = RBA::CellView::active.layout
    layout_view = main_window.current_view
    dbu = layout.dbu.round(3) *10

    instance_cell = "PSV2"
    subcell_index = layout.cell(instance_cell).cell_index()

    lv.each_object_selected do |sel|

    lv.each_shape(5,2) do |sel|

    if !sel.is_cell_inst?
    shape = sel.shape
    point=shape.dbbox.center.to_s

    point=shape.bbox.center.to_s

    location=point.split(',')
    locationx=(location[0].to_f)
    locationy=(location[1].to_f)
    puts locationx

    puts "X location : #{locationx}"

    puts "Y location : #{locationy}"

    out_cell.insert(RBA::DCellInstArray::new(subcell_index, RBA::DTrans::new(locationx , locationy)))

    end
    end

    RBA::QMessageBox::information(mw, "Instance", "Make instance ")

  • Could you please use Markdown code formatting? Put a line with three backticks in front and after the code.

    This is unreadable.

  • Hi Matthias,
    sorry , here I try to make my code as markdown.. please help it. Thanks.

    this program can help user to make cell instance####
    user have to select pattern in first ###

    =======


    include RBA
    mw = Application::instance.main_window
    lv =mw.current_view
    out_cell = lv.active_cellview.cell

    main_window = RBA::Application::instance.main_window
    layout = RBA::CellView::active.layout
    layout_view = main_window.current_view
    dbu = layout.dbu.round(3) *10

    instance_cell = "PSV2"
    subcell_index = layout.cell(instance_cell).cell_index()

    lv.each_object_selected do |sel|
    if !sel.is_cell_inst?
    shape = sel.shape
    point=shape.dbbox.center.to_s
    location=point.split(',')
    locationx=(location[0].to_f)
    locationy=(location[1].to_f)
    puts locationx
    out_cell.insert(RBA::DCellInstArray::new(subcell_index, RBA::DTrans::new(locationx , locationy)))

    end
    end

    RBA::QMessageBox::information(mw, "Instance", "Make instance ")

  • This is how you use code formatting in Markdown:

    def function(a, b, c):
      return a * b + c
    
    print(function(1, 2, 3))
    

    This is the screenshot how this is made:

    Matthias

  • Why do you use this:

    point=shape.dbbox.center.to_s
    location=point.split(',')
    locationx=(location[0].to_f)
    locationy=(location[1].to_f)
    

    Instead of simply this

    point = shape.dbbox.center
    locationx = point.x
    locationy = point.y
    

    ?

    And what's the effect? Do you get an error message?

    Matthias

  • Hi Matthias,
    about code formatting in Markdown , I will try to make that .
    (I have not idea for how to make code as that , will try other way to make it...)

    '''
    about the code as below.
    point = shape.dbbox.center
    locationx = point.x
    locationy = point.y

    '''
    I need to check it again , Thanks.

Sign In or Register to comment.