mirror of https://github.com/KLayout/klayout.git
WIP: using net name/circuit name instead of net ID for property value as this is more stable for better regression testing.
Bug fix: re-enabling of trace all nets tests, establishing dummy names for layers in all cases - otherwise layers do not have a reference for LayoutToNetlist persistence.
This commit is contained in:
parent
234df5a560
commit
7ba3133afc
|
|
@ -158,9 +158,7 @@ db::Region *LayoutToNetlist::make_layer (const std::string &n)
|
|||
si.shape_flags (db::ShapeIterator::Nothing);
|
||||
|
||||
std::unique_ptr <db::Region> region (new db::Region (si, dss ()));
|
||||
if (! n.empty ()) {
|
||||
register_layer (*region, n);
|
||||
}
|
||||
register_layer (*region, n);
|
||||
return region.release ();
|
||||
}
|
||||
|
||||
|
|
@ -171,9 +169,7 @@ db::Region *LayoutToNetlist::make_layer (unsigned int layer_index, const std::st
|
|||
si.shape_flags (db::ShapeIterator::All);
|
||||
|
||||
std::unique_ptr <db::Region> region (new db::Region (si, dss ()));
|
||||
if (! n.empty ()) {
|
||||
register_layer (*region, n);
|
||||
}
|
||||
register_layer (*region, n);
|
||||
return region.release ();
|
||||
}
|
||||
|
||||
|
|
@ -184,9 +180,7 @@ db::Texts *LayoutToNetlist::make_text_layer (unsigned int layer_index, const std
|
|||
si.shape_flags (db::ShapeIterator::Texts);
|
||||
|
||||
std::unique_ptr <db::Texts> texts (new db::Texts (si, dss ()));
|
||||
if (! n.empty ()) {
|
||||
register_layer (*texts, n);
|
||||
}
|
||||
register_layer (*texts, n);
|
||||
return texts.release ();
|
||||
}
|
||||
|
||||
|
|
@ -197,9 +191,7 @@ db::Region *LayoutToNetlist::make_polygon_layer (unsigned int layer_index, const
|
|||
si.shape_flags (db::ShapeIterator::Paths | db::ShapeIterator::Polygons | db::ShapeIterator::Boxes);
|
||||
|
||||
std::unique_ptr <db::Region> region (new db::Region (si, dss ()));
|
||||
if (! n.empty ()) {
|
||||
register_layer (*region, n);
|
||||
}
|
||||
register_layer (*region, n);
|
||||
return region.release ();
|
||||
}
|
||||
|
||||
|
|
@ -434,6 +426,7 @@ void LayoutToNetlist::mem_stat (MemStatistics *stat, MemStatistics::purpose_t pu
|
|||
db::mem_stat (stat, purpose, cat, m_named_regions, 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_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);
|
||||
|
|
@ -538,11 +531,11 @@ db::Region *LayoutToNetlist::layer_by_name (const std::string &name)
|
|||
|
||||
db::Region *LayoutToNetlist::layer_by_index (unsigned int index)
|
||||
{
|
||||
auto n = m_name_of_layer.find (index);
|
||||
if (n == m_name_of_layer.end ()) {
|
||||
auto n = m_region_of_layer.find (index);
|
||||
if (n == m_region_of_layer.end ()) {
|
||||
return 0;
|
||||
} else {
|
||||
return layer_by_name (n->second);
|
||||
return new db::Region (new db::DeepRegion (n->second));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -587,16 +580,19 @@ std::string LayoutToNetlist::name (const ShapeCollection &coll) const
|
|||
}
|
||||
}
|
||||
|
||||
void LayoutToNetlist::register_layer (const ShapeCollection &collection, const std::string &n)
|
||||
void 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 ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("The layer is already registered")));
|
||||
}
|
||||
|
||||
if (! n.empty () && m_named_regions.find (n) != m_named_regions.end ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("Layer name is already used: ")) + n);
|
||||
if (! n_in.empty () && m_named_regions.find (n_in) != m_named_regions.end ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("Layer name is already used: ")) + n_in);
|
||||
}
|
||||
|
||||
// Caution: this make create names which clash with future explicit names. Hopefully, the generated names are unique enough.
|
||||
std::string n = n_in.empty () ? make_new_name () : n_in;
|
||||
|
||||
db::DeepLayer dl;
|
||||
|
||||
if (m_is_flat) {
|
||||
|
|
@ -612,11 +608,6 @@ void LayoutToNetlist::register_layer (const ShapeCollection &collection, const s
|
|||
|
||||
} else {
|
||||
|
||||
if (is_persisted (collection)) {
|
||||
std::string prev_name = name (collection);
|
||||
m_named_regions.erase (prev_name);
|
||||
}
|
||||
|
||||
dl = delegate->deep_layer ();
|
||||
|
||||
}
|
||||
|
|
@ -624,11 +615,9 @@ void LayoutToNetlist::register_layer (const ShapeCollection &collection, const s
|
|||
}
|
||||
|
||||
m_region_by_original [tl::id_of (collection.get_delegate ())] = dl;
|
||||
|
||||
if (! n.empty ()) {
|
||||
m_named_regions [n] = dl;
|
||||
m_name_of_layer [dl.layer ()] = n;
|
||||
}
|
||||
m_region_of_layer [dl.layer ()] = dl;
|
||||
m_named_regions [n] = dl;
|
||||
m_name_of_layer [dl.layer ()] = n;
|
||||
}
|
||||
|
||||
db::DeepLayer LayoutToNetlist::deep_layer_of (const db::ShapeCollection &coll) const
|
||||
|
|
@ -1882,11 +1871,11 @@ NetBuilder::make_netname_propid (db::PropertiesRepository &pr, NetPropertyMode n
|
|||
|
||||
if (! netname_prop.is_nil ()) {
|
||||
db::property_names_id_type name_propnameid = pr.prop_name_id (netname_prop);
|
||||
if (net_prop_mode == NPM_NetNameAndIDOnly) {
|
||||
if (net_prop_mode == NPM_NetQualifiedNameOnly) {
|
||||
std::vector<tl::Variant> l;
|
||||
l.reserve (2);
|
||||
l.push_back (tl::Variant (net.expanded_name ()));
|
||||
l.push_back (tl::Variant (reinterpret_cast <size_t> (&net)));
|
||||
l.push_back (tl::Variant (net.circuit ()->name ()));
|
||||
propset.insert (std::make_pair (name_propnameid, tl::Variant (l)));
|
||||
} else if (net_prop_mode == NPM_NetIDOnly) {
|
||||
propset.insert (std::make_pair (name_propnameid, tl::Variant (reinterpret_cast <size_t> (&net))));
|
||||
|
|
|
|||
|
|
@ -941,6 +941,7 @@ private:
|
|||
std::map<std::string, db::DeepLayer> m_named_regions;
|
||||
std::map<unsigned int, std::string> m_name_of_layer;
|
||||
std::map<tl::id_type, db::DeepLayer> m_region_by_original;
|
||||
std::map<unsigned int, db::DeepLayer> m_region_of_layer;
|
||||
bool m_netlist_extracted;
|
||||
bool m_is_flat;
|
||||
double m_device_scaling;
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ enum NetPropertyMode
|
|||
NPM_NetIDOnly,
|
||||
|
||||
/**
|
||||
* @brief Like NetNameOnly, but use a tuple of name and ID
|
||||
* @brief Like NetNameOnly, but use a tuple of net and circuit name
|
||||
*/
|
||||
NPM_NetNameAndIDOnly,
|
||||
NPM_NetQualifiedNameOnly,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -747,7 +747,7 @@ fill_region_multi (const db::Region *fr, db::Cell *cell, db::cell_index_type fil
|
|||
static db::Region
|
||||
nets (const db::Region *region, db::LayoutToNetlist &l2n, const tl::Variant &net_prop_name, const std::vector<const db::Net *> *net_filter)
|
||||
{
|
||||
return region->nets (l2n, net_prop_name.is_nil () ? db::NPM_NoProperties : db::NPM_NetNameAndIDOnly, net_prop_name, net_filter);
|
||||
return region->nets (l2n, net_prop_name.is_nil () ? db::NPM_NoProperties : db::NPM_NetQualifiedNameOnly, net_prop_name, net_filter);
|
||||
}
|
||||
|
||||
static db::Region
|
||||
|
|
|
|||
|
|
@ -131,11 +131,11 @@ void run_test (tl::TestBase *_this, bool flat, bool flat_nets, const std::string
|
|||
|
||||
l2n->extract_netlist ();
|
||||
|
||||
db::Region rmetal1_nets = rmetal1.nets (*l2n, db::NPM_NetNameAndIDOnly, tl::Variant (1));
|
||||
db::Region rmetal1_nets = rmetal1.nets (*l2n, db::NPM_NetQualifiedNameOnly, tl::Variant (1));
|
||||
if (! flat) {
|
||||
EXPECT_EQ (dss.has_net_builder_for (0, l2n.get ()), true);
|
||||
}
|
||||
db::Region rmetal2_nets = rmetal2.nets (*l2n, db::NPM_NetNameAndIDOnly, tl::Variant (1));
|
||||
db::Region rmetal2_nets = rmetal2.nets (*l2n, db::NPM_NetQualifiedNameOnly, tl::Variant (1));
|
||||
|
||||
db::Region res1 = rmetal1_nets.bool_and (rmetal2_nets, db::SamePropertiesConstraint);
|
||||
db::Region res2 = rmetal1_nets.bool_and (rmetal2_nets, db::DifferentPropertiesConstraint);
|
||||
|
|
|
|||
|
|
@ -829,9 +829,7 @@ NetTracerLayerExpression::make_l2n_region (db::LayoutToNetlist &l2n, std::map <u
|
|||
*res -= *rhb->get ();
|
||||
}
|
||||
|
||||
if (! name.empty ()) {
|
||||
l2n.register_layer (*res, name);
|
||||
}
|
||||
l2n.register_layer (*res, name);
|
||||
|
||||
return tl::shared_ptr<NetTracerLayerExpression::RegionHolder> (new NetTracerLayerExpression::RegionHolder (res.release ()));
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue