3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-18 06:39:03 +00:00
This commit is contained in:
De hekkende krekker 2025-03-20 05:10:21 -06:00 committed by GitHub
commit 295f9fcf3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

1
.gitignore vendored
View file

@ -11,6 +11,7 @@ __pycache__
/.cproject
/.project
/.settings
/.vscode
/qtcreator.files
/qtcreator.includes
/qtcreator.config

View file

@ -912,6 +912,10 @@ class SubCircuit::SolverWorker
bool pruneEnumerationMatrix(std::vector<std::set<int>> &enumerationMatrix, const GraphData &needle, const GraphData &haystack, int &nextRow, bool allowOverlap)
{
bool didSomething = true;
// Map of j:[i where j is used]
std::map<int, std::set<int>> usedNodes;
while (didSomething)
{
nextRow = -1;
@ -923,13 +927,23 @@ class SubCircuit::SolverWorker
didSomething = true;
else if (!allowOverlap && haystack.usedNodes[j])
didSomething = true;
else
else {
newRow.insert(j);
usedNodes[j].insert(i); // Store the needle index by haystack node index
}
}
// This indicates there are no available haystack nodes to assign to the needle
if (newRow.size() == 0)
return false;
// If there are multiple needles assigned to the haystack node, the solution is invalid
if (newRow.size() == 1 && usedNodes[*newRow.begin()].size() > 1)
return false;
if (newRow.size() >= 2 && (nextRow < 0 || needle.adjMatrix.at(nextRow).size() < needle.adjMatrix.at(i).size()))
nextRow = i;
enumerationMatrix[i].swap(newRow);
}
}