From 6955d7d0c71d7caf60d5219915b72ca585c62472 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 12 Mar 2023 00:26:18 +0100 Subject: [PATCH] Better handling of inputs in deep mode after manipulating the hierarchy of the input layout --- src/db/db/dbDeepShapeStore.cc | 11 +++++++---- src/db/db/dbDeepShapeStore.h | 4 ++-- src/drc/drc/built-in-macros/_drc_layer.rb | 3 --- src/drc/unit_tests/drcSimpleTests.cc | 10 ++++++++++ testdata/drc/drcSimpleTests_47b.drc | 23 ++++++++++++++++++++++ testdata/drc/drcSimpleTests_47b.gds | Bin 0 -> 194 bytes testdata/drc/drcSimpleTests_au47b.gds | Bin 0 -> 6724 bytes testdata/drc/drcSimpleTests_au47bd.gds | Bin 0 -> 10156 bytes 8 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 testdata/drc/drcSimpleTests_47b.drc create mode 100644 testdata/drc/drcSimpleTests_47b.gds create mode 100644 testdata/drc/drcSimpleTests_au47b.gds create mode 100644 testdata/drc/drcSimpleTests_au47bd.gds diff --git a/src/db/db/dbDeepShapeStore.cc b/src/db/db/dbDeepShapeStore.cc index 93c74ffba..bc9dc11d2 100644 --- a/src/db/db/dbDeepShapeStore.cc +++ b/src/db/db/dbDeepShapeStore.cc @@ -867,7 +867,9 @@ void DeepShapeStore::remove_ref (unsigned int layout, unsigned int layer) unsigned int DeepShapeStore::layout_for_iter (const db::RecursiveShapeIterator &si, const db::ICplxTrans &trans) { - layout_map_type::iterator l = m_layout_map.find (std::make_pair (si, trans)); + size_t gen_id = si.layout () ? si.layout ()->hier_generation_id () : 0; + + layout_map_type::iterator l = m_layout_map.find (std::make_pair (si, std::make_pair (gen_id, trans))); if (l == m_layout_map.end () || m_layouts[l->second] == 0) { unsigned int layout_index; @@ -886,7 +888,7 @@ DeepShapeStore::layout_for_iter (const db::RecursiveShapeIterator &si, const db: layout.dbu (si.layout ()->dbu () / trans.mag ()); } - m_layout_map[std::make_pair (si, trans)] = layout_index; + m_layout_map[std::make_pair (si, std::make_pair (gen_id, trans))] = layout_index; return layout_index; } else { @@ -896,7 +898,8 @@ DeepShapeStore::layout_for_iter (const db::RecursiveShapeIterator &si, const db: void DeepShapeStore::make_layout (unsigned int layout_index, const db::RecursiveShapeIterator &si, const db::ICplxTrans &trans) { - tl_assert (m_layout_map.find (std::make_pair (si, trans)) == m_layout_map.end ()); + size_t gen_id = si.layout () ? si.layout ()->hier_generation_id () : 0; + tl_assert (m_layout_map.find (std::make_pair (si, std::make_pair (gen_id, trans))) == m_layout_map.end ()); while (m_layouts.size () <= layout_index) { m_layouts.push_back (0); @@ -909,7 +912,7 @@ void DeepShapeStore::make_layout (unsigned int layout_index, const db::Recursive layout.dbu (si.layout ()->dbu () / trans.mag ()); } - m_layout_map[std::make_pair (si, trans)] = layout_index; + m_layout_map[std::make_pair (si, std::make_pair (gen_id, trans))] = layout_index; } DeepLayer DeepShapeStore::create_polygon_layer (const db::RecursiveShapeIterator &si, double max_area_ratio, size_t max_vertex_count, const db::ICplxTrans &trans) diff --git a/src/db/db/dbDeepShapeStore.h b/src/db/db/dbDeepShapeStore.h index be6e838c0..1f12063b5 100644 --- a/src/db/db/dbDeepShapeStore.h +++ b/src/db/db/dbDeepShapeStore.h @@ -298,7 +298,7 @@ private: struct DB_PUBLIC RecursiveShapeIteratorCompareForTargetHierarchy { - bool operator () (const std::pair &a, const std::pair &b) const + bool operator () (const std::pair > &a, const std::pair > &b) const { int cmp_iter = db::compare_iterators_with_respect_to_target_hierarchy (a.first, b.first); if (cmp_iter != 0) { @@ -865,7 +865,7 @@ private: void issue_variants (unsigned int layout, const std::map > &var_map); - typedef std::map, unsigned int, RecursiveShapeIteratorCompareForTargetHierarchy> layout_map_type; + typedef std::map >, unsigned int, RecursiveShapeIteratorCompareForTargetHierarchy> layout_map_type; // no copying DeepShapeStore (const DeepShapeStore &); diff --git a/src/drc/drc/built-in-macros/_drc_layer.rb b/src/drc/drc/built-in-macros/_drc_layer.rb index dd6297364..e434c9d1d 100644 --- a/src/drc/drc/built-in-macros/_drc_layer.rb +++ b/src/drc/drc/built-in-macros/_drc_layer.rb @@ -5148,9 +5148,6 @@ CODE m = with_left ? "fill_with_left" : "fill" - # generation of new cells not tested in deep mode - @deep && raise("#{m} command not supported in deep mode currently") - (@engine._output_layout && @engine._output_cell) || raise("#{m} command needs an output layout and output cell") source = @engine.source diff --git a/src/drc/unit_tests/drcSimpleTests.cc b/src/drc/unit_tests/drcSimpleTests.cc index 107aa58de..8b24c918d 100644 --- a/src/drc/unit_tests/drcSimpleTests.cc +++ b/src/drc/unit_tests/drcSimpleTests.cc @@ -1302,6 +1302,16 @@ TEST(47_fillWithOverlappingBoxesTiled) run_test (_this, "47", false); } +TEST(47b_fillWithUsingOutput) +{ + run_test (_this, "47b", false); +} + +TEST(47bd_fillWithUsingOutputDeep) +{ + run_test (_this, "47b", true); +} + TEST(48_drcWithFragments) { run_test (_this, "48", false); diff --git a/testdata/drc/drcSimpleTests_47b.drc b/testdata/drc/drcSimpleTests_47b.drc new file mode 100644 index 000000000..b20d4c81b --- /dev/null +++ b/testdata/drc/drcSimpleTests_47b.drc @@ -0,0 +1,23 @@ + +source $drc_test_source + +if $drc_test_deep + deep +end + +to_fill = input(1, 0) + +# Create a fill pattern with a 0.025x0.025 µm box at 2/0 +pattern = fill_pattern("FILL_CELL").shape(2, 0, box(0, 0, 0.025, 0.025)) + +# place every 25 nm +to_fill.fill(pattern, hstep(0.025), vstep(0.025)) + +# compute remaining parts +l2 = input(2, 0) +(to_fill - l2).output(100, 0) + +# we cannot use input(..) on the fill output if we use +# a separate target layout, so wo do this: +layout.layout.write($drc_test_target) + diff --git a/testdata/drc/drcSimpleTests_47b.gds b/testdata/drc/drcSimpleTests_47b.gds new file mode 100644 index 0000000000000000000000000000000000000000..89ba5d7df8048850913efba886054b60d5680a8e GIT binary patch literal 194 zcmZQzV_;&6V31*CVt>xS%)rCIz#zgPip*x|U n3=GUcK->bvFBlj&W&p*mL1@-hKs6I!`WRRQf!f%Cn1ulVL(CdR literal 0 HcmV?d00001 diff --git a/testdata/drc/drcSimpleTests_au47b.gds b/testdata/drc/drcSimpleTests_au47b.gds new file mode 100644 index 0000000000000000000000000000000000000000..d4dff937b9be3b5037091e9e0b98030b3c8118e8 GIT binary patch literal 6724 zcmb7}O>7la6vyw(o0+~~TY)wPNVWJ?)KF0B2Tcqj0ulQXg^*BP$cApv1+sySY+!?K zWJ5`;i2)K*H+Dlc0XL8s*uX~El#Og)191Txnppqm-2a^(n{e;g+I_jpT;T@vlZWuh42I=I)U0Tpbgp#+reP5` z+ceL@oP}vv9E-+WM)M-f6EF=EW)ICjVeWxxSWHG^K27sJ%(XBL6XptUE>tkP78Wdv znP|*@nuE^eH(?qU*P`Y#G&jRM2h%WNuBN#g=2tKci#ySnYiJ&XIS$h>VLnUqILslK zhQ)j|<{-@}=dy<|4HM?`G%vuMgK1dyM`ON7^E%9Fn1%^+h~{0GM_?M3!_kwT69OqjzoH^F+0mtna-8gnDfF<4jeGEA6n&^!R^7rYG1qtTeb z{FgQj8EuTgW1<~^E*?K4sHBX44jYGtr&Xs)4Y*w7rIY1q)jL!{I(T>Y92 z%?TQY4b5XT4HM=rp4&;7sGZ1^H5-~UGz=S>*Jv6xH1E(fY-rBYG)$Nu`ZI)D>7-Y% zY-kSCG;C<@q-ogD+)vZ6p?Q?1VMFs2O~ZuAY=V9ZPmwsch6(dsUX?4p5~A1BiYQE& zZ_~Vu+JgL!{<3Dme4XYa7|34eX=^4-_F%}$4jlzXN{dXGFZr0&I=}KP6DF&Dwbh?j z%Y@1LS$&Elg>9KISMq2N!@7l+VZ!XD`K@zZU&1s@m^#gZaUNGbUqaTEHvWuRUdCD8 zc6}~C;G8>+snC|i94*&H)`Zkxxx$F7-$N*CQ=b*o^Yx1RJ>d6SPW_+#%KlL?F@am8 zoHKMq8dE99gQ~8_1)?9&V+)kpA{|Gd9yhw3nsB6ll6@$#Z|T5f-%7;JAK-UVDr=6e zuqNuI^qJ@@Jy8X7bgJl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