mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	subcircuit library: implied allExtern for mining
This commit is contained in:
		
							parent
							
								
									84cdfa55fc
								
							
						
					
					
						commit
						8689f5d339
					
				
					 3 changed files with 9 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -333,10 +333,6 @@ at most maxNodes nodes that occurs at least minMatches times:
 | 
			
		|||
	std::vector<SubCircuit::Solver::MineResult> results;
 | 
			
		||||
	mySolver.mine(results, minNodes, maxNodes, minMatches);
 | 
			
		||||
 | 
			
		||||
The miner works by finding frequent pairs of nodes and then combining them
 | 
			
		||||
to larger subcircuits. Because of this incremental strategy the miner only
 | 
			
		||||
works as expected on graphs with markAllExtern() set.
 | 
			
		||||
 | 
			
		||||
The mine() method has an optional fifth parameter that limits the number
 | 
			
		||||
of matches counted in one graph. This can be useful when mining for circuits
 | 
			
		||||
that are found in at least a number of graphs. E.g. the following call
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1155,7 +1155,6 @@ class SubCircuit::SolverWorker
 | 
			
		|||
		for (auto &it : graphData)
 | 
			
		||||
		{
 | 
			
		||||
			GraphData &haystack = it.second;
 | 
			
		||||
			assert(haystack.graph.allExtern);
 | 
			
		||||
 | 
			
		||||
			std::vector<std::set<int>> enumerationMatrix;
 | 
			
		||||
			std::map<std::string, std::set<std::string>> initialMappings;
 | 
			
		||||
| 
						 | 
				
			
			@ -1176,6 +1175,7 @@ class SubCircuit::SolverWorker
 | 
			
		|||
		for (int nodeIdx : testSet.nodes)
 | 
			
		||||
			needle_nodes.push_back(graph.nodes[nodeIdx].nodeId);
 | 
			
		||||
		needle.graph = Graph(graph, needle_nodes);
 | 
			
		||||
		needle.graph.markAllExtern();
 | 
			
		||||
		diCache.add(needle.graph, needle.adjMatrix, graphId, userSolver);
 | 
			
		||||
 | 
			
		||||
		std::vector<Solver::Result> ullmannResults;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,9 @@ graph macc22
 | 
			
		|||
	node add_1 add A 32 B 32 Y 32
 | 
			
		||||
	connect mul_1 Y add_1 A
 | 
			
		||||
	connect mul_2 Y add_1 B
 | 
			
		||||
	allextern
 | 
			
		||||
	extern mul_1 A B
 | 
			
		||||
	extern mul_2 A B
 | 
			
		||||
	extern add_1 Y
 | 
			
		||||
endgraph
 | 
			
		||||
 | 
			
		||||
graph macc4x2
 | 
			
		||||
| 
						 | 
				
			
			@ -24,7 +26,11 @@ graph macc4x2
 | 
			
		|||
	connect mul_4 Y add_2 B
 | 
			
		||||
	connect add_1 Y add_3 A
 | 
			
		||||
	connect add_2 Y add_3 B
 | 
			
		||||
	allextern
 | 
			
		||||
	extern mul_1 A B
 | 
			
		||||
	extern mul_2 A B
 | 
			
		||||
	extern mul_3 A B
 | 
			
		||||
	extern mul_4 A B
 | 
			
		||||
	extern add_3 Y
 | 
			
		||||
endgraph
 | 
			
		||||
 | 
			
		||||
swapgroup mul A B
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue