Tiling (Fill Tool) in script

Hi,

I use the following script to do tiling, but I find it needs long time to run.
Is there a way to optimize?

Beside, I want to get the chip size by extent automaticly, as the folling:

chip =extent.sized(-20.um,-200.um),
but it shows there are something wrong.

How to modify this?

deep
tiles(1000)
threads(24)

ly = RBA::CellView::active.layout
micron2dbu = RBA::CplxTrans::new(ly.dbu).inverted
top_cell = ly.top_cell

HMWG = ly.layer(10, 0)
SLABWG = ly.layer(11, 0)
STRIPWG= ly.layer(12, 0)
M1 = ly.layer(105, 0)

chip =RBA::DBox::new(-9800.00000,-7900.00000,9800.00000,7900.00000)

distance = 20.0 # micron
ncpus = 4

tile_size = 15600.0

fc_origin1 = RBA::DPoint::new(0.0, 0.0)
fc_origin2 = RBA::DPoint::new(2.5, 2.5)

fc_name1 = "dummy_WG"
fc_name2 = "dummy_M1"
fc_box = RBA::DBox::new(-3.25.um,-3.25.um, 3.25.um,3.25.um)

fill_layer1 = ly.layer(1, 0)
fill_layer2 = ly.layer(40, 0)
fill_shape = RBA::DBox::new(-2.5.um,-2.5.um, 2.5.um,2.5.um)

fill_cell1 = ly.cell(fc_name1)
if ! fill_cell1
fill_cell1 = ly.create_cell(fc_name1)
fill_shape_in_dbu = micron2dbu * fill_shape
fill_cell1.shapes(fill_layer1).insert(fill_shape_in_dbu)

end

fill_cell2 = ly.cell(fc_name2)
if ! fill_cell2
fill_cell2 = ly.create_cell(fc_name2)
fill_shape_in_dbu = micron2dbu * fill_shape
fill_cell2.shapes(fill_layer2).insert(fill_shape_in_dbu)

end

fc_box_in_dbu = micron2dbu * fc_box
fc_origin_in_dbu1 = fc_origin1 && (micron2dbu * fc_origin1)
fc_origin_in_dbu2 = fc_origin2 && (micron2dbu * fc_origin2)

class TilingOperator < RBA::TileOutputReceiver
def initialize(ly, top_cell, *fill_args)
@ly = ly
@top_cell = top_cell
@fill_args = fill_args
end
def put(ix, iy, tile, obj, dbu, clip)

@top_cell.fill_region(obj, *@fill_args)
end
end

tp = RBA::TilingProcessor::new
tp.frame= chip

tp.dbu = ly.dbu
tp.threads = ncpus
tp.tile_size(tile_size, tile_size)
tp.input("HMWG", ly, top_cell.cell_index, HMWG)
tp.input("SLABWG", ly, top_cell.cell_index, SLABWG)
tp.input("STRIPWG", ly, top_cell.cell_index, STRIPWG)
tp.input("M1", ly, top_cell.cell_index, M1)

tp.var("dist", distance / ly.dbu)
tp.output("to_fillWG", TilingOperator::new(ly, top_cell, fill_cell1.cell_index, fc_box_in_dbu, fc_origin_in_dbu1))

tp.queue("var exclude = HMWG +SLABWG + STRIPWG ; var fill_region = _tile & _frame - exclude.sized(dist); _output(to_fillWG, fill_region)")

tp.output("to_fillM1", TilingOperator::new(ly, top_cell, fill_cell2.cell_index, fc_box_in_dbu, fc_origin_in_dbu2))
tp.queue("var exclude = M1; var fill_region = _tile & _frame - exclude.sized(dist); _output(to_fillM1, fill_region)")

begin
ly.start_changes # makes the layout handle many changes more efficiently
tp.execute("Tiled fill")
ensure
ly.end_changes
end

Comments

  • Could you please use code formatting ... triple backticks on a single line before and after the code ... this is painful to read.

    Beside that: you're using DRC commands at the beginning, but the rest is a Ruby script. What are you trying to do?

    For the extent, you should use:

    # dx, dy = sizing of the bounding box in DBU units
    chip = top_cell.bbox.enlarged(dx, dy)
    

    I can't give advice about optimization without a test case. Try to figure out what is the main performance detractor (disable TilingOperator#put, check how much faster it gets, disable other parts like the booleans inside the tiling processor script etc.). You can try increasing the number of CPUs or play with the tile size - maybe 1000 micron is so big that memory swapping happens.

    Matthias

  • @Matthias,

    Thank you very much for your respond.
    I am sorry, but how to make it shows in code formatting, I tried to use """ or ‘’‘ on a single line before and after the code,but it still shows as before.

    Beside, when I replace

    chip =RBA::DBox::new(-9800.00000,-7900.00000,9800.00000,7900.00000),
    with
    chip = top_cell.bbox.enlarged(0, 0)
    ,it seems that titling pattern is not right, it is a box of 5x5um,it is strange.



    What could be this caused by?
    Thank you for your suggestion. I will try to debug which part consumes most of the time.

  • I single line with backticks with code looks this way:

    And without your layout I cannot debug the problem either.

    BTW: why using "enlarged(0, 0)"?

    Matthias

Sign In or Register to comment.