diff --git a/src/db/db/dbNetlistCompare.cc b/src/db/db/dbNetlistCompare.cc index 22f5ae964..11fb51ba2 100644 --- a/src/db/db/dbNetlistCompare.cc +++ b/src/db/db/dbNetlistCompare.cc @@ -786,7 +786,7 @@ private: * @brief Compares edges as "less" * Edge comparison is based on the pins attached (name of the first pin). */ - static bool edge_less (const db::Net *a, const db::Net *b); + static bool net_less (const db::Net *a, const db::Net *b); /** * @brief Compares edges as "equal" @@ -1260,8 +1260,8 @@ NetGraphNode::operator< (const NetGraphNode &node) const } } if (m_edges.empty ()) { - // do a more detailed analysis on the edges - return edge_less (net (), node.net ()); + // do a more detailed analysis on the nets involved + return net_less (net (), node.net ()); } return false; } @@ -1285,7 +1285,7 @@ NetGraphNode::operator== (const NetGraphNode &node) const } bool -NetGraphNode::edge_less (const db::Net *a, const db::Net *b) +NetGraphNode::net_less (const db::Net *a, const db::Net *b) { if ((a != 0) != (b != 0)) { return (a != 0) < (b != 0); diff --git a/src/lvs/lvs/built-in-macros/_lvs_engine.rb b/src/lvs/lvs/built-in-macros/_lvs_engine.rb index 89805d316..bc928d1e6 100644 --- a/src/lvs/lvs/built-in-macros/_lvs_engine.rb +++ b/src/lvs/lvs/built-in-macros/_lvs_engine.rb @@ -131,6 +131,18 @@ module LVS # @synopsis max_res(threshold) # See \Netter#max_res for a description of that function. + # %LVS% + # @name max_branch_complexity + # @brief Configures the maximum branch complexity for ambiguous net matching + # @synopsis max_branch_complexity(n) + # See \Netter#max_branch_complexity for a description of that function. + + # %LVS% + # @name max_depth + # @brief Configures the maximum search depth for net match deduction + # @synopsis max_depth(n) + # See \Netter#max_depth for a description of that function. + %w(schematic compare same_nets same_circuits same_device_classes equivalent_pins min_caps max_res max_depth max_branch_complexity).each do |f| eval <<"CODE" def #{f}(*args) diff --git a/src/lvs/lvs/built-in-macros/_lvs_netter.rb b/src/lvs/lvs/built-in-macros/_lvs_netter.rb index 8a383f491..16014e9d0 100644 --- a/src/lvs/lvs/built-in-macros/_lvs_netter.rb +++ b/src/lvs/lvs/built-in-macros/_lvs_netter.rb @@ -371,11 +371,41 @@ module LVS @comparer.max_resistance = value.to_f end + # %LVS% + # @name max_depth + # @brief Configures the maximum search depth for net match deduction + # @synopsis max_depth(n) + # The netlist compare algorithm works recursively: once a net + # equivalence is established, additional matches are derived from + # this equivalence. Such equivalences in turn are used to derive + # new equivalences and so on. The maximum depth parameter configures + # the number of recursions the algorithm performs before picking + # the next net. With higher values for the depth, the algorithm + # pursues this "deduction path" in greater depth while with + # smaller values, the algorithm prefers picking nets in a random fashion + # as the seeds for this deduction path. The default value is 8. + def max_depth(value) lvs_data @comparer.max_depth = value.to_i end + # @name max_branch_complexity + # @brief Configures the maximum branch complexity for ambiguous net matching + # @synopsis max_branch_complexity(n) + # The netlist compare algorithm is basically a backtracing algorithm. + # With ambiguous nets, the algorithm picks possible net pairs and + # tries whether they will make a good match. Following the deduction + # path for this nets may lead to further branches if more ambiguous + # nets are encountered. To avoid combinational explosion, the maximum + # branch complexity is limited to the value configured with this + # function. The default value is 100 which means not more than + # 100 combinations are tried for a single seed pair. For networks + # with inherent ambiguity such as decoders, the complexity + # can be increased at the expense of potentially larger runtimes. + # The runtime penality is roughly proportional to the branch + # complexity. + def max_branch_complexity(value) lvs_data @comparer.max_branch_complexity = value.to_i diff --git a/src/lvs/unit_tests/lvsTests.cc b/src/lvs/unit_tests/lvsTests.cc index 6f4d51980..d3ce9fa7c 100644 --- a/src/lvs/unit_tests/lvsTests.cc +++ b/src/lvs/unit_tests/lvsTests.cc @@ -87,6 +87,8 @@ void run_test (tl::TestBase *_this, const std::string &suffix, const std::string // output, but this will essentially verify the output netlist's consistency. db::NetlistCrossReference xref; db::NetlistComparer comparer (&xref); + comparer.set_max_branch_complexity (500); + comparer.set_max_depth (20); bool res = comparer.compare (&nl1, &nl2); if (! res) { tl::info << "Netlist mismatch:";