mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Fixes #3515
This commit is contained in:
		
							parent
							
								
									d02ae8f2fc
								
							
						
					
					
						commit
						8abaf8240d
					
				
					 2 changed files with 16 additions and 1 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -8,6 +8,7 @@ __pycache__
 | 
				
			||||||
/.cproject
 | 
					/.cproject
 | 
				
			||||||
/.project
 | 
					/.project
 | 
				
			||||||
/.settings
 | 
					/.settings
 | 
				
			||||||
 | 
					/.vscode
 | 
				
			||||||
/qtcreator.files
 | 
					/qtcreator.files
 | 
				
			||||||
/qtcreator.includes
 | 
					/qtcreator.includes
 | 
				
			||||||
/qtcreator.config
 | 
					/qtcreator.config
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -911,6 +911,10 @@ class SubCircuit::SolverWorker
 | 
				
			||||||
	bool pruneEnumerationMatrix(std::vector<std::set<int>> &enumerationMatrix, const GraphData &needle, const GraphData &haystack, int &nextRow, bool allowOverlap)
 | 
						bool pruneEnumerationMatrix(std::vector<std::set<int>> &enumerationMatrix, const GraphData &needle, const GraphData &haystack, int &nextRow, bool allowOverlap)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		bool didSomething = true;
 | 
							bool didSomething = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Map of j:[i where j is used]
 | 
				
			||||||
 | 
							std::map<int, std::set<int>> usedNodes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		while (didSomething)
 | 
							while (didSomething)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			nextRow = -1;
 | 
								nextRow = -1;
 | 
				
			||||||
| 
						 | 
					@ -922,13 +926,23 @@ class SubCircuit::SolverWorker
 | 
				
			||||||
						didSomething = true;
 | 
											didSomething = true;
 | 
				
			||||||
					else if (!allowOverlap && haystack.usedNodes[j])
 | 
										else if (!allowOverlap && haystack.usedNodes[j])
 | 
				
			||||||
						didSomething = true;
 | 
											didSomething = true;
 | 
				
			||||||
					else
 | 
										else {
 | 
				
			||||||
						newRow.insert(j);
 | 
											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)
 | 
									if (newRow.size() == 0)
 | 
				
			||||||
					return false;
 | 
										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()))
 | 
									if (newRow.size() >= 2 && (nextRow < 0 || needle.adjMatrix.at(nextRow).size() < needle.adjMatrix.at(i).size()))
 | 
				
			||||||
					nextRow = i;
 | 
										nextRow = i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				enumerationMatrix[i].swap(newRow);
 | 
									enumerationMatrix[i].swap(newRow);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue