diff --git a/src/drc/drc/built-in-macros/_drc_engine.rb b/src/drc/drc/built-in-macros/_drc_engine.rb index e2ff2b7ee..fb331bc86 100644 --- a/src/drc/drc/built-in-macros/_drc_engine.rb +++ b/src/drc/drc/built-in-macros/_drc_engine.rb @@ -197,10 +197,11 @@ module DRC @total_timer = nil @drc_progress = nil - # initialize the defaults for max_area_ratio, max_vertex_count + # initialize the defaults for max_area_ratio, max_vertex_count, sparse_array_limit dss = RBA::DeepShapeStore::new @max_area_ratio = dss.max_area_ratio @max_vertex_count = dss.max_vertex_count + @sparse_array_limit = dss.sparse_array_limit @deep_reject_odd_polygons = dss.reject_odd_polygons dss._destroy @@ -1309,6 +1310,43 @@ module DRC self.max_vertex_count(count) end + # %DRC% + # @name sparse_array_limit + # @brief Gets or sets the sparse array singularization limit + # @synopsis sparse_array_limit(limit) + # @synopsis sparse_array_limit + # + # In deep mode, array instances with a bad ratio of overall bounding box area + # vs. actually covered area, induce a performance penalty, because their bounding + # box is not longer a good approximation for their footprint. + # The "sparse array limit" defines the ratio of array instance bounding box area + # vs. sum of bounding box areas of the individual instances, above which the array + # is resolved into single instances. + # + # Use this method without an argument to get the current value. + # + # By default, this feature is off (the sparse array limit value is negative). + # If your design uses many arrays with a bad coverage, you can set the sparse + # array limit to a value of 10 for example. + + def sparse_array_limit(sal = nil) + if sal + if @dss + raise("sparse_array_limit must be set before the first 'input' statement in deep mode") + end + if sal.is_a?(1.0.class) || sal.is_a?(1.class) + @sparse_array_limit = sal + else + raise("Argument is not numerical in sparse_array_limit") + end + end + @sparse_array_limit + end + + def sparse_array_limit=(sal) + self.sparse_array_limit(sal) + end + # %DRC% # @name max_area_ratio # @brief Gets or sets the maximum bounding box to polygon area ratio for deep mode fragmentation @@ -3305,6 +3343,7 @@ CODE @dss.reject_odd_polygons = @deep_reject_odd_polygons @dss.max_vertex_count = @max_vertex_count @dss.max_area_ratio = @max_area_ratio + @dss.sparse_array_limit = @sparse_array_limit r = cls.new(iter, @dss, RBA::ICplxTrans::new(sf.to_f)) diff --git a/src/drc/unit_tests/drcSimpleTests.cc b/src/drc/unit_tests/drcSimpleTests.cc index 5efe37ba9..2d6db90f1 100644 --- a/src/drc/unit_tests/drcSimpleTests.cc +++ b/src/drc/unit_tests/drcSimpleTests.cc @@ -2108,3 +2108,8 @@ TEST(147_MeasureNetsWithL2N) compare_text_files (output, au_output); } +TEST(148_sparse_array_limit) +{ + run_test (_this, "148", true); +} + diff --git a/testdata/algo/dss_sparse_array.gds b/testdata/algo/dss_sparse_array.gds new file mode 100644 index 000000000..a7c1821fd Binary files /dev/null and b/testdata/algo/dss_sparse_array.gds differ diff --git a/testdata/algo/dss_sparse_array_au1.gds b/testdata/algo/dss_sparse_array_au1.gds new file mode 100644 index 000000000..118962d23 Binary files /dev/null and b/testdata/algo/dss_sparse_array_au1.gds differ diff --git a/testdata/drc/drcSimpleTests_148.drc b/testdata/drc/drcSimpleTests_148.drc new file mode 100644 index 000000000..b70e96436 --- /dev/null +++ b/testdata/drc/drcSimpleTests_148.drc @@ -0,0 +1,39 @@ + +# Breaking + +source($drc_test_source, "TOP") +target($drc_test_target) + +sparse_array_limit(10.0) +if sparse_array_limit != 10.0 + raise("sparse array limit is not 10.0!") +end + +deep + +# can still set sparse_array_limit before the first input statement +self.sparse_array_limit = 5.0 +if self.sparse_array_limit != 5.0 + raise("sparse array limit is not 5.0!") +end + +l1 = input(1, 0) +l2 = input(2, 0) + +error = false +begin + self.sparse_array_limit = 2.0 +rescue + error = true +end +error || raise("sparse_array_limit must throw an exception after 'deep'") + +if @dss.sparse_array_limit != 5.0 + raise("sparse array limit of DSS is not 5.0!") +end + +l1.output(1, 0) +l2.output(2, 0) +l1.sized(1.um).output(11, 0) +l2.sized(1.um).output(12, 0) + diff --git a/testdata/drc/drcSimpleTests_148.gds b/testdata/drc/drcSimpleTests_148.gds new file mode 100644 index 000000000..a7c1821fd Binary files /dev/null and b/testdata/drc/drcSimpleTests_148.gds differ diff --git a/testdata/drc/drcSimpleTests_au148d.gds b/testdata/drc/drcSimpleTests_au148d.gds new file mode 100644 index 000000000..118962d23 Binary files /dev/null and b/testdata/drc/drcSimpleTests_au148d.gds differ