From: Clifford Wolf Date: Sun, 3 Mar 2013 19:33:55 +0000 (+0100) Subject: Fixed subcircuit allowOverlap=false corner case X-Git-Tag: yosys-0.2.0~753 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=40646d3516c27210fed90666e448c0915690e3a1;p=yosys.git Fixed subcircuit allowOverlap=false corner case --- diff --git a/libs/subcircuit/subcircuit.cc b/libs/subcircuit/subcircuit.cc index 0138d5a0f..73152c3b8 100644 --- a/libs/subcircuit/subcircuit.cc +++ b/libs/subcircuit/subcircuit.cc @@ -844,7 +844,7 @@ class SubCircuit::SolverWorker return true; } - bool pruneEnumerationMatrix(std::vector> &enumerationMatrix, const GraphData &needle, const GraphData &haystack, int &nextRow) + bool pruneEnumerationMatrix(std::vector> &enumerationMatrix, const GraphData &needle, const GraphData &haystack, int &nextRow, bool allowOverlap) { bool didSomething = true; while (didSomething) @@ -854,10 +854,12 @@ class SubCircuit::SolverWorker for (int i = 0; i < int(enumerationMatrix.size()); i++) { std::set newRow; for (int j : enumerationMatrix[i]) { - if (checkEnumerationMatrix(enumerationMatrix, i, j, needle, haystack)) - newRow.insert(j); - else + if (!checkEnumerationMatrix(enumerationMatrix, i, j, needle, haystack)) + didSomething = true; + else if (!allowOverlap && haystack.usedNodes[j]) didSomething = true; + else + newRow.insert(j); } if (newRow.size() == 0) return false; @@ -1028,7 +1030,7 @@ class SubCircuit::SolverWorker void ullmannRecursion(std::vector &results, std::vector> &enumerationMatrix, int iter, const GraphData &needle, GraphData &haystack, bool allowOverlap, int limitResults) { int i = -1; - if (!pruneEnumerationMatrix(enumerationMatrix, needle, haystack, i)) + if (!pruneEnumerationMatrix(enumerationMatrix, needle, haystack, i, allowOverlap)) return; if (i < 0)