Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

without_density goes outside the boundary of the input layer #809

Closed
ahmednofal opened this issue May 25, 2021 · 3 comments
Closed

without_density goes outside the boundary of the input layer #809

ahmednofal opened this issue May 25, 2021 · 3 comments
Assignees
Milestone

Comments

@ahmednofal
Copy link

ahmednofal commented May 25, 2021

Thank you for your work on this project.
1- Can you use with_density and without_density for metal density drc checks ?

2- I am using without_density function(for a field oxide mask drc density check) to retrieve the polygons in a layer that do not achieve a certain density. My input layer has a bounding box that without_density function-produced tiles go out of.
Blue is the tiles produced by without_density, red is the input layer to the without_density function.
image

     input_layer = input(wild_card)
     print("\n#{input_layer.bbox}")
     print("\n#{input_layer.bbox}")
     bad_density = input_layer.without_density(0.33..0.57, tile_size(700.um), tile_step(70.um))
     good_density = input_layer.with_density(0.33..0.57, tile_size(700.um), tile_step(70.um))
     target("output.gds")
     input_layer.output(wild_card)
     bad_density.output(arbitrary_layer_num)
     good_density.output(arbitrary_layer_num2)

with a bounding box of (7.92,7.9;3592.5,5192.45)
It is not clear which layer(and consequently which boundary) is used for the base layer(which you divide the area of the polygon on), which would normally be the boundary layer. I tried using tile_boundary but it turns out that this options INCREASES the boundary and can not reduce it.

@ahmednofal ahmednofal changed the title with_density goes outside the boundary of the input layer without_density goes outside the boundary of the input layer May 25, 2021
@klayoutmatthias
Copy link
Collaborator

klayoutmatthias commented May 26, 2021

@ahmednofal If this is a support request, please consider using the forum for this purpose: https://www.klayout.de/forum/

"tile_boundary" will just add more layers for the bounding box computation, not confine the area computation. So it's clear that this will expand your bounding box.

The tiles are chosen so that each tile gets at least a tiny bit of the layout, hence the furthest tiles will just nibble at the border of the layout. Currently, everything outside is considered zero density, hence, the density falls off for the outer tiles and a low density error is triggered.

It's possible to adjust the implementation so only the area inside "tile_boundary" or the bounding box is checked - i.e. a mask rather than assuming zero density for the outside part. I'd like to leave this request open to a discussion here or in the forum.

You can also compute the number of tiles and the origin so no tiles are outside your chip's area:

input_layer = input(1, 0)

bbox = input_layer.bbox

puts "bbox=" + bbox.to_s

step = 70.um
size = 700.um

density = 0.2 .. 0.57 # for my pattern

# compute minimum number of tiles and a good offset
nx = ((bbox.width - (size - step)) / step).to_i
ny = ((bbox.height - (size - step)) / step).to_i
ox = bbox.left + (size - step) / 2
oy = bbox.bottom + (size - step) / 2
puts "nx=" + nx.to_s + ", ny=" + ny.to_s
puts "ox=" + ox.to_s + ", oy=" + oy.to_s

bad_density = input_layer.without_density(density, tile_size(size), tile_step(step), tile_origin(ox, oy), tile_count(nx, ny))
good_density = input_layer.with_density(density, tile_size(size), tile_step(step), tile_origin(ox, oy), tile_count(nx, ny))
bad_density.output(100, 0)
good_density.output(101, 0)

With this result (bad_density, test data is uniform 25% density and two patches with 0 and 100%):

image

However, because the tile count is rounded down, there will be a small area of max 70µm width and height at the top and right side which is not checked. The integrated solution will avoid this.

Matthias

@klayoutmatthias
Copy link
Collaborator

The solution consists of having a mode switch which tells "with_density" to change from "zero density outside" to "ignore outside". The keyword is "padding_ignore":

result = layer.with_density(..., padding_ignore)

Matthias

@klayoutmatthias
Copy link
Collaborator

This feature is released with 0.27.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants