From 51a1a2627f142049a91618ab4edea2d6992256f4 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 18 May 2024 18:37:52 +0200 Subject: [PATCH] Fix for issue-1710 (feature request: create separate cell for def FILL) --- .../lefdef/db_plugin/dbDEFImporter.cc | 27 ++++++++++++++---- .../lefdef/db_plugin/dbDEFImporter.h | 2 ++ .../lefdef/unit_tests/dbLEFDEFImportTests.cc | 2 +- testdata/lefdef/fill/simple_au.oas.gz | Bin 545 -> 533 bytes testdata/lefdef/fill/with_mask_au.oas.gz | Bin 557 -> 538 bytes 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc index 4a35ba4c9..459a3224e 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc @@ -822,7 +822,7 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool std::string net = get (); std::string nondefaultrule; std::string stored_netname, stored_nondefaultrule; - db::properties_id_type stored_prop_id; + db::properties_id_type stored_prop_id = 0; bool in_subnet = false; db::properties_id_type prop_id = 0; @@ -1421,10 +1421,26 @@ DEFImporter::read_pins (db::Layout &layout, db::Cell &design, double scale) } } +db::Cell & +DEFImporter::ensure_fill_cell (db::Layout &layout, db::Cell &design, db::Cell *&fill_cell) +{ + if (! fill_cell) { + + std::string fill_cell_name = m_design_name + "_DEF_FILL"; + fill_cell = &layout.cell (reader_state ()->make_cell (layout, fill_cell_name)); + + design.insert (db::CellInstArray (fill_cell->cell_index (), db::Trans ())); + + } + + return *fill_cell; +} + void DEFImporter::read_fills (db::Layout &layout, db::Cell &design, double scale) { std::map , std::vector > geometry; + db::Cell *fill_cell = 0; while (test ("-")) { @@ -1495,7 +1511,7 @@ DEFImporter::read_fills (db::Layout &layout, db::Cell &design, double scale) if (! dl.empty ()) { for (std::vector::const_iterator p = polygons.begin (); p != polygons.end (); ++p) { for (std::set::const_iterator l = dl.begin (); l != dl.end (); ++l) { - design.shapes (*l).insert (*p); + ensure_fill_cell (layout, design, fill_cell).shapes (*l).insert (*p); } } } @@ -1535,7 +1551,7 @@ DEFImporter::read_fills (db::Layout &layout, db::Cell &design, double scale) std::string nondefaultrule; db::Cell *cell = reader_state ()->via_cell (vn, nondefaultrule, layout, mask_bottom, mask_cut, mask_top, &m_lef_importer); if (cell) { - design.insert (db::CellInstArray (db::CellInst (cell->cell_index ()), db::Trans (pt))); + ensure_fill_cell (layout, design, fill_cell).insert (db::CellInstArray (db::CellInst (cell->cell_index ()), db::Trans (pt))); } } else { warn (tl::to_string (tr ("Invalid via name: ")) + vn); @@ -1670,6 +1686,7 @@ DEFImporter::do_read (db::Layout &layout) m_via_desc = m_lef_importer.vias (); m_styles.clear (); + m_design_name.clear (); db::Cell &design = layout.cell (reader_state ()->make_cell (layout, top_id)); @@ -1685,8 +1702,8 @@ DEFImporter::do_read (db::Layout &layout) } else if (test ("DESIGN")) { - std::string cn = get (); - reader_state ()->rename_cell (layout, top_id, cn); + m_design_name = get (); + reader_state ()->rename_cell (layout, top_id, m_design_name); expect (";"); diff --git a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.h b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.h index 43772e26b..45a42f60f 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.h +++ b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.h @@ -72,6 +72,7 @@ private: std::map m_via_desc; std::map m_styles; std::vector m_component_maskshift; + std::string m_design_name; void read_polygon (db::Polygon &poly, double scale); void read_rect (db::Polygon &poly, double scale); @@ -86,6 +87,7 @@ private: void read_vias (db::Layout &layout, db::Cell &design, double scale); void read_pins (db::Layout &layout, db::Cell &design, double scale); void read_fills (db::Layout &layout, db::Cell &design, double scale); + db::Cell &ensure_fill_cell (db::Layout &layout, db::Cell &design, db::Cell *&fill_cell); void read_styles (double scale); void read_components (Layout &layout, std::list > &instances, double scale); void read_single_net (std::string &nondefaultrule, db::Layout &layout, db::Cell &design, double scale, properties_id_type prop_id, bool specialnets); diff --git a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc index 6646fbe6d..94f92050c 100644 --- a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc +++ b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc @@ -429,7 +429,7 @@ TEST(def16) // (complete example) db::LEFDEFReaderOptions opt = default_options (); opt.set_macro_resolution_mode (1); - run_test (_this, "def16", "lef:a.lef+lef:tech.lef+def:a.def", "au_4.oas.gz", opt); + run_test (_this, "def16", "lef:a.lef+lef:tech.lef+def:a.def", "au_4b.oas.gz", opt); } TEST(100) diff --git a/testdata/lefdef/fill/simple_au.oas.gz b/testdata/lefdef/fill/simple_au.oas.gz index c6ca9c9eb9a987510b7f66b6ac6786a01fe4dbc6..8ff171590f28f00cf4c9ea2070b7917517d92a51 100644 GIT binary patch delta 243 zcmZ3;GL>b5Xg#BhI1>kp3_r7sI14|65<{v_?ip*Y1_J@s14WJ(m^-EmZtiUSb0Ru$ zb@~5jj$2XuJv|SWX>P3IH=TLl!GUYpm-DutNr=-|YFpH|aR%F4o5h=Br=9Qnw3<0% z>)xNtoGc}&#U)A%c@~e;zVq{b{P?9f)h{vaf#b7+&A+8y?W|P(^~0dp(D;)=af6YY zKp%&(FuzgzZ0=JZ`3u-S&8)oegMpWE;zt7;UIxJfj3UV?3=8CMm@$J*l@Vv)c+SYo r3$h{J#nmm|&C|yRB)FB4iSY{~BLkx{V=-eTBg14v#&;|Y4Gatb=6YJ$ literal 545 zcmY!lcJ=kt^>+;R4CduxWH!_@V0gjKfDB|rrGn#q9V6m{J>C6WUE)3cLR{TlgW|(I zT|zuKSY&u*Akv|J*c8Z!as|hS_y@#0yZZR>u#}`0moS4#Zg&6B5FbxJSLPIE1|DP% zH@mN)o|~tS4>K1tBM&kMC}RYX5n*Nm${;x0Tu_dGfHSiQGcykwpO---IfY??{0%cv zdoD&srUmjZ*e~!ekmqJNA}l1TEyBdY+)>+5+gAI6T~q@iy+B@6i1~vaQ^QCG3=9BO C5xwI8 diff --git a/testdata/lefdef/fill/with_mask_au.oas.gz b/testdata/lefdef/fill/with_mask_au.oas.gz index 946e28973695b10e059f9b780053048df697f9f8..8c854748fe19474aa994df4af718b68ecd8e3544 100644 GIT binary patch delta 246 zcmZ3>GK*z`Xg#BhI1>kp3_r7sI14|65<{v_?ip*Y1_J@s14WJ(m^-EmZtiUSb0Ru$ zb@~5jj$2XuJv|SWX>P3IH=TLl!GUYpm-DutNr=-|YFpH|aR%F4o5h=Br=9Qnw3<0% z>)xNtoGc}&#U)A%Rkn}QzVq{b{P?9f)h{vaf#b7+;$Kp)c2;Wq`Vk>%RBUMcX+crr zCO3g~f}1&vh55Cn&t^aMmA`+;R4CduxWH!_@V0gjKfDB|rrGn#q9V6m{J>C6WUE)3cLR{TlgW|(I zT|zuKSY&u*Akv|J*c8Z!as|hS_y@#0yZZR>u#}`0moS4#Zg&6B5FbxJSLPIE1|DP% zH>auV86h>K%Sf7h_H~Twg?job4P7MZCmXNc2Nz8^a6QNA?6QyObsI$ HFfafB=6S$%