mirror of https://github.com/KLayout/klayout.git
Provide a solution for #809 (density goes outside the area)
This commit is contained in:
parent
e57d573a42
commit
fd1e206c56
|
|
@ -102,6 +102,14 @@ module DRC
|
||||||
DRCJoinFlag::new(true)
|
DRCJoinFlag::new(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def padding_zero
|
||||||
|
DRCDensityPadding::new(:zero)
|
||||||
|
end
|
||||||
|
|
||||||
|
def padding_ignore
|
||||||
|
DRCDensityPadding::new(:ignore)
|
||||||
|
end
|
||||||
|
|
||||||
def diamond_limit
|
def diamond_limit
|
||||||
DRCSizingMode::new(0)
|
DRCSizingMode::new(0)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3898,6 +3898,20 @@ CODE
|
||||||
# low_density = input(1, 0).density(0.0 .. 0.1, tile_size(20.um), tile_origin(0.0, 0.0), tile_count(100, 150))
|
# low_density = input(1, 0).density(0.0 .. 0.1, tile_size(20.um), tile_origin(0.0, 0.0), tile_count(100, 150))
|
||||||
# @/code
|
# @/code
|
||||||
#
|
#
|
||||||
|
# The "padding mode" indicates how the area outside the layout's bounding box is considered.
|
||||||
|
# There are two modes:
|
||||||
|
#
|
||||||
|
# @ul
|
||||||
|
# @li @b padding_zero @/b: the outside area is considered zero density. This is the default mode. @/li
|
||||||
|
# @li @b padding_ignore @/b: the outside area is ignored for the density computation. @/li
|
||||||
|
# @/ul
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# @code
|
||||||
|
# low_density = input(1, 0).density(0.0 .. 0.1, tile_size(20.um), padding_ignore)
|
||||||
|
# @/code
|
||||||
|
#
|
||||||
# The complementary version of "with_density" is \without_density.
|
# The complementary version of "with_density" is \without_density.
|
||||||
|
|
||||||
# %DRC%
|
# %DRC%
|
||||||
|
|
@ -3920,6 +3934,7 @@ CODE
|
||||||
tile_origin = nil
|
tile_origin = nil
|
||||||
tile_count = nil
|
tile_count = nil
|
||||||
tile_boundary = nil
|
tile_boundary = nil
|
||||||
|
padding_mode = :zero
|
||||||
|
|
||||||
n = 1
|
n = 1
|
||||||
args.each do |a|
|
args.each do |a|
|
||||||
|
|
@ -3933,6 +3948,8 @@ CODE
|
||||||
tile_count = a.get
|
tile_count = a.get
|
||||||
elsif a.is_a?(DRCTileBoundary)
|
elsif a.is_a?(DRCTileBoundary)
|
||||||
tile_boundary = a.get
|
tile_boundary = a.get
|
||||||
|
elsif a.is_a?(DRCDensityPadding)
|
||||||
|
padding_mode = a.value
|
||||||
elsif a.is_a?(Float) || a.is_a?(1.class) || a == nil
|
elsif a.is_a?(Float) || a.is_a?(1.class) || a == nil
|
||||||
nlimits < 2 || raise("Too many values specified")
|
nlimits < 2 || raise("Too many values specified")
|
||||||
limits[nlimits] = @engine._make_numeric_value_with_nil(a)
|
limits[nlimits] = @engine._make_numeric_value_with_nil(a)
|
||||||
|
|
@ -3977,11 +3994,15 @@ CODE
|
||||||
tp.threads = (@engine.threads || 1)
|
tp.threads = (@engine.threads || 1)
|
||||||
if tile_boundary
|
if tile_boundary
|
||||||
tp.input("boundary", tile_boundary.data)
|
tp.input("boundary", tile_boundary.data)
|
||||||
|
else
|
||||||
|
tp.input("boundary", RBA::Region::new(self.data.bbox))
|
||||||
end
|
end
|
||||||
|
|
||||||
tp.var("vmin", limits[0] || 0.0)
|
tp.var("vmin", limits[0] || 0.0)
|
||||||
tp.var("vmax", limits[1] || 1.0)
|
tp.var("vmax", limits[1] || 1.0)
|
||||||
tp.var("inverse", inverse)
|
tp.var("inverse", inverse)
|
||||||
|
|
||||||
|
if padding_mode == :zero
|
||||||
tp.queue(<<"TP_SCRIPT")
|
tp.queue(<<"TP_SCRIPT")
|
||||||
_tile && (
|
_tile && (
|
||||||
var bx = _tile.bbox.enlarged(xoverlap, yoverlap);
|
var bx = _tile.bbox.enlarged(xoverlap, yoverlap);
|
||||||
|
|
@ -3989,6 +4010,18 @@ CODE
|
||||||
((d > vmin - 1e-10 && d < vmax + 1e-10) != inverse) && _output(res, bx, false)
|
((d > vmin - 1e-10 && d < vmax + 1e-10) != inverse) && _output(res, bx, false)
|
||||||
)
|
)
|
||||||
TP_SCRIPT
|
TP_SCRIPT
|
||||||
|
elsif padding_mode == :ignore
|
||||||
|
tp.queue(<<"TP_SCRIPT")
|
||||||
|
_tile && (
|
||||||
|
var bx = _tile.bbox.enlarged(xoverlap, yoverlap);
|
||||||
|
var ba = boundary.area(bx);
|
||||||
|
ba > 0 && (
|
||||||
|
var d = to_f(input.area(bx)) / to_f(ba);
|
||||||
|
((d > vmin - 1e-10 && d < vmax + 1e-10) != inverse) && _output(res, bx, false)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
TP_SCRIPT
|
||||||
|
end
|
||||||
|
|
||||||
@engine.run_timed("\"#{method}\" in: #{@engine.src_line}", self.data) do
|
@engine.run_timed("\"#{method}\" in: #{@engine.src_line}", self.data) do
|
||||||
tp.execute("Tiled \"#{method}\" in: #{@engine.src_line}")
|
tp.execute("Tiled \"#{method}\" in: #{@engine.src_line}")
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,14 @@ module DRC
|
||||||
class DRCBothEdges
|
class DRCBothEdges
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# A wrapper for the padding modes of with_density
|
||||||
|
class DRCDensityPadding
|
||||||
|
attr_accessor :value
|
||||||
|
def initialize(v)
|
||||||
|
self.value = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# A wrapper for the sizing mode value
|
# A wrapper for the sizing mode value
|
||||||
class DRCSizingMode
|
class DRCSizingMode
|
||||||
attr_accessor :value
|
attr_accessor :value
|
||||||
|
|
|
||||||
|
|
@ -3382,6 +3382,20 @@ direction. With the "tile_origin" option this allows full control over the area
|
||||||
low_density = input(1, 0).density(0.0 .. 0.1, tile_size(20.um), tile_origin(0.0, 0.0), tile_count(100, 150))
|
low_density = input(1, 0).density(0.0 .. 0.1, tile_size(20.um), tile_origin(0.0, 0.0), tile_count(100, 150))
|
||||||
</pre>
|
</pre>
|
||||||
</p><p>
|
</p><p>
|
||||||
|
The "padding mode" indicates how the area outside the layout's bounding box is considered.
|
||||||
|
There are two modes:
|
||||||
|
</p><p>
|
||||||
|
<ul>
|
||||||
|
<li><b>padding_zero </b>: the outside area is considered zero density. This is the default mode. </li>
|
||||||
|
<li><b>padding_ignore </b>: the outside area is ignored for the density computation. </li>
|
||||||
|
</ul>
|
||||||
|
</p><p>
|
||||||
|
Example:
|
||||||
|
</p><p>
|
||||||
|
<pre>
|
||||||
|
low_density = input(1, 0).density(0.0 .. 0.1, tile_size(20.um), padding_ignore)
|
||||||
|
</pre>
|
||||||
|
</p><p>
|
||||||
The complementary version of "with_density" is <a href="#without_density">without_density</a>.
|
The complementary version of "with_density" is <a href="#without_density">without_density</a>.
|
||||||
</p>
|
</p>
|
||||||
<a name="with_distance"/><h2>"with_distance" - Selects edge pairs by the distance of the edges</h2>
|
<a name="with_distance"/><h2>"with_distance" - Selects edge pairs by the distance of the edges</h2>
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,18 @@ b.output(0, 0)
|
||||||
a.output(1, 0)
|
a.output(1, 0)
|
||||||
|
|
||||||
a.with_density(0..0.1, tile_size(10.um), tile_boundary(b)).output(100, 0)
|
a.with_density(0..0.1, tile_size(10.um), tile_boundary(b)).output(100, 0)
|
||||||
a.without_density(0..0.1, tile_size(10.um)).output(101, 0)
|
a.without_density(0..0.1, tile_size(10.um), padding_zero).output(101, 0)
|
||||||
a.with_density(0.1, nil, tile_size(10.um), tile_origin(25.um, 10.um)).output(102, 0)
|
a.with_density(0.1, nil, tile_size(10.um), tile_origin(25.um, 10.um)).output(102, 0)
|
||||||
a.with_density(0.1, nil, tile_size(10.um, 20.um)).output(103, 0)
|
a.with_density(0.1, nil, tile_size(10.um, 20.um)).output(103, 0)
|
||||||
a.with_density(0.1, 1.0, tile_size(10.um), tile_step(10.um, 20.um)).output(104, 0)
|
a.with_density(0.1, 1.0, tile_size(10.um), tile_step(10.um, 20.um)).output(104, 0)
|
||||||
a.with_density(0.1, nil, tile_size(10.um), tile_origin(25.um, 10.um), tile_count(10, 15)).output(105, 0)
|
a.with_density(0.1, nil, tile_size(10.um), tile_origin(25.um, 10.um), tile_count(10, 15)).output(105, 0)
|
||||||
a.with_density(0..0.1, tile_size(100.um), tile_step(10.um)).output(110, 0)
|
a.with_density(0..0.1, tile_size(100.um), tile_step(10.um), padding_zero).output(110, 0)
|
||||||
|
|
||||||
|
a.with_density(0..0.1, tile_size(10.um), tile_boundary(b), padding_ignore).output(200, 0)
|
||||||
|
a.without_density(0..0.1, tile_size(10.um), padding_ignore).output(201, 0)
|
||||||
|
a.with_density(0.1, nil, tile_size(10.um), tile_origin(25.um, 10.um), padding_ignore).output(202, 0)
|
||||||
|
a.with_density(0.1, nil, tile_size(10.um, 20.um), padding_ignore).output(203, 0)
|
||||||
|
a.with_density(0.1, 1.0, tile_size(10.um), tile_step(10.um, 20.um), padding_ignore).output(204, 0)
|
||||||
|
a.with_density(0.1, nil, tile_size(10.um), tile_origin(25.um, 10.um), tile_count(10, 15), padding_ignore).output(205, 0)
|
||||||
|
a.with_density(0..0.1, tile_size(100.um), tile_step(10.um), padding_ignore).output(210, 0)
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue