It looks like you're new here. If you want to get involved, click one of these buttons!
Hi Matthias,
Is there a way to repeat sub-cell layer boolean? Currently the "Layer => Boolean Operations" process layer on database level, and the result would be generated on Topcell.
For example(Currently):
Topcell => Cell1 (with layer 1/0 and layer 2/0)
=> Cell2 (with layer 1/0 and layer 2/0)
If boolean (1/0 not 2/0) to 3/0 , the 3/0 would on Topcell and usually becomes a large polygon.
We hope the 3/0 could be down to Cell1 => 1/0 not 2/0 => output 3/0 in Cell1 and then Cell2, CellN...
I tried to do it with DRC Macro, however I don't know how to specify the output cell from Topcell to Cell1...
layout_with_selection = layout.select("-*", "+Cell1")
a = layout_with_selection.input("1/0")
b = layout_with_selection.input("2/0")
c = a.not(b)
c.output("c (3/0)")
chhung
Comments
Hi Chhung,
basically, KLayout's DRC implementation is flat, not hierarchical. So it will pull all shapes to top level and process them there.
Your approach however is correct - if you happen to know that you can process these cells separately. "cell" is the method which allows you to focus on one cell and perform the operations in the context of that cell (again flat with respect to this cell) and "select" is the operation which allow to unselect cells plus their children.
"select" and "cell" act on subsequent "input" statements, so they have to appear before "input".
Here's your example with a simple hierarchy of "TOP" and two child cells "A" and "B" which are considered to be isolated with respect to each other and to the top cell. The following code will perform the operation locally on "A" and "B" and then on "TOP", this time without "A" and "B":
Since the actual processing appears three times you can put it into a function (actually a method):
Hope that helps.
Best regards,
Matthias
Hi Matthias,
The cell() function call solved our problem, thank you so much~
One tier sub-cell boolean operation could be apporached like the code:
Best Regards,
chhung
Hi chhung,
thank you for the code. It's correct, but let put a note here for other readers: in the general case this approach is likely to produce incorrect results because it does not take into account inter-cell interactions. If the cells are non-overlapping however it's a valid and usually faster solution.
Best regards,
Matthias
Dear Matthias,
I want to do the same because if you merge the layers in the top cell, the hierarchy in the layout is avoided due to the layers in the subcells is copied to the top cell.
I have developed some code to fix this, however at the end the layout showed only is the first subcell iterated. Could you help me?
app = RBA::Application.instance
mw = app.main_window
view = mw.current_view
cv = view.cellview(view.active_cellview_index)
cv.layout.each_cell_bottom_up do |cellss|
print cellss.to_s
cell(cv.layout.cell_name(cellss))
if !cv.is_valid?
return
end