From bd6f62013e3b3415179c4b3ee856a14052d94464 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 9 Nov 2025 11:30:00 +0100 Subject: [PATCH] Importing latest version of LStream package, bug fixes (mag instances, layer were duplicated) --- src/db/db/dbSaveLayoutOptions.cc | 16 +++++++++----- src/db/db/dbSaveLayoutOptions.h | 3 ++- .../lstream/db_plugin/lstrCompressed.cc | 15 +++++++++++-- .../streamers/lstream/db_plugin/lstrWriter.cc | 22 +++++++++++++++++-- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/src/db/db/dbSaveLayoutOptions.cc b/src/db/db/dbSaveLayoutOptions.cc index a7f990a67..3bdfdbf7c 100644 --- a/src/db/db/dbSaveLayoutOptions.cc +++ b/src/db/db/dbSaveLayoutOptions.cc @@ -275,9 +275,15 @@ SaveLayoutOptions::get_valid_layers (const db::Layout &layout, std::vector >::const_iterator l = all_layers.begin (); l != all_layers.end (); ++l) { + for (auto l = all_layers.begin (); l != all_layers.end (); ++l) { + layers.push_back (*l); + } + + } else if (lm == LP_OnlyNumbered) { + + for (auto l = all_layers.begin (); l != all_layers.end (); ++l) { if (l->second.layer >= 0 && l->second.datatype >= 0) { layers.push_back (*l); } @@ -285,7 +291,7 @@ SaveLayoutOptions::get_valid_layers (const db::Layout &layout, std::vector >::const_iterator l = all_layers.begin (); l != all_layers.end (); ++l) { + for (auto l = all_layers.begin (); l != all_layers.end (); ++l) { if (! l->second.name.empty ()) { layers.push_back (*l); } @@ -293,7 +299,7 @@ SaveLayoutOptions::get_valid_layers (const db::Layout &layout, std::vector >::const_iterator l = all_layers.begin (); l != all_layers.end (); ++l) { + for (auto l = all_layers.begin (); l != all_layers.end (); ++l) { layers.push_back (*l); if (l->second.name.empty ()) { layers.back ().second = tl::sprintf ("L%dD%d", l->second.layer, l->second.datatype); @@ -304,7 +310,7 @@ SaveLayoutOptions::get_valid_layers (const db::Layout &layout, std::vector >::const_iterator l = all_layers.begin (); l != all_layers.end (); ++l) { + for (auto l = all_layers.begin (); l != all_layers.end (); ++l) { layers.push_back (*l); if (l->second.name.empty ()) { layers.back ().second = tl::sprintf ("L%dD%d", l->second.layer, l->second.datatype); diff --git a/src/db/db/dbSaveLayoutOptions.h b/src/db/db/dbSaveLayoutOptions.h index 9916cf4c0..2279cb850 100644 --- a/src/db/db/dbSaveLayoutOptions.h +++ b/src/db/db/dbSaveLayoutOptions.h @@ -405,7 +405,8 @@ public: LP_OnlyNamed = 1, LP_AssignName = 2, LP_AssignNameWithPriority = 3, - LP_AssignNumber = 4 + LP_AssignNumber = 4, + LP_AsIs = 5 }; /** diff --git a/src/plugins/streamers/lstream/db_plugin/lstrCompressed.cc b/src/plugins/streamers/lstream/db_plugin/lstrCompressed.cc index f9fc5bcd8..09cb75aba 100644 --- a/src/plugins/streamers/lstream/db_plugin/lstrCompressed.cc +++ b/src/plugins/streamers/lstream/db_plugin/lstrCompressed.cc @@ -484,7 +484,12 @@ Compressed::compress_instances (const db::Cell::const_iterator &begin_instances, disp = create_repetition_from_array (&inst_array, array, irregular_array); } - db::CellInstArray single_inst (inst_array.object (), db::Trans (-disp) * inst_array.front ()); + db::CellInstArray single_inst; + if (! inst_array.is_complex ()) { + single_inst = db::CellInstArray (inst_array.object (), db::Trans (-disp) * inst_array.front ()); + } else { + single_inst = db::CellInstArray (inst_array.object (), inst_array.complex_trans (db::Trans (-disp) * inst_array.front ())); + } // no compression -> just keep as is if (prop_id != 0) { @@ -499,7 +504,13 @@ Compressed::compress_instances (const db::Cell::const_iterator &begin_instances, // As we configured the compressor with level 0, no regular array formation will happen here. This is // good for instances as array instances are special. db::Vector disp = inst_array.front ().disp (); - db::CellInstArray single_inst (inst_array.object (), db::Trans (-disp) * inst_array.front ()); + + db::CellInstArray single_inst; + if (! inst_array.is_complex ()) { + single_inst = db::CellInstArray (inst_array.object (), db::Trans (-disp) * inst_array.front ()); + } else { + single_inst = db::CellInstArray (inst_array.object (), inst_array.complex_trans (db::Trans (-disp) * inst_array.front ())); + } if (prop_id != 0) { inst_with_properties_compressor.add (db::CellInstArrayWithProperties (single_inst, prop_id), disp); diff --git a/src/plugins/streamers/lstream/db_plugin/lstrWriter.cc b/src/plugins/streamers/lstream/db_plugin/lstrWriter.cc index 2db530382..6ff965c42 100644 --- a/src/plugins/streamers/lstream/db_plugin/lstrWriter.cc +++ b/src/plugins/streamers/lstream/db_plugin/lstrWriter.cc @@ -111,8 +111,26 @@ Writer::write (db::Layout &layout, tl::OutputStream &stream, const db::SaveLayou m_meta_data_view_id = -1; m_layers_to_write.clear (); - options.get_valid_layers (layout, m_layers_to_write, db::SaveLayoutOptions::LP_OnlyNumbered); - options.get_valid_layers (layout, m_layers_to_write, db::SaveLayoutOptions::LP_OnlyNamed); + +#if KLAYOUT_MAJOR_VERSION == 0 && (KLAYOUT_MINOR_VERSION < 30 || (KLAYOUT_MINOR_VERSION == 30 && KLAYOUT_TINY_VERSION < 5)) + { + options.get_valid_layers (layout, m_layers_to_write, db::SaveLayoutOptions::LP_OnlyNumbered); + options.get_valid_layers (layout, m_layers_to_write, db::SaveLayoutOptions::LP_OnlyNamed); + + // clean up layer duplicates - see TODO above + auto lw = m_layers_to_write.begin (); + std::set lseen; + for (auto l = m_layers_to_write.begin (); l != m_layers_to_write.end (); ++l) { + if (lseen.find (l->first) == lseen.end ()) { + *lw++ = *l; + lseen.insert (l->first); + } + } + m_layers_to_write.erase (lw, m_layers_to_write.end ()); + } +#else + options.get_valid_layers (layout, m_layers_to_write, db::SaveLayoutOptions::LP_AsIs); +#endif m_cells_to_write.clear (); options.get_cells (layout, m_cells_to_write, m_layers_to_write);