From 4ce37160d57195a7dd1decdd3820e3c23fcb5870 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 23 Oct 2019 23:46:25 +0200 Subject: [PATCH] Two bug fixes in net compare (tests required): - name compare of net names wasn't always case insensitive - tentative evaluation was sometimes continued even after a contradiction was detected because the return codes of different edge examinations were not combined correctly. --- src/db/db/dbNetlistCompare.cc | 27 ++++++++++++++++++---- src/lvs/lvs/built-in-macros/_lvs_netter.rb | 4 ---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/db/db/dbNetlistCompare.cc b/src/db/db/dbNetlistCompare.cc index afbc3b41e..d51a4b33c 100644 --- a/src/db/db/dbNetlistCompare.cc +++ b/src/db/db/dbNetlistCompare.cc @@ -32,7 +32,7 @@ // verbose debug output // TODO: make this a feature? -// #define PRINT_DEBUG_NETCOMPARE +#define PRINT_DEBUG_NETCOMPARE // verbose net graph output // TODO: make this a feature? @@ -1561,6 +1561,9 @@ NetGraph::derive_node_identities_for_edges (NetGraphNode::edge_iterator e, NetGr if (tentative) { if (nodes.size () != other_nodes.size ()) { +#if defined(PRINT_DEBUG_NETCOMPARE) + tl::info << indent(depth) << "! rejected branch."; +#endif return std::numeric_limits::max (); } @@ -1568,6 +1571,9 @@ NetGraph::derive_node_identities_for_edges (NetGraphNode::edge_iterator e, NetGr if (nodes.size () > 1 || other_nodes.size () > 1) { for (size_t i = 0; i < nodes.size (); ++i) { if (! (*nodes[i] == *other_nodes[i])) { +#if defined(PRINT_DEBUG_NETCOMPARE) + tl::info << indent(depth) << "! rejected branch."; +#endif return std::numeric_limits::max (); } } @@ -1582,6 +1588,9 @@ NetGraph::derive_node_identities_for_edges (NetGraphNode::edge_iterator e, NetGr if (bt_count == std::numeric_limits::max ()) { if (tentative) { +#if defined(PRINT_DEBUG_NETCOMPARE) + tl::info << indent(depth) << "! rejected branch."; +#endif return bt_count; } } else { @@ -1617,6 +1626,8 @@ NetGraph::derive_node_identities (size_t net_index, size_t depth, size_t n_branc #if defined(PRINT_DEBUG_NETCOMPARE) if (! tentative) { tl::info << indent(depth) << "deducing from pair: " << n->net ()->expanded_name () << " vs. " << n_other->net ()->expanded_name (); + } else { + tl::info << indent(depth) << "tentatively deducing from pair: " << n->net ()->expanded_name () << " vs. " << n_other->net ()->expanded_name (); } #endif @@ -1661,7 +1672,15 @@ NetGraph::derive_node_identities (size_t net_index, size_t depth, size_t n_branc ++ee_other; } - new_nodes += derive_node_identities_for_edges (e, ee, e_other, ee_other, net_index, other_net_index, depth, n_branch, tentative, with_ambiguous, data); + size_t bt_count = derive_node_identities_for_edges (e, ee, e_other, ee_other, net_index, other_net_index, depth, n_branch, tentative, with_ambiguous, data); + if (bt_count == std::numeric_limits::max ()) { +#if defined(PRINT_DEBUG_NETCOMPARE) + tl::info << indent(depth) << "! rejected pair."; +#endif + return bt_count; + } else { + new_nodes += bt_count; + } } @@ -1686,7 +1705,7 @@ namespace { bool operator() (const NetGraphNode *a, const NetGraphNode *b) const { tl_assert (a->net () && b->net ()); - return a->net ()->name () < b->net ()->name (); + return name_compare (a->net ()->name (), b->net ()->name ()) < 0; } }; @@ -1747,7 +1766,7 @@ static bool net_names_are_different (const db::Net *a, const db::Net *b) if (! a || ! b || a->name ().empty () || b->name ().empty ()) { return false; } else { - return (a->name () != b->name ()); + return name_compare (a->name (), b->name ()) != 0; } } diff --git a/src/lvs/lvs/built-in-macros/_lvs_netter.rb b/src/lvs/lvs/built-in-macros/_lvs_netter.rb index 41c639a04..ca5fcf5fa 100644 --- a/src/lvs/lvs/built-in-macros/_lvs_netter.rb +++ b/src/lvs/lvs/built-in-macros/_lvs_netter.rb @@ -472,7 +472,6 @@ module LVS # with a capacitance values below the given threshold (in Farad). def min_caps(value) - lvs_data v = value.to_f @comparer_config << lambda { |comparer| comparer.min_capacitance = v } end @@ -485,7 +484,6 @@ module LVS # with a resistance value above the given threshold (in Farad). def max_res(value) - lvs_data v = value.to_f @comparer_config << lambda { |comparer| comparer.max_resistance = v } end @@ -505,7 +503,6 @@ module LVS # as the seeds for this deduction path. The default value is 8. def max_depth(value) - lvs_data v = value.to_i @comparer_config << lambda { |comparer| comparer.max_depth = v } end @@ -527,7 +524,6 @@ module LVS # complexity. def max_branch_complexity(value) - lvs_data v = value.to_i @comparer_config << lambda { |comparer| comparer.max_branch_complexity = v } end