diff --git a/src/db/db/dbAsIfFlatRegion.cc b/src/db/db/dbAsIfFlatRegion.cc index f05e76fcd..339af0235 100644 --- a/src/db/db/dbAsIfFlatRegion.cc +++ b/src/db/db/dbAsIfFlatRegion.cc @@ -1879,7 +1879,7 @@ AsIfFlatRegion::add (const Region &other) const } static void -deliver_shapes_of_nets_recursive (db::Shapes &out, const db::Circuit *circuit, const LayoutToNetlist *l2n, const db::Region *of_layer, NetPropertyMode prop_mode, const tl::Variant &net_prop_name, const db::ICplxTrans &tr, const std::set *net_filter) +deliver_shapes_of_nets_recursive (db::Shapes &out, const db::Circuit *circuit, const LayoutToNetlist *l2n, unsigned int lid, NetPropertyMode prop_mode, const tl::Variant &net_prop_name, const db::ICplxTrans &tr, const std::set *net_filter) { db::CplxTrans dbu_trans (l2n->internal_layout ()->dbu ()); auto dbu_trans_inv = dbu_trans.inverted (); @@ -1888,14 +1888,14 @@ deliver_shapes_of_nets_recursive (db::Shapes &out, const db::Circuit *circuit, c if (! net_filter || net_filter->find (n.operator-> ()) != net_filter->end ()) { db::properties_id_type prop_id = db::NetBuilder::make_netname_propid (prop_mode, net_prop_name, *n); - l2n->shapes_of_net (*n, *of_layer, true, out, prop_id, tr); + l2n->shapes_of_net (*n, lid, true, out, prop_id, tr); } // dive into subcircuits for (auto sc = circuit->begin_subcircuits (); sc != circuit->end_subcircuits (); ++sc) { const db::Circuit *circuit_ref = sc->circuit_ref (); db::ICplxTrans tr_ref = tr * (dbu_trans_inv * sc->trans () * dbu_trans); - deliver_shapes_of_nets_recursive (out, circuit_ref, l2n, of_layer, prop_mode, net_prop_name, tr_ref, net_filter); + deliver_shapes_of_nets_recursive (out, circuit_ref, l2n, lid, prop_mode, net_prop_name, tr_ref, net_filter); } } @@ -1909,9 +1909,9 @@ AsIfFlatRegion::nets (LayoutToNetlist *l2n, NetPropertyMode prop_mode, const tl: } std::unique_ptr result (new db::FlatRegion ()); - std::unique_ptr region_for_layer (l2n->layer_by_original (this)); + tl::optional li = l2n->layer_by_original (this); - if (! region_for_layer) { + if (! li.has_value ()) { throw tl::Exception (tl::to_string (tr ("The given layer is not an original layer used in netlist extraction"))); } @@ -1927,7 +1927,7 @@ AsIfFlatRegion::nets (LayoutToNetlist *l2n, NetPropertyMode prop_mode, const tl: net_filter_set.insert (net_filter->begin (), net_filter->end ()); } - deliver_shapes_of_nets_recursive (result->raw_polygons (), top_circuit, l2n, region_for_layer.get (), prop_mode, net_prop_name, db::ICplxTrans (), net_filter ? &net_filter_set : 0); + deliver_shapes_of_nets_recursive (result->raw_polygons (), top_circuit, l2n, li.value (), prop_mode, net_prop_name, db::ICplxTrans (), net_filter ? &net_filter_set : 0); return result.release (); } diff --git a/src/db/db/dbDeepRegion.cc b/src/db/db/dbDeepRegion.cc index 3bce3d9f0..a86e2ef4a 100644 --- a/src/db/db/dbDeepRegion.cc +++ b/src/db/db/dbDeepRegion.cc @@ -757,13 +757,13 @@ DeepRegion::nets (LayoutToNetlist *l2n, NetPropertyMode prop_mode, const tl::Var DeepLayer result = deep_layer ().derived (); - std::unique_ptr region_for_layer (l2n->layer_by_original (this)); - if (! region_for_layer) { + tl::optional li = l2n->layer_by_original (this); + if (! li.has_value ()) { throw tl::Exception (tl::to_string (tr ("The given layer is not an original layer used in netlist extraction"))); } - std::map lmap; - lmap.insert (std::make_pair (result.layer (), region_for_layer.get ())); + std::map lmap; + lmap.insert (std::make_pair (result.layer (), li.value ())); net_builder.build_nets (nets, lmap, prop_mode, net_prop_name); diff --git a/src/db/db/dbLayoutToNetlist.cc b/src/db/db/dbLayoutToNetlist.cc index 802133935..3c5e06d0c 100644 --- a/src/db/db/dbLayoutToNetlist.cc +++ b/src/db/db/dbLayoutToNetlist.cc @@ -93,7 +93,7 @@ LayoutToNetlist::LayoutToNetlist () LayoutToNetlist::~LayoutToNetlist () { // NOTE: do this in this order because of unregistration of the layers - m_named_regions.clear (); + m_named_dls.clear (); m_dlrefs.clear (); mp_internal_dss.reset (0); mp_netlist.reset (0); @@ -175,6 +175,16 @@ db::Region *LayoutToNetlist::make_layer (unsigned int layer_index, const std::st return region.release (); } +db::Texts *LayoutToNetlist::make_text_layer (const std::string &n) +{ + db::RecursiveShapeIterator si (m_iter); + si.shape_flags (db::ShapeIterator::Nothing); + + std::unique_ptr texts (new db::Texts (si, dss ())); + register_layer (*texts, n); + return texts.release (); +} + db::Texts *LayoutToNetlist::make_text_layer (unsigned int layer_index, const std::string &n) { db::RecursiveShapeIterator si (m_iter); @@ -190,7 +200,7 @@ db::Region *LayoutToNetlist::make_polygon_layer (unsigned int layer_index, const { db::RecursiveShapeIterator si (m_iter); si.set_layer (layer_index); - si.shape_flags (db::ShapeIterator::Paths | db::ShapeIterator::Polygons | db::ShapeIterator::Boxes); + si.shape_flags (db::ShapeIterator::Regions); std::unique_ptr region (new db::Region (si, dss ())); register_layer (*region, n); @@ -850,10 +860,10 @@ void LayoutToNetlist::mem_stat (MemStatistics *stat, MemStatistics::purpose_t pu db::mem_stat (stat, purpose, cat, m_net_clusters, true, (void *) this); db::mem_stat (stat, purpose, cat, mp_netlist, true, (void *) this); db::mem_stat (stat, purpose, cat, m_dlrefs, true, (void *) this); - db::mem_stat (stat, purpose, cat, m_named_regions, true, (void *) this); + db::mem_stat (stat, purpose, cat, m_named_dls, true, (void *) this); db::mem_stat (stat, purpose, cat, m_name_of_layer, true, (void *) this); - db::mem_stat (stat, purpose, cat, m_region_by_original, true, (void *) this); - db::mem_stat (stat, purpose, cat, m_region_of_layer, true, (void *) this); + db::mem_stat (stat, purpose, cat, m_dl_by_original, true, (void *) this); + db::mem_stat (stat, purpose, cat, m_dl_of_layer, true, (void *) this); db::mem_stat (stat, purpose, cat, m_joined_net_names, true, (void *) this); db::mem_stat (stat, purpose, cat, m_joined_net_names_per_cell, true, (void *) this); db::mem_stat (stat, purpose, cat, m_joined_nets, true, (void *) this); @@ -899,6 +909,26 @@ db::Cell *LayoutToNetlist::internal_top_cell () return &dss ().initial_cell (m_layout_index); } +const db::Layout *LayoutToNetlist::original_layout () const +{ + return m_iter.layout (); +} + +const db::Cell *LayoutToNetlist::original_top_cell () const +{ + return m_iter.top_cell (); +} + +db::Layout *LayoutToNetlist::original_layout () +{ + return const_cast (m_iter.layout ()); +} + +db::Cell *LayoutToNetlist::original_top_cell () +{ + return const_cast (m_iter.top_cell ()); +} + void LayoutToNetlist::ensure_layout () const { if (! dss ().is_valid_layout_index (m_layout_index)) { @@ -927,7 +957,7 @@ std::string LayoutToNetlist::make_new_name (const std::string &stem) name += std::string ("$"); name += tl::to_string (n - m); - if (m_named_regions.find (name) == m_named_regions.end ()) { + if (m_named_dls.find (name) == m_named_dls.end ()) { n -= m; } @@ -948,39 +978,69 @@ std::string LayoutToNetlist::name (unsigned int l) const db::Region *LayoutToNetlist::layer_by_name (const std::string &name) { - std::map::const_iterator l = m_named_regions.find (name); - if (l == m_named_regions.end ()) { + std::map::const_iterator l = m_named_dls.find (name); + if (l == m_named_dls.end ()) { return 0; } else { return new db::Region (new db::DeepRegion (l->second)); } } +db::Texts *LayoutToNetlist::texts_by_name (const std::string &name) +{ + std::map::const_iterator l = m_named_dls.find (name); + if (l == m_named_dls.end ()) { + return 0; + } else { + return new db::Texts (new db::DeepTexts (l->second)); + } +} + +tl::optional LayoutToNetlist::layer_index_by_name (const std::string &name) const +{ + std::map::const_iterator l = m_named_dls.find (name); + if (l == m_named_dls.end ()) { + return tl::optional (); + } else { + return tl::optional (l->second.layer ()); + } +} + db::Region *LayoutToNetlist::layer_by_index (unsigned int index) { - auto n = m_region_of_layer.find (index); - if (n == m_region_of_layer.end ()) { + auto n = m_dl_of_layer.find (index); + if (n == m_dl_of_layer.end ()) { return 0; } else { return new db::Region (new db::DeepRegion (n->second)); } } -db::Region *LayoutToNetlist::layer_by_original (const ShapeCollectionDelegateBase *original_delegate) +db::Texts *LayoutToNetlist::texts_by_index (unsigned int index) { - auto n = m_region_by_original.find (tl::id_of (original_delegate)); - if (n == m_region_by_original.end ()) { + auto n = m_dl_of_layer.find (index); + if (n == m_dl_of_layer.end ()) { + return 0; + } else { + return new db::Texts (new db::DeepTexts (n->second)); + } +} + +tl::optional LayoutToNetlist::layer_by_original (const ShapeCollectionDelegateBase *original_delegate) +{ + auto n = m_dl_by_original.find (tl::id_of (original_delegate)); + if (n == m_dl_by_original.end ()) { DeepShapeCollectionDelegateBase *dl = const_cast (original_delegate)->deep (); if (dl && dl->deep_layer ().store () == mp_dss.get ()) { // implicitly original because the collection is inside our DSS - return new db::Region (new db::DeepRegion (dl->deep_layer ())); + return tl::optional (dl->deep_layer ().layer ()); } else { - return 0; + return tl::optional (); } } else { - return new db::Region (new db::DeepRegion (n->second)); + return tl::optional (n->second.layer ()); } } @@ -1009,11 +1069,11 @@ std::string LayoutToNetlist::name (const ShapeCollection &coll) const unsigned int LayoutToNetlist::register_layer (const ShapeCollection &collection, const std::string &n_in) { - if (m_region_by_original.find (tl::id_of (collection.get_delegate ())) != m_region_by_original.end ()) { + if (m_dl_by_original.find (tl::id_of (collection.get_delegate ())) != m_dl_by_original.end ()) { throw tl::Exception (tl::to_string (tr ("The layer is already registered"))); } - if (! n_in.empty () && m_named_regions.find (n_in) != m_named_regions.end ()) { + if (! n_in.empty () && m_named_dls.find (n_in) != m_named_dls.end ()) { throw tl::Exception (tl::to_string (tr ("Layer name is already used: ")) + n_in); } @@ -1043,9 +1103,9 @@ unsigned int LayoutToNetlist::register_layer (const ShapeCollection &collection, unsigned int layer = dl.layer (); - m_region_by_original [tl::id_of (collection.get_delegate ())] = dl; - m_region_of_layer [layer] = dl; - m_named_regions [n] = dl; + m_dl_by_original [tl::id_of (collection.get_delegate ())] = dl; + m_dl_of_layer [layer] = dl; + m_named_dls [n] = dl; m_name_of_layer [layer] = n; return layer; @@ -1075,7 +1135,7 @@ bool LayoutToNetlist::is_persisted_impl (const db::ShapeCollection &coll) const return true; } else { // explicitly persisted through "register" - return m_region_by_original.find (tl::id_of (coll.get_delegate ())) != m_region_by_original.end (); + return m_dl_by_original.find (tl::id_of (coll.get_delegate ())) != m_dl_by_original.end (); } } @@ -1126,10 +1186,10 @@ db::CellMapping LayoutToNetlist::const_cell_mapping_into (const db::Layout &layo return cm; } -std::map +std::map LayoutToNetlist::create_layermap (db::Layout &target_layout, int ln) const { - std::map lm; + std::map lm; if (! internal_layout ()) { return lm; } @@ -1144,13 +1204,13 @@ LayoutToNetlist::create_layermap (db::Layout &target_layout, int ln) const for (std::set::const_iterator l = layers_to_copy.begin (); l != layers_to_copy.end (); ++l) { const db::LayerProperties &lp = source_layout.get_properties (*l); - unsigned int tl; if (! lp.is_null ()) { - tl = target_layout.insert_layer (lp); - } else { - tl = target_layout.insert_layer (db::LayerProperties (ln++, 0, name (*l))); + unsigned int tl = target_layout.insert_layer (lp); + lm.insert (std::make_pair (tl, *l)); + } else if (ln >= 0) { + unsigned int tl = target_layout.insert_layer (db::LayerProperties (ln++, 0, name (*l))); + lm.insert (std::make_pair (tl, *l)); } - lm.insert (std::make_pair (tl, const_cast (this)->layer_by_index (*l))); } return lm; @@ -1179,16 +1239,43 @@ static bool deliver_shape (const db::NetShape &, StopOnFirst, const Tr &, db::pr } template -static bool deliver_shape (const db::NetShape &s, db::Region ®ion, const Tr &tr, db::properties_id_type /*propid*/) +static bool deliver_shape (const db::NetShape &s, db::Region ®ion, const Tr &tr, db::properties_id_type propid) { if (s.type () == db::NetShape::Polygon) { db::PolygonRef pr = s.polygon_ref (); if (pr.obj ().is_box ()) { - region.insert (pr.obj ().box ().transformed (pr.trans ()).transformed (tr)); + if (propid) { + region.insert (db::BoxWithProperties (pr.obj ().box ().transformed (pr.trans ()).transformed (tr), propid)); + } else { + region.insert (pr.obj ().box ().transformed (pr.trans ()).transformed (tr)); + } } else { - region.insert (pr.obj ().transformed (pr.trans ()).transformed (tr)); + if (propid) { + region.insert (db::PolygonWithProperties (pr.obj ().transformed (pr.trans ()).transformed (tr), propid)); + } else { + region.insert (pr.obj ().transformed (pr.trans ()).transformed (tr)); + } + } + + } + + return true; +} + +template +static bool deliver_shape (const db::NetShape &s, db::Texts &texts, const Tr &tr, db::properties_id_type propid) +{ + if (s.type () == db::NetShape::Text) { + + db::TextRef pr = s.text_ref (); + + db::Text text (pr.obj ().transformed (pr.trans ()).transformed (tr)); + if (propid) { + texts.insert (db::TextWithProperties (text, propid)); + } else { + texts.insert (text); } } @@ -1407,9 +1494,14 @@ LayoutToNetlist::shapes_of_terminal (const db::NetTerminalRef &terminal, const d return result; } -void LayoutToNetlist::shapes_of_net (const db::Net &net, const db::Region &of_layer, bool recursive, db::Shapes &to, db::properties_id_type propid, const ICplxTrans &trans) const +void LayoutToNetlist::shapes_of_net (const db::Net &net, const db::ShapeCollection &of_layer, bool recursive, db::Shapes &to, db::properties_id_type propid, const ICplxTrans &trans) const { unsigned int lid = layer_of (of_layer); + shapes_of_net (net, lid, recursive, to, propid, trans); +} + +void LayoutToNetlist::shapes_of_net (const db::Net &net, unsigned int lid, bool recursive, db::Shapes &to, db::properties_id_type propid, const ICplxTrans &trans) const +{ const db::Circuit *circuit = net.circuit (); tl_assert (circuit != 0); @@ -1419,14 +1511,14 @@ void LayoutToNetlist::shapes_of_net (const db::Net &net, const db::Region &of_la deliver_shapes_of_net (recursive, mp_netlist.get (), m_net_clusters, circuit->cell_index (), net.cluster_id (), lmap, trans, propid); } -db::Region *LayoutToNetlist::shapes_of_net (const db::Net &net, const db::Region &of_layer, bool recursive, const db::ICplxTrans &trans) const +template +Coll *LayoutToNetlist::shapes_of_net_with_layer_index (const db::Net &net, unsigned int lid, bool recursive, const db::ICplxTrans &trans) const { - unsigned int lid = layer_of (of_layer); const db::Circuit *circuit = net.circuit (); tl_assert (circuit != 0); - std::unique_ptr res (new db::Region ()); - std::map lmap; + std::unique_ptr res (new Coll ()); + std::map lmap; lmap [lid] = res.get (); deliver_shapes_of_net (recursive, mp_netlist.get (), m_net_clusters, circuit->cell_index (), net.cluster_id (), lmap, trans, 0); @@ -1434,8 +1526,14 @@ db::Region *LayoutToNetlist::shapes_of_net (const db::Net &net, const db::Region return res.release (); } +// explicit instantiations +template +DB_PUBLIC db::Region *LayoutToNetlist::shapes_of_net_with_layer_index (const db::Net &net, unsigned int lid, bool recursive, const db::ICplxTrans &trans) const; +template +DB_PUBLIC db::Texts *LayoutToNetlist::shapes_of_net_with_layer_index (const db::Net &net, unsigned int lid, bool recursive, const db::ICplxTrans &trans) const; + void -LayoutToNetlist::build_net (const db::Net &net, db::Layout &target, db::Cell &target_cell, const std::map &lmap, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *cell_name_prefix, const char *device_cell_name_prefix) const +LayoutToNetlist::build_net (const db::Net &net, db::Layout &target, db::Cell &target_cell, const std::map &lmap, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *cell_name_prefix, const char *device_cell_name_prefix) const { NetBuilder builder (&target, this); builder.set_hier_mode (hier_mode); @@ -1446,7 +1544,7 @@ LayoutToNetlist::build_net (const db::Net &net, db::Layout &target, db::Cell &ta } void -LayoutToNetlist::build_all_nets (const db::CellMapping &cmap, db::Layout &target, const std::map &lmap, const char *net_cell_name_prefix, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *circuit_cell_name_prefix, const char *device_cell_name_prefix) const +LayoutToNetlist::build_all_nets (const db::CellMapping &cmap, db::Layout &target, const std::map &lmap, const char *net_cell_name_prefix, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *circuit_cell_name_prefix, const char *device_cell_name_prefix) const { NetBuilder builder (&target, cmap, this); builder.set_hier_mode (hier_mode); @@ -1458,7 +1556,7 @@ LayoutToNetlist::build_all_nets (const db::CellMapping &cmap, db::Layout &target } void -LayoutToNetlist::build_nets (const std::vector *nets, const db::CellMapping &cmap, db::Layout &target, const std::map &lmap, const char *net_cell_name_prefix, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *circuit_cell_name_prefix, const char *device_cell_name_prefix) const +LayoutToNetlist::build_nets (const std::vector *nets, const db::CellMapping &cmap, db::Layout &target, const std::map &lmap, const char *net_cell_name_prefix, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *circuit_cell_name_prefix, const char *device_cell_name_prefix) const { NetBuilder builder (&target, cmap, this); builder.set_hier_mode (hier_mode); @@ -2152,7 +2250,7 @@ NetBuilder::prepare_build_nets () const } void -NetBuilder::build_net (db::Cell &target_cell, const db::Net &net, const std::map &lmap, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop) const +NetBuilder::build_net (db::Cell &target_cell, const db::Net &net, const std::map &lmap, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop) const { prepare_build_nets (); @@ -2163,13 +2261,13 @@ NetBuilder::build_net (db::Cell &target_cell, const db::Net &net, const std::map } void -NetBuilder::build_all_nets (const std::map &lmap, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop) const +NetBuilder::build_all_nets (const std::map &lmap, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop) const { build_nets (0, lmap, net_prop_mode, netname_prop); } void -NetBuilder::build_nets (const std::vector *nets, const std::map &lmap, NetPropertyMode prop_mode, const tl::Variant &netname_prop) const +NetBuilder::build_nets (const std::vector *nets, const std::map &lmap, NetPropertyMode prop_mode, const tl::Variant &netname_prop) const { prepare_build_nets (); @@ -2239,7 +2337,7 @@ NetBuilder::build_nets (const std::vector *nets, const std::map &lmap, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const db::ICplxTrans &tr) const +NetBuilder::build_net_rec (const db::Net &net, db::Cell &target_cell, const std::map &lmap, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const db::ICplxTrans &tr) const { const db::Circuit *circuit = net.circuit (); tl_assert (circuit != 0); @@ -2248,7 +2346,7 @@ NetBuilder::build_net_rec (const db::Net &net, db::Cell &target_cell, const std: } void -NetBuilder::build_net_rec (db::cell_index_type ci, size_t cid, db::Cell &tc, const std::map &lmap, const db::Net *net, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const db::ICplxTrans &tr) const +NetBuilder::build_net_rec (db::cell_index_type ci, size_t cid, db::Cell &tc, const std::map &lmap, const db::Net *net, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const db::ICplxTrans &tr) const { db::Cell *target_cell = &tc; @@ -2261,9 +2359,9 @@ NetBuilder::build_net_rec (db::cell_index_type ci, size_t cid, db::Cell &tc, con StopOnFirst sof; std::map sof_lmap; - for (std::map::const_iterator l = lmap.begin (); l != lmap.end (); ++l) { + for (std::map::const_iterator l = lmap.begin (); l != lmap.end (); ++l) { if (l->second) { - sof_lmap.insert (std::make_pair (mp_source->layer_of (*l->second), &sof)); + sof_lmap.insert (std::make_pair (l->second, &sof)); } } @@ -2283,9 +2381,9 @@ NetBuilder::build_net_rec (db::cell_index_type ci, size_t cid, db::Cell &tc, con } std::map target_lmap; - for (std::map::const_iterator l = lmap.begin (); l != lmap.end (); ++l) { + for (std::map::const_iterator l = lmap.begin (); l != lmap.end (); ++l) { if (l->second) { - target_lmap.insert (std::make_pair (mp_source->layer_of (*l->second), &target_cell->shapes (l->first))); + target_lmap.insert (std::make_pair (l->second, &target_cell->shapes (l->first))); } } @@ -2354,7 +2452,7 @@ NetBuilder::build_net_rec (db::cell_index_type ci, size_t cid, db::Cell &tc, con } void -NetBuilder::build_net_rec (const db::Net &net, db::cell_index_type circuit_cell, const std::map &lmap, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const ICplxTrans &tr) const +NetBuilder::build_net_rec (const db::Net &net, db::cell_index_type circuit_cell, const std::map &lmap, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const ICplxTrans &tr) const { if (! m_cmap.has_mapping (circuit_cell)) { diff --git a/src/db/db/dbLayoutToNetlist.h b/src/db/db/dbLayoutToNetlist.h index a76f44784..4b35c7914 100644 --- a/src/db/db/dbLayoutToNetlist.h +++ b/src/db/db/dbLayoutToNetlist.h @@ -30,6 +30,7 @@ #include "dbLayoutToNetlistEnums.h" #include "dbLog.h" #include "tlGlobPattern.h" +#include "tlOptional.h" namespace db { @@ -355,6 +356,13 @@ public: return is_persisted_impl (coll); } + /** + * @brief Gets the layer index from a name + * + * If the name is not valid, the optional value will not be set. + */ + tl::optional layer_index_by_name (const std::string &name) const; + /** * @brief Gets the region (layer) with the given name * If the name is not valid, this method returns 0. Otherwise it @@ -363,20 +371,34 @@ public: */ db::Region *layer_by_name (const std::string &name); + /** + * @brief Gets the texts (layer) with the given name + * If the name is not valid, this method returns 0. Otherwise it + * will return a new'd Texts object referencing the layer with + * the given name. It must be deleted by the caller. + */ + db::Texts *texts_by_name (const std::string &name); + /** * @brief Gets the region (layer) by index * If the index is not valid, this method returns 0. Otherwise it * will return a new'd Region object referencing the layer with * the given name. It must be deleted by the caller. - * Only named layers are managed by LayoutToNetlist and can - * be retrieved with this method. */ db::Region *layer_by_index (unsigned int index); + /** + * @brief Gets the texts (layer) by index + * If the index is not valid, this method returns 0. Otherwise it + * will return a new'd Texts object referencing the layer with + * the given name. It must be deleted by the caller. + */ + db::Texts *texts_by_index (unsigned int index); + /** * @brief Gets the internal layer from the original layer */ - db::Region *layer_by_original (const ShapeCollection &original_layer) + tl::optional layer_by_original (const ShapeCollection &original_layer) { return layer_by_original (original_layer.get_delegate ()); } @@ -385,7 +407,7 @@ public: * @brief Gets the layer from the original layer's delegate * Returns 0 if the original layer was not registered as an input_layer. */ - db::Region *layer_by_original (const ShapeCollectionDelegateBase *original_delegate); + tl::optional layer_by_original (const ShapeCollectionDelegateBase *original_delegate); /** * @brief Iterates over the layer indexes and names managed by this object (begin) @@ -409,6 +431,12 @@ public: */ db::Region *make_layer (const std::string &name = std::string ()); + /** + * @brief Creates a new empty texts collection + * This method returns a new'd object which must be deleted by the caller. + */ + db::Texts *make_text_layer (const std::string &name = std::string ()); + /** * @brief Creates a new region representing an original layer * "layer_index" is the layer index of the desired layer in the original layout. @@ -746,6 +774,26 @@ public: */ db::Cell *internal_top_cell (); + /** + * @brief Gets the original layout + */ + const db::Layout *original_layout () const; + + /** + * @brief Gets the original top cell + */ + const db::Cell *original_top_cell () const; + + /** + * @brief Gets the original layout (non-const version) + */ + db::Layout *original_layout (); + + /** + * @brief Gets the original top cell (non-const version) + */ + db::Cell *original_top_cell (); + /** * @brief Gets the connectivity object */ @@ -795,8 +843,9 @@ public: * original layers as kept inside the LayoutToNetlist database. * It will return a layer mapping table suitable for use with build_all_nets, build_nets etc. * Layers without original layer information will be given layer numbers ln, ln+1 etc. + * unless ln is < 0, in which case such layers will not be produced. */ - std::map create_layermap (db::Layout &target_layout, int ln) const; + std::map create_layermap (db::Layout &target_layout, int ln = -1) const; /** * @brief gets the netlist extracted (0 if no extraction happened yet) @@ -855,7 +904,21 @@ public: std::map shapes_of_terminal (const db::NetTerminalRef &terminal, const db::ICplxTrans &trans = db::ICplxTrans ()) const; /** - * @brief Returns all shapes of a specific net and layer. + * @brief Returns all polygons or texts of a specific net and layer. + * + * If "recursive" is true, the returned region will contain the shapes of + * all subcircuits too. + * + * This version takes a layer index. + * + * This methods returns a new'd Coll object. It's the responsibility of the caller + * to delete this object. + */ + template + Coll *shapes_of_net_with_layer_index (const db::Net &net, unsigned int lid, bool recursive, const db::ICplxTrans &trans = db::ICplxTrans ()) const; + + /** + * @brief Returns all polygons of a specific net and layer. * * If "recursive" is true, the returned region will contain the shapes of * all subcircuits too. @@ -863,7 +926,24 @@ public: * This methods returns a new'd Region. It's the responsibility of the caller * to delete this object. */ - db::Region *shapes_of_net (const db::Net &net, const db::Region &of_layer, bool recursive, const db::ICplxTrans &trans = db::ICplxTrans ()) const; + db::Region *shapes_of_net (const db::Net &net, const db::Region &of_layer, bool recursive, const db::ICplxTrans &trans = db::ICplxTrans ()) const + { + return shapes_of_net_with_layer_index (net, layer_of (of_layer), recursive, trans); + } + + /** + * @brief Returns all texts of a specific net and layer. + * + * If "recursive" is true, the returned region will contain the shapes of + * all subcircuits too. + * + * This methods returns a new'd Texts object. It's the responsibility of the caller + * to delete this object. + */ + db::Texts *shapes_of_net (const db::Net &net, const db::Texts &of_layer, bool recursive, const db::ICplxTrans &trans = db::ICplxTrans ()) const + { + return shapes_of_net_with_layer_index (net, layer_of (of_layer), recursive, trans); + } /** * @brief Delivers all shapes of a specific net and layer to the given Shapes container. @@ -876,7 +956,14 @@ public: * * propid is an optional properties ID which is attached to the shapes if not 0. */ - void shapes_of_net (const db::Net &net, const db::Region &of_layer, bool recursive, db::Shapes &to, properties_id_type propid = 0, const db::ICplxTrans &trans = db::ICplxTrans ()) const; + void shapes_of_net (const db::Net &net, const db::ShapeCollection &of_layer, bool recursive, db::Shapes &to, properties_id_type propid = 0, const db::ICplxTrans &trans = db::ICplxTrans ()) const; + + /** + * @brief Delivers all shapes of a specific net and layer to the given Shapes container. + * + * This version takes a layer index for the layer + */ + void shapes_of_net (const db::Net &net, unsigned int lid, bool recursive, db::Shapes &to, properties_id_type propid = 0, const db::ICplxTrans &trans = db::ICplxTrans ()) const; /** * @brief Builds a net representation in the given layout and cell @@ -909,7 +996,7 @@ public: * @param cell_name_prefix Chooses recursive mode if non-null * @param device_cell_name_prefix See above */ - void build_net (const db::Net &net, db::Layout &target, db::Cell &target_cell, const std::map &lmap, NetPropertyMode prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *cell_name_prefix, const char *device_cell_name_prefix) const; + void build_net (const db::Net &net, db::Layout &target, db::Cell &target_cell, const std::map &lmap, NetPropertyMode prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *cell_name_prefix, const char *device_cell_name_prefix) const; /** * @brief Builds a full hierarchical representation of the nets @@ -949,12 +1036,12 @@ public: * @param circuit_cell_name_prefix See method description * @param device_cell_name_prefix See above */ - void build_all_nets (const db::CellMapping &cmap, db::Layout &target, const std::map &lmap, const char *net_cell_name_prefix, NetPropertyMode prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *circuit_cell_name_prefix, const char *device_cell_name_prefix) const; + void build_all_nets (const db::CellMapping &cmap, db::Layout &target, const std::map &lmap, const char *net_cell_name_prefix, NetPropertyMode prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *circuit_cell_name_prefix, const char *device_cell_name_prefix) const; /** * @brief Like build_all_nets, but with the ability to select some nets */ - void build_nets (const std::vector *nets, const db::CellMapping &cmap, db::Layout &target, const std::map &lmap, const char *net_cell_name_prefix, NetPropertyMode prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *circuit_cell_name_prefix, const char *device_cell_name_prefix) const; + void build_nets (const std::vector *nets, const db::CellMapping &cmap, db::Layout &target, const std::map &lmap, const char *net_cell_name_prefix, NetPropertyMode prop_mode, const tl::Variant &netname_prop, BuildNetHierarchyMode hier_mode, const char *circuit_cell_name_prefix, const char *device_cell_name_prefix) const; /** * @brief Finds the net by probing a specific location on the given layer @@ -1101,10 +1188,10 @@ private: db::hier_clusters m_net_clusters; std::unique_ptr mp_netlist; std::set m_dlrefs; - std::map m_named_regions; + std::map m_named_dls; std::map m_name_of_layer; - std::map m_region_by_original; - std::map m_region_of_layer; + std::map m_dl_by_original; + std::map m_dl_of_layer; bool m_netlist_extracted; bool m_is_flat; double m_device_scaling; @@ -1234,17 +1321,17 @@ public: /** * @brief See \LayoutToNetlist for details of this function */ - void build_net (db::Cell &target_cell, const db::Net &net, const std::map &lmap, NetPropertyMode prop_mode, const tl::Variant &netname_prop) const; + void build_net (db::Cell &target_cell, const db::Net &net, const std::map &lmap, NetPropertyMode prop_mode, const tl::Variant &netname_prop) const; /** * @brief See \LayoutToNetlist for details of this function */ - void build_all_nets (const std::map &lmap, NetPropertyMode prop_mode, const tl::Variant &netname_prop) const; + void build_all_nets (const std::map &lmap, NetPropertyMode prop_mode, const tl::Variant &netname_prop) const; /** * @brief See \LayoutToNetlist for details of this function */ - void build_nets (const std::vector *nets, const std::map &lmap, NetPropertyMode prop_mode, const tl::Variant &netname_prop) const; + void build_nets (const std::vector *nets, const std::map &lmap, NetPropertyMode prop_mode, const tl::Variant &netname_prop) const; /** * @brief A helper function to create a property ID for a given net, net property name and net property mode @@ -1293,9 +1380,9 @@ private: bool m_has_device_cell_name_prefix; std::string m_device_cell_name_prefix; - void build_net_rec (const db::Net &net, cell_index_type circuit_cell, const std::map &lmap, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const ICplxTrans &tr) const; - void build_net_rec (const db::Net &net, db::Cell &target_cell, const std::map &lmap, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const ICplxTrans &tr) const; - void build_net_rec (db::cell_index_type ci, size_t cid, db::Cell &target_cell, const std::map &lmap, const Net *net, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const ICplxTrans &tr) const; + void build_net_rec (const db::Net &net, cell_index_type circuit_cell, const std::map &lmap, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const ICplxTrans &tr) const; + void build_net_rec (const db::Net &net, db::Cell &target_cell, const std::map &lmap, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const ICplxTrans &tr) const; + void build_net_rec (db::cell_index_type ci, size_t cid, db::Cell &target_cell, const std::map &lmap, const Net *net, const std::string &add_net_cell_name_prefix, db::properties_id_type netname_propid, const ICplxTrans &tr) const; void prepare_build_nets () const; db::Layout &target () const diff --git a/src/db/db/gsiDeclDbLayoutToNetlist.cc b/src/db/db/gsiDeclDbLayoutToNetlist.cc index ef9425d5b..facc04627 100644 --- a/src/db/db/gsiDeclDbLayoutToNetlist.cc +++ b/src/db/db/gsiDeclDbLayoutToNetlist.cc @@ -51,37 +51,93 @@ static db::LayoutToNetlist *make_l2n_flat (const std::string &topcell_name, doub static db::Layout *l2n_internal_layout (db::LayoutToNetlist *l2n) { - // although this isn't very clean, we dare to do so as const references are pretty useless in script languages. - return const_cast (l2n->internal_layout ()); + return l2n->internal_layout (); } static db::Cell *l2n_internal_top_cell (db::LayoutToNetlist *l2n) { - // although this isn't very clean, we dare to do so as const references are pretty useless in script languages. - return const_cast (l2n->internal_top_cell ()); + return l2n->internal_top_cell (); } -static void build_net (const db::LayoutToNetlist *l2n, const db::Net &net, db::Layout &target, db::Cell &target_cell, const std::map &lmap, const tl::Variant &netname_prop, db::BuildNetHierarchyMode hier_mode, const tl::Variant &circuit_cell_name_prefix, const tl::Variant &device_cell_name_prefix) +static db::Layout *l2n_original_layout (db::LayoutToNetlist *l2n) +{ + return l2n->original_layout (); +} + +static db::Cell *l2n_original_top_cell (db::LayoutToNetlist *l2n) +{ + return l2n->original_top_cell (); +} + +static tl::Variant l2n_layer_index_by_name (const db::LayoutToNetlist *l2n, const std::string &name) +{ + tl::optional index = l2n->layer_index_by_name (name); + if (index.has_value ()) { + return tl::Variant (index.value ()); + } else { + return tl::Variant (); + } +} + +static std::map layer_map_from_var (const db::LayoutToNetlist *l2n, db::Layout &target, const tl::Variant &lmap) +{ + if (lmap.is_nil ()) { + + return l2n->create_layermap (target); + + } else if (! lmap.is_array ()) { + + throw tl::Exception (tl::to_string (tr ("'lmap' argument needs to be nil or a hash"))); + + } else { + + std::map res; + + for (auto kv = lmap.begin_array (); kv != lmap.end_array (); ++kv) { + const tl::Variant &k = kv->first; + const tl::Variant &v = kv->second; + unsigned int ki = k.to_uint (); + unsigned int vi = 0; + if (v.is_user ()) { + if (dynamic_cast *> (v.user_cls ()) != 0) { + vi = l2n->layer_of (v.to_user ()); + } else if (dynamic_cast *> (v.user_cls ()) != 0) { + vi = l2n->layer_of (v.to_user ()); + } else { + throw tl::Exception (tl::to_string (tr ("'lmap' argument hash values need to be ints, Region or Texts objects"))); + } + } else { + vi = v.to_uint (); + } + res.insert (std::make_pair (ki, vi)); + } + + return res; + + } +} + +static void build_net (const db::LayoutToNetlist *l2n, const db::Net &net, db::Layout &target, db::Cell &target_cell, const tl::Variant &lmap, const tl::Variant &netname_prop, db::BuildNetHierarchyMode hier_mode, const tl::Variant &circuit_cell_name_prefix, const tl::Variant &device_cell_name_prefix) { std::string p = circuit_cell_name_prefix.to_string (); std::string dp = device_cell_name_prefix.to_string (); - l2n->build_net (net, target, target_cell, lmap, db::NPM_AllProperties, netname_prop, hier_mode, circuit_cell_name_prefix.is_nil () ? 0 : p.c_str (), device_cell_name_prefix.is_nil () ? 0 : dp.c_str ()); + l2n->build_net (net, target, target_cell, layer_map_from_var (l2n, target, lmap), db::NPM_AllProperties, netname_prop, hier_mode, circuit_cell_name_prefix.is_nil () ? 0 : p.c_str (), device_cell_name_prefix.is_nil () ? 0 : dp.c_str ()); } -static void build_all_nets (const db::LayoutToNetlist *l2n, const db::CellMapping &cmap, db::Layout &target, const std::map &lmap, const tl::Variant &net_cell_name_prefix, const tl::Variant &netname_prop, db::BuildNetHierarchyMode hier_mode, const tl::Variant &circuit_cell_name_prefix, const tl::Variant &device_cell_name_prefix) +static void build_all_nets (const db::LayoutToNetlist *l2n, const db::CellMapping &cmap, db::Layout &target, const tl::Variant &lmap, const tl::Variant &net_cell_name_prefix, const tl::Variant &netname_prop, db::BuildNetHierarchyMode hier_mode, const tl::Variant &circuit_cell_name_prefix, const tl::Variant &device_cell_name_prefix) { std::string cp = circuit_cell_name_prefix.to_string (); std::string np = net_cell_name_prefix.to_string (); std::string dp = device_cell_name_prefix.to_string (); - l2n->build_all_nets (cmap, target, lmap, net_cell_name_prefix.is_nil () ? 0 : np.c_str (), db::NPM_AllProperties, netname_prop, hier_mode, circuit_cell_name_prefix.is_nil () ? 0 : cp.c_str (), device_cell_name_prefix.is_nil () ? 0 : dp.c_str ()); + l2n->build_all_nets (cmap, target, layer_map_from_var (l2n, target, lmap), net_cell_name_prefix.is_nil () ? 0 : np.c_str (), db::NPM_AllProperties, netname_prop, hier_mode, circuit_cell_name_prefix.is_nil () ? 0 : cp.c_str (), device_cell_name_prefix.is_nil () ? 0 : dp.c_str ()); } -static void build_nets (const db::LayoutToNetlist *l2n, const std::vector &nets, const db::CellMapping &cmap, db::Layout &target, const std::map &lmap, const tl::Variant &net_cell_name_prefix, const tl::Variant &netname_prop, db::BuildNetHierarchyMode hier_mode, const tl::Variant &circuit_cell_name_prefix, const tl::Variant &device_cell_name_prefix) +static void build_nets (const db::LayoutToNetlist *l2n, const std::vector &nets, const db::CellMapping &cmap, db::Layout &target, const tl::Variant &lmap, const tl::Variant &net_cell_name_prefix, const tl::Variant &netname_prop, db::BuildNetHierarchyMode hier_mode, const tl::Variant &circuit_cell_name_prefix, const tl::Variant &device_cell_name_prefix) { std::string cp = circuit_cell_name_prefix.to_string (); std::string np = net_cell_name_prefix.to_string (); std::string dp = device_cell_name_prefix.to_string (); - l2n->build_nets (&nets, cmap, target, lmap, net_cell_name_prefix.is_nil () ? 0 : np.c_str (), db::NPM_AllProperties, netname_prop, hier_mode, circuit_cell_name_prefix.is_nil () ? 0 : cp.c_str (), device_cell_name_prefix.is_nil () ? 0 : dp.c_str ()); + l2n->build_nets (&nets, cmap, target, layer_map_from_var (l2n, target, lmap), net_cell_name_prefix.is_nil () ? 0 : np.c_str (), db::NPM_AllProperties, netname_prop, hier_mode, circuit_cell_name_prefix.is_nil () ? 0 : cp.c_str (), device_cell_name_prefix.is_nil () ? 0 : dp.c_str ()); } static std::vector l2n_layer_names (const db::LayoutToNetlist *l2n) @@ -370,11 +426,16 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "\n" "This method has been introduced in version 0.29.3.\n" ) + + gsi::method_ext ("layer_index", &l2n_layer_index_by_name, + "@brief Gets the layer index for a given name or nil if the name is not valid.\n" + "\n" + "This method has been introduced in version 0.30." + ) + gsi::method ("layer_name", (std::string (db::LayoutToNetlist::*) (unsigned int) const) &db::LayoutToNetlist::name, gsi::arg ("l"), "@brief Gets the name of the given layer (by index)\n" "See \\layer_index for a description of the layer index.\n" ) + - gsi::method ("register", (unsigned int (db::LayoutToNetlist::*) (const db::ShapeCollection &collection, const std::string &)) &db::LayoutToNetlist::register_layer, gsi::arg ("l"), gsi::arg ("n", std::string ()), + gsi::method ("register", (unsigned int (db::LayoutToNetlist::*) (const db::ShapeCollection &collection, const std::string &)) &db::LayoutToNetlist::register_layer, gsi::arg ("l"), gsi::arg ("n", std::string (), "\"\""), "@brief Names the given layer\n" "@return The index of the layer registered\n" "'l' must be a \\Region or \\Texts object.\n" @@ -417,18 +478,53 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "\n" "This method has been introduced in version 0.29.2.\n" ) + - gsi::factory ("layer_by_name", &db::LayoutToNetlist::layer_by_name, gsi::arg ("name"), + gsi::factory ("polygons_by_name|#layer_by_name", &db::LayoutToNetlist::layer_by_name, gsi::arg ("name"), "@brief Gets a layer object for the given name.\n" "The returned object is a new Region object representing the named layer. It will refer to a layer inside the " "internal layout, or more specifically inside the \\DeepShapeStorage object (see \\dss and \\internal_layout).\n" "The method returns 'nil' if the name is not a valid layer name.\n" "See \\register and the make_... methods for a description of layer naming.\n" + "\n" + "It is in the responsibility of the user to use \\texts_by_index or \\polygons_by_index on the right layers. " + "A layer created for text purpose should not be used with \\polygons_by_index or vice versa.\n" + "\n" + "Starting with version 0.30, the preferred name for this method is \\polygons_by_index to " + "differentiate from \\texts_by_index." ) + - gsi::factory ("layer_by_index", &db::LayoutToNetlist::layer_by_index, gsi::arg ("index"), - "@brief Gets a layer object for the given index.\n" + gsi::factory ("texts_by_name", &db::LayoutToNetlist::texts_by_name, gsi::arg ("name"), + "@brief Gets a layer object for the given name.\n" + "The returned object is a new Texts object representing the named layer. It will refer to a layer inside the " + "internal layout, or more specifically inside the \\DeepShapeStorage object (see \\dss and \\internal_layout).\n" + "The method returns 'nil' if the name is not a valid layer name.\n" + "See \\register and the make_... methods for a description of layer naming.\n" + "\n" + "It is in the responsibility of the user to use \\texts_by_name or \\polygons_by_name on the right layers. " + "A layer created for text purpose should not be used with \\polygons_by_name or vice versa.\n" + "\n" + "This method has been introduced in version 0.30." + ) + + gsi::factory ("polygons_by_index|#layer_by_index", &db::LayoutToNetlist::layer_by_index, gsi::arg ("index"), + "@brief Gets a \\Region object for the given index.\n" "The returned object is a new Region object representing the layer with the given index. It will refer to a layer inside the " "internal layout, or more specifically inside the \\DeepShapeStorage object (see \\dss and \\internal_layout).\n" - "The method returns 'nil' if the index is not a valid layer index." + "The method returns 'nil' if the index is not a valid layer index.\n" + "\n" + "It is in the responsibility of the user to use \\texts_by_index or \\polygons_by_index on the right layers. " + "A layer created for text purpose should not be used with \\polygons_by_index or vice versa.\n" + "\n" + "Starting with version 0.30, the preferred name for this method is \\polygons_by_index to " + "differentiate from \\texts_by_index." + ) + + gsi::factory ("texts_by_index", &db::LayoutToNetlist::texts_by_index, gsi::arg ("index"), + "@brief Gets a \\Texts object for the given index.\n" + "The returned object is a new Texts object representing the layer with the given index. It will refer to a layer inside the " + "internal layout, or more specifically inside the \\DeepShapeStorage object (see \\dss and \\internal_layout).\n" + "The method returns 'nil' if the index is not a valid layer index.\n" + "\n" + "It is in the responsibility of the user to use \\texts_by_index or \\polygons_by_index on the right layers. " + "A layer created for text purpose should not be used with \\polygons_by_index or vice versa.\n" + "\n" + "This method has been introduced in version 0.30." ) + gsi::method ("is_persisted?", &db::LayoutToNetlist::is_persisted, gsi::arg ("layer"), "@brief Returns true, if the given layer is a persisted region.\n" @@ -446,14 +542,14 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "\n" "The variant for Texts collections has been added in version 0.27." ) + - gsi::factory ("make_layer", (db::Region *(db::LayoutToNetlist::*) (const std::string &)) &db::LayoutToNetlist::make_layer, gsi::arg ("name", std::string ()), + gsi::factory ("make_layer", (db::Region *(db::LayoutToNetlist::*) (const std::string &)) &db::LayoutToNetlist::make_layer, gsi::arg ("name", std::string (), "\"\""), "@brief Creates a new, empty hierarchical region\n" "\n" "This method will create a new, empty layer inside the internal layout and register it.\n" "It returns a new Region object that represents the new layer. See the class description for more details.\n" "The name is optional. If given, the layer will already be named accordingly (see \\register).\n" ) + - gsi::factory ("make_layer", (db::Region *(db::LayoutToNetlist::*) (unsigned int, const std::string &)) &db::LayoutToNetlist::make_layer, gsi::arg ("layer_index"), gsi::arg ("name", std::string ()), + gsi::factory ("make_layer", (db::Region *(db::LayoutToNetlist::*) (unsigned int, const std::string &)) &db::LayoutToNetlist::make_layer, gsi::arg ("layer_index"), gsi::arg ("name", std::string (), "\"\""), "@brief Creates a new hierarchical region representing an original layer\n" "'layer_index' is the layer index of the desired layer in the original layout.\n" "This variant produces polygons and takes texts for net name annotation as special, property-annotated polygons.\n" @@ -464,13 +560,25 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "the DSS (see \\dss and \\internal_layout). It returns a new Region object that represents this layer copy. " "The new layer is already registered with the given name and can be used for \\connect for example.\n" ) + - gsi::factory ("make_text_layer", &db::LayoutToNetlist::make_text_layer, gsi::arg ("layer_index"), gsi::arg ("name", std::string ()), - "@brief Creates a new region representing an original layer taking texts only\n" + gsi::factory ("make_text_layer", (db::Texts *(db::LayoutToNetlist::*) (const std::string &)) &db::LayoutToNetlist::make_text_layer, gsi::arg ("name", std::string (), "\"\""), + "@brief Creates a new, empty hierarchical text collection\n" + "See \\make_layer for details.\n" + "\n" + "Starting with version 0.30, the original layer index is optional, allowing to create empty, internal text layers." + ) + + gsi::factory ("make_text_layer", (db::Texts *(db::LayoutToNetlist::*) (unsigned int, const std::string &)) &db::LayoutToNetlist::make_text_layer, gsi::arg ("layer_index"), gsi::arg ("name", std::string (), "\"\""), + "@brief Creates a new text collection representing an original layer taking texts only\n" "See \\make_layer for details.\n" "\n" "Starting with version 0.27, this method returns a \\Texts object." ) + - gsi::factory ("make_polygon_layer", &db::LayoutToNetlist::make_polygon_layer, gsi::arg ("layer_index"), gsi::arg ("name", std::string ()), + gsi::factory ("make_polygon_layer", (db::Region *(db::LayoutToNetlist::*) (const std::string &)) &db::LayoutToNetlist::make_layer, gsi::arg ("name", std::string (), "\"\""), + "@brief Creates a new, empty hierarchical region\n" + "See \\make_layer for details.\n" + "\n" + "Starting with version 0.30, the original layer index is optional for consistency with \\make_layer." + ) + + gsi::factory ("make_polygon_layer", (db::Region *(db::LayoutToNetlist::*) (unsigned int, const std::string &)) &db::LayoutToNetlist::make_polygon_layer, gsi::arg ("layer_index"), gsi::arg ("name", std::string (), "\"\""), "@brief Creates a new region representing an original layer taking polygons only\n" "See \\make_layer for details.\n" ) + @@ -661,7 +769,7 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "@ul\n" "@li \"\" no implicit connections.@/li\n" "@li \"*\" to make all labels candidates for implicit connections.@/li\n" - "@li \"VDD\" to make all 'VDD'' nets candidates for implicit connections.@/li\n" + "@li \"VDD\" to make all 'VDD' nets candidates for implicit connections.@/li\n" "@li \"VDD\" to make all 'VDD'+suffix nets candidates for implicit connections.@/li\n" "@li \"{VDD,VSS}\" to all VDD and VSS nets candidates for implicit connections.@/li\n" "@/ul\n" @@ -713,6 +821,16 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "\n" "This method has been introduced in version 0.28.13." ) + + gsi::method_ext ("original_layout", &l2n_original_layout, + "@brief Gets the original layout or nil is the LayoutToNetlist object is not attached to one.\n" + "\n" + "This method has been introduced in version 0.30." + ) + + gsi::method_ext ("original_top_cell", &l2n_original_top_cell, + "@brief Gets the original top cell or nil is the LayoutToNetlist object is not attached to an original layout.\n" + "\n" + "This method has been introduced in version 0.30." + ) + gsi::method_ext ("internal_layout", &l2n_internal_layout, "@brief Gets the internal layout\n" "The internal layout is where the LayoutToNetlist database stores the shapes for the nets. " @@ -729,17 +847,20 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "\n" "See the class description for details about the internal layout object." ) + - gsi::method ("layer_of", &db::LayoutToNetlist::layer_of, gsi::arg ("l"), + gsi::method ("#layer_of", &db::LayoutToNetlist::layer_of, gsi::arg ("l"), "@brief Gets the internal layer for a given extraction layer\n" "This method is required to derive the internal layer index - for example for\n" "investigating the cluster tree.\n" + "\n" + "A generalized version of this method is \\layer_index." ) + - gsi::method ("layer_of", &db::LayoutToNetlist::layer_of, gsi::arg ("l"), + gsi::method ("#layer_of", &db::LayoutToNetlist::layer_of, gsi::arg ("l"), "@brief Gets the internal layer for a given text collection\n" "This method is required to derive the internal layer index - for example for\n" "investigating the cluster tree.\n" "\n" "The variant for Texts collections has been added in version 0.27.\n" + "A generalized version of this method is \\layer_index." ) + gsi::method ("cell_mapping_into", (db::CellMapping (db::LayoutToNetlist::*) (db::Layout &, db::Cell &, bool)) &db::LayoutToNetlist::cell_mapping_into, gsi::arg ("layout"), gsi::arg ("cell"), gsi::arg ("with_device_cells", false), "@brief Creates a cell mapping for copying shapes from the internal layout to the given target layout.\n" @@ -760,7 +881,7 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", gsi::method ("const_cell_mapping_into", &db::LayoutToNetlist::const_cell_mapping_into, gsi::arg ("layout"), gsi::arg ("cell"), "@brief Creates a cell mapping for copying shapes from the internal layout to the given target layout.\n" "This version will not create new cells in the target layout.\n" - "If the required cells do not exist there yet, flatting will happen.\n" + "If some required cells do not exist there, they will be flattened into the first existing parent.\n" ) + gsi::method ("netlist", &db::LayoutToNetlist::netlist, "@brief gets the netlist extracted (0 if no extraction happened yet)\n" @@ -804,19 +925,60 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "This method has been introduced in version 0.29.2." ) + gsi::factory ("shapes_of_net", (db::Region *(db::LayoutToNetlist::*) (const db::Net &, const db::Region &, bool, const db::ICplxTrans &) const) &db::LayoutToNetlist::shapes_of_net, gsi::arg ("net"), gsi::arg ("of_layer"), gsi::arg ("recursive", true), gsi::arg ("trans", db::ICplxTrans (), "unity"), - "@brief Returns all shapes of a specific net and layer.\n" - "If 'recursive'' is true, the returned region will contain the shapes of\n" + "@brief Returns all polygons of a specific net and layer.\n" + "If 'recursive' is true, the returned region will contain the shapes of\n" "all subcircuits too.\n" "\n" "The optional 'trans' parameter allows applying a transformation to all shapes. It has been introduced in version 0.28.4." ) + - gsi::method ("shapes_of_net", (void (db::LayoutToNetlist::*) (const db::Net &, const db::Region &, bool, db::Shapes &, db::properties_id_type, const db::ICplxTrans &) const) &db::LayoutToNetlist::shapes_of_net, gsi::arg ("net"), gsi::arg ("of_layer"), gsi::arg ("recursive"), gsi::arg ("to"), gsi::arg ("propid", db::properties_id_type (0), "0"), gsi::arg ("trans", db::ICplxTrans (), "unity"), - "@brief Sends all shapes of a specific net and layer to the given Shapes container.\n" - "If 'recursive'' is true, the returned region will contain the shapes of\n" + gsi::factory ("shapes_of_net", (db::Texts *(db::LayoutToNetlist::*) (const db::Net &, const db::Texts &, bool, const db::ICplxTrans &) const) &db::LayoutToNetlist::shapes_of_net, gsi::arg ("net"), gsi::arg ("of_layer"), gsi::arg ("recursive", true), gsi::arg ("trans", db::ICplxTrans (), "unity"), + "@brief Returns all texts of a specific net and layer.\n" + "If 'recursive' is true, the returned text collection will contain the shapes of\n" "all subcircuits too.\n" - "\"prop_id\" is an optional properties ID. If given, this property set will be attached to the shapes." + "\n" + "The optional 'trans' parameter allows applying a transformation to all shapes.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + + gsi::factory ("polygons_of_net", (db::Region *(db::LayoutToNetlist::*) (const db::Net &, unsigned int, bool, const db::ICplxTrans &) const) &db::LayoutToNetlist::shapes_of_net_with_layer_index, gsi::arg ("net"), gsi::arg ("of_layer"), gsi::arg ("recursive", true), gsi::arg ("trans", db::ICplxTrans (), "unity"), + "@brief Returns all polygons of a specific net and layer.\n" + "If 'recursive' is true, the returned region will contain the shapes of\n" + "all subcircuits too.\n" + "\n" + "The optional 'trans' parameter allows applying a transformation to all shapes.\n" + "\n" + "This method is similar to \\shapes_of_net, but takes a layer index for the layer. It was introduced in version 0.30.\n" + ) + + gsi::factory ("texts_of_net", (db::Texts *(db::LayoutToNetlist::*) (const db::Net &, unsigned int, bool, const db::ICplxTrans &) const) &db::LayoutToNetlist::shapes_of_net_with_layer_index, gsi::arg ("net"), gsi::arg ("of_layer"), gsi::arg ("recursive", true), gsi::arg ("trans", db::ICplxTrans (), "unity"), + "@brief Returns all texts of a specific net and layer.\n" + "If 'recursive' is true, the returned region will contain the shapes of\n" + "all subcircuits too.\n" + "\n" + "The optional 'trans' parameter allows applying a transformation to all shapes.\n" + "\n" + "This method is similar to \\shapes_of_net, but takes a layer index for the layer. It was introduced in version 0.30.\n" + ) + + gsi::method ("shapes_of_net", (void (db::LayoutToNetlist::*) (const db::Net &, const db::ShapeCollection &, bool, db::Shapes &, db::properties_id_type, const db::ICplxTrans &) const) &db::LayoutToNetlist::shapes_of_net, gsi::arg ("net"), gsi::arg ("of_layer"), gsi::arg ("recursive"), gsi::arg ("to"), gsi::arg ("propid", db::properties_id_type (0), "0"), gsi::arg ("trans", db::ICplxTrans (), "unity"), + "@brief Sends all shapes of a specific net and layer to the given Shapes container.\n" + "If 'recursive' is true, the returned region will contain the shapes of\n" + "all subcircuits too.\n" + "\n" + "'prop_id' is an optional properties ID. If given, this property set will be attached to the shapes." "\n" "The optional 'trans' parameter allows applying a transformation to all shapes. It has been introduced in version 0.28.4." + "\n" + "The 'of_layer' argument has been generalized in version 0.30 and can be a layer index, a \\Region layer or a \\Texts layer." + ) + + gsi::method ("shapes_of_net", (void (db::LayoutToNetlist::*) (const db::Net &, unsigned int, bool, db::Shapes &, db::properties_id_type, const db::ICplxTrans &) const) &db::LayoutToNetlist::shapes_of_net, gsi::arg ("net"), gsi::arg ("of_layer"), gsi::arg ("recursive"), gsi::arg ("to"), gsi::arg ("propid", db::properties_id_type (0), "0"), gsi::arg ("trans", db::ICplxTrans (), "unity"), + "@brief Sends all shapes of a specific net and layer to the given Shapes container.\n" + "If 'recursive' is true, the returned region will contain the shapes of\n" + "all subcircuits too.\n" + "\n" + "'prop_id' is an optional properties ID. If given, this property set will be attached to the shapes." + "\n" + "The optional 'trans' parameter allows applying a transformation to all shapes. It has been introduced in version 0.28.4." + "\n" + "The 'of_layer' argument has been generalized in version 0.30 and can be a layer index, a \\Region layer or a \\Texts layer." ) + gsi::method_ext ("build_net", &build_net, gsi::arg ("net"), gsi::arg ("target"), gsi::arg ("target_cell"), gsi::arg ("lmap"), gsi::arg ("netname_prop", tl::Variant (), "nil"), gsi::arg ("hier_mode", db::BNH_Flatten, "BNH_Flatten"), gsi::arg ("circuit_cell_name_prefix", tl::Variant (), "nil"), gsi::arg ("device_cell_name_prefix", tl::Variant (), "nil"), "@brief Builds a net representation in the given layout and cell\n" @@ -828,9 +990,9 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "of the property is the net name.\n" "\n" "'lmap' defines which layers are to be produced. It is map, where the keys are layer indexes in the " - "target layout and the values are Region objects indicating the layer where shapes are to be taken from. " - "Use \\layer_by_name or \\layer_by_index to get the Region object corresponding to a layer stored inside " - "the LayoutToNetlist database. See \\build_all_nets for a code sample.\n" + "target layout and the values are Region or Texts objects or layer indexes, indicating the layer where shapes are to be taken from. " + "'lmap' can also be left nil, in which case, a layer mapping will be provided based on the layer info attributes of " + "the layers (see \\layer_info).\n" "\n" "Also see \\build_all_nets for a description of the 'hier_mode' argument.\n" "\n" @@ -840,13 +1002,15 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "\n" "@param target The target layout\n" "@param target_cell The target cell\n" - "@param lmap Target layer indexes (keys) and net regions (values)\n" + "@param lmap The layer mapping (see description of this method)\n" "@param hier_mode See description of this method\n" "@param netname_prop An (optional) property name to which to attach the net name\n" "@param cell_name_prefix Chooses recursive mode if non-null\n" "@param device_cell_name_prefix See above\n" + "\n" + "The 'lmap' argument has been generalized in version 0.30 and became optional." ) + - gsi::method_ext ("build_all_nets", &build_all_nets, gsi::arg ("cmap"), gsi::arg ("target"), gsi::arg ("lmap"), gsi::arg ("net_cell_name_prefix", tl::Variant (), "nil"), gsi::arg ("netname_prop", tl::Variant (), "nil"), gsi::arg ("hier_mode", db::BNH_Flatten, "BNH_Flatten"), gsi::arg ("circuit_cell_name_prefix", tl::Variant (), "nil"), gsi::arg ("device_cell_name_prefix", tl::Variant (), "nil"), + gsi::method_ext ("build_all_nets", &build_all_nets, gsi::arg ("cmap"), gsi::arg ("target"), gsi::arg ("lmap", tl::Variant (), "auto"), gsi::arg ("net_cell_name_prefix", tl::Variant (), "nil"), gsi::arg ("netname_prop", tl::Variant (), "nil"), gsi::arg ("hier_mode", db::BNH_Flatten, "BNH_Flatten"), gsi::arg ("circuit_cell_name_prefix", tl::Variant (), "nil"), gsi::arg ("device_cell_name_prefix", tl::Variant (), "nil"), "@brief Builds a full hierarchical representation of the nets\n" "\n" "This method copies all nets into cells corresponding to the circuits. It uses the 'cmap'\n" @@ -858,22 +1022,12 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "of the property is the net name.\n" "\n" "'lmap' defines which layers are to be produced. It is map, where the keys are layer indexes in the " - "target layout and the values are Region objects indicating the layer where shapes are to be taken from. " - "Use \\layer_by_name or \\layer_by_index to get the Region object corresponding to a layer stored inside " - "the LayoutToNetlist database.\n" + "target layout and the values are Region or Texts objects or layer indexes, indicating the layer where shapes are to be taken from. " + "'lmap' can also be left nil, in which case, a layer mapping will be provided based on the layer info attributes of " + "the layers (see \\layer_info).\n" "\n" - "You can use the following code to replicate the layers inside the LayoutToNetlist object into a fresh target layout " - "and create the layer map for the 'lmap' argument:\n" - "\n" - "@code\n" - "l2n = ... some LayoutToNetlist object\n" - "target = ... some fresh target layout\n" - "lmap = {}\n" - "l2n.layer_indexes().each do |layer_index|\n" - " new_layer_index = target.layer(l2n.layer_info(li))\n" - " lmap[new_layer_index] = l2n.layer_by_index(li)\n" - "end\n" - "@/code\n" + "'cmap' specifies the cell mapping. Use \\create_cell_mapping or \\const_create_cell_mapping to " + "define the target cells in the target layout and to derive a cell mapping.\n" "\n" "The method has three net annotation modes:\n" "@ul\n" @@ -900,14 +1054,16 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "using a name like device_cell_name_prefix + device name. Otherwise the device shapes are\n" "treated as part of the net.\n" "\n" - "@param cmap The mapping of internal layout to target layout for the circuit mapping\n" + "@param cmap The cell mapping (see description of this method)\n" "@param target The target layout\n" - "@param lmap Target layer indexes (keys) and net regions (values)\n" + "@param lmap The layer mapping (see description of this method)\n" "@param hier_mode See description of this method\n" "@param netname_prop An (optional) property name to which to attach the net name\n" "@param circuit_cell_name_prefix See method description\n" "@param net_cell_name_prefix See method description\n" "@param device_cell_name_prefix See above\n" + "\n" + "The 'lmap' argument has been generalized in version 0.30 and became optional." ) + gsi::method_ext ("build_nets", &build_nets, gsi::arg ("nets"), gsi::arg ("cmap"), gsi::arg ("target"), gsi::arg ("lmap"), gsi::arg ("net_cell_name_prefix", tl::Variant (), "nil"), gsi::arg ("netname_prop", tl::Variant (), "nil"), gsi::arg ("hier_mode", db::BNH_Flatten, "BNH_Flatten"), gsi::arg ("circuit_cell_name_prefix", tl::Variant (), "nil"), gsi::arg ("device_cell_name_prefix", tl::Variant (), "nil"), "@brief Like \\build_all_nets, but with the ability to select some nets." @@ -1074,7 +1230,7 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "a new LayoutToNetlist object, there will be no connection to any external layout, but all the " "essential netlist and geometry information will be available.\n" "\n" - "The LayoutToNetlist object is also the entry point for netlist-driven algorithms such as antenna checks.\n" + "The \\LayoutToNetlist object is also the entry point for netlist-driven algorithms such as antenna checks.\n" "\n" "The use model of the LayoutToNetlist object consists of five steps which need to be executed in this order.\n" "\n" @@ -1136,8 +1292,26 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "@li Helper functions: \\cell_mapping_into, \\const_cell_mapping_into @/li\n" "@/ul\n" "\n" - "The \\LayoutToNetlist object is also the entry point for connectivity-aware DRC checks, " - "such as antenna checks.\n" + "Layers stored inside the LayoutToNetlist object are addressed in three ways:\n" + "\n" + "@ul\n" + "@li Through a layer index: this is an integer number that addresses the layer. Technically this is " + " the layer index inside the internal layout (see \\internal_layout). To get a layer index from " + " a shape collection or name use \\layer_index. To get all layer indexes available, use \\layer_indexes. " + " Note, that \\make_layer, \\make_polygon_layer and \\make_text_layer also take a layer index, but " + " this the layer index of layer in the \\original_layout. @/li\n" + "@li Through a name: Alternatively to the layer index, a layer can be addressed by name, provided one was " + " assigned. To assign a name, specify one when creating a layer with \\register, \\make_layer, \\make_polygon_layer " + " or \\make_text_layer. To get the layer index of a named layer, use \\layer_index. To get the name " + " of a layer use \\layer_name. To get all names of layers, use \\layer_names. @/li\n" + "@li As a shape collection: a layer can also be represented by a shape collection. A shape collection is " + " either a \\Region or a \\Texts object. These objects do not only represent a layer, but can be used " + " to derive new layers. In order to assign names, use \\register. To create a new layer and a " + " corresponding shape collection object, use \\make_layer, \\make_polygon_layer or \\make_text_layer. " + " The get the shape collection for a given layer index, use \\layer_index, to get layer name from " + " a shape collection, use \\layer_name. To get a shape collection from a layer index, use " + " \\layer_by_index, \\polygons_by_index or \\texts_by_index. @li\n" + "@/ul\n" "\n" "This class has been introduced in version 0.26." ); diff --git a/src/db/unit_tests/dbLayoutToNetlistReaderTests.cc b/src/db/unit_tests/dbLayoutToNetlistReaderTests.cc index 251fbe70b..91531d4de 100644 --- a/src/db/unit_tests/dbLayoutToNetlistReaderTests.cc +++ b/src/db/unit_tests/dbLayoutToNetlistReaderTests.cc @@ -64,15 +64,15 @@ TEST(1_ReaderBasic) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_by_name ("psd"); - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_by_name ("nsd"); - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_by_name ("poly"); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_by_name ("diff_cont"); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_by_name ("poly_cont"); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_by_name ("metal1"); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_by_name ("via1"); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_by_name ("metal2"); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_index_by_name ("psd").value (); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_index_by_name ("nsd").value (); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_index_by_name ("poly").value (); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_index_by_name ("diff_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_index_by_name ("poly_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_index_by_name ("metal1").value (); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_index_by_name ("via1").value (); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_index_by_name ("metal2").value (); l2n.build_all_nets (cm, ly2, lmap, "NET_", db::NPM_NoProperties, tl::Variant (), db::BNH_Disconnected, 0, "DEVICE_"); @@ -88,15 +88,15 @@ TEST(1_ReaderBasic) ly2.dbu (l2n.internal_layout ()->dbu ()); db::Cell &top2 = ly2.cell (ly2.add_cell ("TOP")); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_by_name ("psd"); - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_by_name ("nsd"); - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_by_name ("poly"); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_by_name ("diff_cont"); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_by_name ("poly_cont"); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_by_name ("metal1"); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_by_name ("via1"); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_by_name ("metal2"); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_index_by_name ("psd").value (); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_index_by_name ("nsd").value (); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_index_by_name ("poly").value (); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_index_by_name ("diff_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_index_by_name ("poly_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_index_by_name ("metal1").value (); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_index_by_name ("via1").value (); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_index_by_name ("metal2").value (); std::vector nets; nets.push_back (l2n.netlist ()->circuit_by_name ("RINGO")->net_by_name ("VSS")); @@ -118,15 +118,15 @@ TEST(1_ReaderBasic) ly2.dbu (l2n.internal_layout ()->dbu ()); db::Cell &top2 = ly2.cell (ly2.add_cell ("TOP")); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_by_name ("psd"); - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_by_name ("nsd"); - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_by_name ("poly"); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_by_name ("diff_cont"); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_by_name ("poly_cont"); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_by_name ("metal1"); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_by_name ("via1"); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_by_name ("metal2"); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_index_by_name ("psd").value (); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_index_by_name ("nsd").value (); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_index_by_name ("poly").value (); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_index_by_name ("diff_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_index_by_name ("poly_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_index_by_name ("metal1").value (); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_index_by_name ("via1").value (); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_index_by_name ("metal2").value (); std::vector nets; nets.push_back (l2n.netlist ()->circuit_by_name ("RINGO")->net_by_name ("VSS")); @@ -148,15 +148,15 @@ TEST(1_ReaderBasic) ly2.dbu (l2n.internal_layout ()->dbu ()); db::Cell &top2 = ly2.cell (ly2.add_cell ("TOP")); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_by_name ("psd"); - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_by_name ("nsd"); - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_by_name ("poly"); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_by_name ("diff_cont"); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_by_name ("poly_cont"); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_by_name ("metal1"); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_by_name ("via1"); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_by_name ("metal2"); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_index_by_name ("psd").value (); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_index_by_name ("nsd").value (); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_index_by_name ("poly").value (); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_index_by_name ("diff_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_index_by_name ("poly_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_index_by_name ("metal1").value (); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_index_by_name ("via1").value (); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_index_by_name ("metal2").value (); std::vector nets; nets.push_back (l2n.netlist ()->circuit_by_name ("RINGO")->net_by_name ("VSS")); @@ -178,15 +178,15 @@ TEST(1_ReaderBasic) ly2.dbu (l2n.internal_layout ()->dbu ()); db::Cell &top2 = ly2.cell (ly2.add_cell ("TOP")); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_by_name ("psd"); - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_by_name ("nsd"); - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_by_name ("poly"); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_by_name ("diff_cont"); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_by_name ("poly_cont"); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_by_name ("metal1"); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_by_name ("via1"); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_by_name ("metal2"); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_index_by_name ("psd").value (); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_index_by_name ("nsd").value (); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_index_by_name ("poly").value (); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_index_by_name ("diff_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_index_by_name ("poly_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_index_by_name ("metal1").value (); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_index_by_name ("via1").value (); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_index_by_name ("metal2").value (); std::vector nets; nets.push_back (l2n.netlist ()->circuit_by_name ("RINGO")->net_by_name ("VSS")); @@ -209,15 +209,15 @@ TEST(1_ReaderBasic) ly2.dbu (l2n.internal_layout ()->dbu ()); db::Cell &top2 = ly2.cell (ly2.add_cell ("TOP")); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_by_name ("psd"); - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_by_name ("nsd"); - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_by_name ("poly"); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_by_name ("diff_cont"); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_by_name ("poly_cont"); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_by_name ("metal1"); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_by_name ("via1"); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_by_name ("metal2"); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_index_by_name ("psd").value (); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_index_by_name ("nsd").value (); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_index_by_name ("poly").value (); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_index_by_name ("diff_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_index_by_name ("poly_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_index_by_name ("metal1").value (); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_index_by_name ("via1").value (); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_index_by_name ("metal2").value (); std::vector nets; nets.push_back (l2n.netlist ()->circuit_by_name ("RINGO")->net_by_name ("VSS")); @@ -290,18 +290,18 @@ TEST(1c_ReaderBasicShortWithProps) ly2.dbu (l2n.internal_layout ()->dbu ()); db::Cell &top2 = ly2.cell (ly2.add_cell ("TOP")); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (3, 0))] = l2n.layer_by_name ("poly"); - lmap [ly2.insert_layer (db::LayerProperties (3, 1))] = l2n.layer_by_name ("poly_lbl"); - lmap [ly2.insert_layer (db::LayerProperties (4, 0))] = l2n.layer_by_name ("diff_cont"); - lmap [ly2.insert_layer (db::LayerProperties (5, 0))] = l2n.layer_by_name ("poly_cont"); - lmap [ly2.insert_layer (db::LayerProperties (6, 0))] = l2n.layer_by_name ("metal1"); - lmap [ly2.insert_layer (db::LayerProperties (6, 1))] = l2n.layer_by_name ("metal1_lbl"); - lmap [ly2.insert_layer (db::LayerProperties (7, 0))] = l2n.layer_by_name ("via1"); - lmap [ly2.insert_layer (db::LayerProperties (8, 0))] = l2n.layer_by_name ("metal2"); - lmap [ly2.insert_layer (db::LayerProperties (8, 1))] = l2n.layer_by_name ("metal2_lbl"); - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_by_name ("psd"); - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_by_name ("nsd"); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (3, 0))] = l2n.layer_index_by_name ("poly").value (); + lmap [ly2.insert_layer (db::LayerProperties (3, 1))] = l2n.layer_index_by_name ("poly_lbl").value (); + lmap [ly2.insert_layer (db::LayerProperties (4, 0))] = l2n.layer_index_by_name ("diff_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (5, 0))] = l2n.layer_index_by_name ("poly_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (6, 0))] = l2n.layer_index_by_name ("metal1").value (); + lmap [ly2.insert_layer (db::LayerProperties (6, 1))] = l2n.layer_index_by_name ("metal1_lbl").value (); + lmap [ly2.insert_layer (db::LayerProperties (7, 0))] = l2n.layer_index_by_name ("via1").value (); + lmap [ly2.insert_layer (db::LayerProperties (8, 0))] = l2n.layer_index_by_name ("metal2").value (); + lmap [ly2.insert_layer (db::LayerProperties (8, 1))] = l2n.layer_index_by_name ("metal2_lbl").value (); + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_index_by_name ("psd").value (); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_index_by_name ("nsd").value (); db::CellMapping cm = l2n.cell_mapping_into (ly2, top2); @@ -347,19 +347,19 @@ TEST(2_ReaderWithGlobalNets) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_by_name ("psd"); - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_by_name ("nsd"); - lmap [ly2.insert_layer (db::LayerProperties (12, 0))] = l2n.layer_by_name ("rbulk"); - lmap [ly2.insert_layer (db::LayerProperties (13, 0))] = l2n.layer_by_name ("ptie"); - lmap [ly2.insert_layer (db::LayerProperties (14, 0))] = l2n.layer_by_name ("ntie"); - lmap [ly2.insert_layer (db::LayerProperties (1, 0)) ] = l2n.layer_by_name ("nwell"); - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_by_name ("poly"); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_by_name ("diff_cont"); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_by_name ("poly_cont"); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_by_name ("metal1"); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_by_name ("via1"); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_by_name ("metal2"); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_index_by_name ("psd").value (); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_index_by_name ("nsd").value (); + lmap [ly2.insert_layer (db::LayerProperties (12, 0))] = l2n.layer_index_by_name ("rbulk").value (); + lmap [ly2.insert_layer (db::LayerProperties (13, 0))] = l2n.layer_index_by_name ("ptie").value (); + lmap [ly2.insert_layer (db::LayerProperties (14, 0))] = l2n.layer_index_by_name ("ntie").value (); + lmap [ly2.insert_layer (db::LayerProperties (1, 0)) ] = l2n.layer_index_by_name ("nwell").value (); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_index_by_name ("poly").value (); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_index_by_name ("diff_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_index_by_name ("poly_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_index_by_name ("metal1").value (); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_index_by_name ("via1").value (); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_index_by_name ("metal2").value (); l2n.build_all_nets (cm, ly2, lmap, "NET_", db::NPM_NoProperties, tl::Variant (), db::BNH_SubcircuitCells, "CIRCUIT_", "DEVICE_"); @@ -403,19 +403,19 @@ TEST(3_ReaderAbsoluteCoordinates) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_by_name ("psd"); - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_by_name ("nsd"); - lmap [ly2.insert_layer (db::LayerProperties (12, 0))] = l2n.layer_by_name ("rbulk"); - lmap [ly2.insert_layer (db::LayerProperties (13, 0))] = l2n.layer_by_name ("ptie"); - lmap [ly2.insert_layer (db::LayerProperties (14, 0))] = l2n.layer_by_name ("ntie"); - lmap [ly2.insert_layer (db::LayerProperties (1, 0)) ] = l2n.layer_by_name ("nwell"); - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_by_name ("poly"); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_by_name ("diff_cont"); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_by_name ("poly_cont"); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_by_name ("metal1"); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_by_name ("via1"); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_by_name ("metal2"); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_index_by_name ("psd").value (); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_index_by_name ("nsd").value (); + lmap [ly2.insert_layer (db::LayerProperties (12, 0))] = l2n.layer_index_by_name ("rbulk").value (); + lmap [ly2.insert_layer (db::LayerProperties (13, 0))] = l2n.layer_index_by_name ("ptie").value (); + lmap [ly2.insert_layer (db::LayerProperties (14, 0))] = l2n.layer_index_by_name ("ntie").value (); + lmap [ly2.insert_layer (db::LayerProperties (1, 0)) ] = l2n.layer_index_by_name ("nwell").value (); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_index_by_name ("poly").value (); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_index_by_name ("diff_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_index_by_name ("poly_cont").value (); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_index_by_name ("metal1").value (); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_index_by_name ("via1").value (); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_index_by_name ("metal2").value (); l2n.build_all_nets (cm, ly2, lmap, "NET_", db::NPM_NoProperties, tl::Variant (), db::BNH_SubcircuitCells, "CIRCUIT_", "DEVICE_"); @@ -461,7 +461,7 @@ TEST(4_ReaderCombinedDevices) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap = l2n.create_layermap (ly2, 1000); + std::map lmap = l2n.create_layermap (ly2, 1000); l2n.build_all_nets (cm, ly2, lmap, "NET_", db::NPM_NoProperties, tl::Variant (), db::BNH_SubcircuitCells, "CIRCUIT_", "DEVICE_"); diff --git a/src/db/unit_tests/dbLayoutToNetlistTests.cc b/src/db/unit_tests/dbLayoutToNetlistTests.cc index 8a00d69fe..6012110d9 100644 --- a/src/db/unit_tests/dbLayoutToNetlistTests.cc +++ b/src/db/unit_tests/dbLayoutToNetlistTests.cc @@ -386,15 +386,15 @@ TEST(1_BasicExtraction) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = &rpsd; - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = &rnsd; - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = rpoly.get (); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = rdiff_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = rpoly_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = rmetal1.get (); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = rvia1.get (); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = rmetal2.get (); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_of (rpsd); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_of (rnsd); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_of (*rpoly); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_of (*rdiff_cont); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_of (*rpoly_cont); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_of (*rmetal1); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_of (*rvia1); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_of (*rmetal2); l2n.build_all_nets (cm, ly2, lmap, 0, db::NPM_NoProperties, tl::Variant (), db::BNH_Disconnected, 0, 0); @@ -412,15 +412,15 @@ TEST(1_BasicExtraction) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = &rpsd; - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = &rnsd; - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = rpoly.get (); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = rdiff_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = rpoly_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = rmetal1.get (); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = rvia1.get (); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = rmetal2.get (); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_of (rpsd); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_of (rnsd); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_of (*rpoly); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_of (*rdiff_cont); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_of (*rpoly_cont); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_of (*rmetal1); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_of (*rvia1); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_of (*rmetal2); l2n.build_all_nets (cm, ly2, lmap, "NET_", db::NPM_NoProperties, tl::Variant (), db::BNH_Disconnected, 0, 0); @@ -438,15 +438,15 @@ TEST(1_BasicExtraction) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = &rpsd; - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = &rnsd; - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = rpoly.get (); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = rdiff_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = rpoly_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = rmetal1.get (); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = rvia1.get (); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = rmetal2.get (); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_of (rpsd); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_of (rnsd); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_of (*rpoly); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_of (*rdiff_cont); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_of (*rpoly_cont); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_of (*rmetal1); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_of (*rvia1); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_of (*rmetal2); l2n.build_all_nets (cm, ly2, lmap, 0, db::NPM_NoProperties, tl::Variant (), db::BNH_SubcircuitCells, "CIRCUIT_", 0); @@ -464,15 +464,15 @@ TEST(1_BasicExtraction) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = &rpsd; - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = &rnsd; - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = rpoly.get (); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = rdiff_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = rpoly_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = rmetal1.get (); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = rvia1.get (); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = rmetal2.get (); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_of (rpsd); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_of (rnsd); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_of (*rpoly); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_of (*rdiff_cont); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_of (*rpoly_cont); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_of (*rmetal1); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_of (*rvia1); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_of (*rmetal2); l2n.build_all_nets (cm, ly2, lmap, 0, db::NPM_AllProperties, tl::Variant (42), db::BNH_Flatten, 0, 0); @@ -490,15 +490,15 @@ TEST(1_BasicExtraction) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = &rpsd; - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = &rnsd; - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = rpoly.get (); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = rdiff_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = rpoly_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = rmetal1.get (); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = rvia1.get (); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = rmetal2.get (); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_of (rpsd); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_of (rnsd); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_of (*rpoly); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_of (*rdiff_cont); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_of (*rpoly_cont); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_of (*rmetal1); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_of (*rvia1); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_of (*rmetal2); l2n.build_all_nets (cm, ly2, lmap, 0, db::NPM_AllProperties, tl::Variant (42), db::BNH_SubcircuitCells, "CIRCUIT_", 0); @@ -516,15 +516,15 @@ TEST(1_BasicExtraction) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = &rpsd; - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = &rnsd; - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = rpoly.get (); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = rdiff_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = rpoly_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = rmetal1.get (); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = rvia1.get (); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = rmetal2.get (); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_of (rpsd); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_of (rnsd); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_of (*rpoly); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_of (*rdiff_cont); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_of (*rpoly_cont); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_of (*rmetal1); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_of (*rvia1); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_of (*rmetal2); l2n.build_all_nets (cm, ly2, lmap, "NET_", db::NPM_NoProperties, tl::Variant (), db::BNH_SubcircuitCells, "CIRCUIT_", "DEVICE_"); @@ -627,15 +627,15 @@ TEST(1_BasicExtraction) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = &rpsd; - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = &rnsd; - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = rpoly.get (); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = rdiff_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = rpoly_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = rmetal1.get (); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = rvia1.get (); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = rmetal2.get (); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_of (rpsd); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_of (rnsd); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_of (*rpoly); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_of (*rdiff_cont); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_of (*rpoly_cont); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_of (*rmetal1); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_of (*rvia1); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_of (*rmetal2); l2n.build_all_nets (cm, ly2, lmap, "NET_", db::NPM_NoProperties, tl::Variant (), db::BNH_SubcircuitCells, "CIRCUIT_", "DEVICE_"); diff --git a/src/db/unit_tests/dbLayoutToNetlistWriterTests.cc b/src/db/unit_tests/dbLayoutToNetlistWriterTests.cc index 70325f6ef..fa9d305a8 100644 --- a/src/db/unit_tests/dbLayoutToNetlistWriterTests.cc +++ b/src/db/unit_tests/dbLayoutToNetlistWriterTests.cc @@ -197,15 +197,15 @@ TEST(1_WriterBasic) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = &rpsd; - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = &rnsd; - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = rpoly.get (); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = rdiff_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = rpoly_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = rmetal1.get (); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = rvia1.get (); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = rmetal2.get (); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_of (rpsd); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_of (rnsd); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_of (*rpoly); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_of (*rdiff_cont); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_of (*rpoly_cont); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_of (*rmetal1); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_of (*rvia1); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_of (*rmetal2); l2n.build_all_nets (cm, ly2, lmap, "NET_", db::NPM_NoProperties, tl::Variant (), db::BNH_Disconnected, 0, "DEVICE_"); @@ -426,19 +426,19 @@ TEST(2_WriterWithGlobalNets) db::CellMapping cm = l2n.cell_mapping_into (ly2, top2, true /*with device cells*/); - std::map lmap; - lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = &rpsd; - lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = &rnsd; - lmap [ly2.insert_layer (db::LayerProperties (12, 0))] = rbulk.get (); - lmap [ly2.insert_layer (db::LayerProperties (13, 0))] = &rptie; - lmap [ly2.insert_layer (db::LayerProperties (14, 0))] = &rntie; - lmap [ly2.insert_layer (db::LayerProperties (1, 0)) ] = rnwell.get (); - lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = rpoly.get (); - lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = rdiff_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = rpoly_cont.get (); - lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = rmetal1.get (); - lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = rvia1.get (); - lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = rmetal2.get (); + std::map lmap; + lmap [ly2.insert_layer (db::LayerProperties (10, 0))] = l2n.layer_of (rpsd); + lmap [ly2.insert_layer (db::LayerProperties (11, 0))] = l2n.layer_of (rnsd); + lmap [ly2.insert_layer (db::LayerProperties (12, 0))] = l2n.layer_of (*rbulk); + lmap [ly2.insert_layer (db::LayerProperties (13, 0))] = l2n.layer_of (rptie); + lmap [ly2.insert_layer (db::LayerProperties (14, 0))] = l2n.layer_of (rntie); + lmap [ly2.insert_layer (db::LayerProperties (1, 0)) ] = l2n.layer_of (*rnwell); + lmap [ly2.insert_layer (db::LayerProperties (3, 0)) ] = l2n.layer_of (*rpoly); + lmap [ly2.insert_layer (db::LayerProperties (4, 0)) ] = l2n.layer_of (*rdiff_cont); + lmap [ly2.insert_layer (db::LayerProperties (5, 0)) ] = l2n.layer_of (*rpoly_cont); + lmap [ly2.insert_layer (db::LayerProperties (6, 0)) ] = l2n.layer_of (*rmetal1); + lmap [ly2.insert_layer (db::LayerProperties (7, 0)) ] = l2n.layer_of (*rvia1); + lmap [ly2.insert_layer (db::LayerProperties (8, 0)) ] = l2n.layer_of (*rmetal2); l2n.build_all_nets (cm, ly2, lmap, "NET_", db::NPM_NoProperties, tl::Variant (), db::BNH_SubcircuitCells, "CIRCUIT_", "DEVICE_"); diff --git a/src/layui/layui/layNetlistBrowserPage.cc b/src/layui/layui/layNetlistBrowserPage.cc index fd3f4d938..ce725e086 100644 --- a/src/layui/layui/layNetlistBrowserPage.cc +++ b/src/layui/layui/layNetlistBrowserPage.cc @@ -1858,7 +1858,7 @@ NetlistBrowserPage::export_nets (const std::vector *nets) cm = database->cell_mapping_into (target_layout, target_layout.cell (target_top_index), *nets); } - std::map lm = database->create_layermap (target_layout, dialog->start_layer_number ()); + std::map lm = database->create_layermap (target_layout, dialog->start_layer_number ()); database->build_nets (nets, cm, target_layout, lm, dialog->net_prefix ().empty () ? 0 : dialog->net_prefix ().c_str (),