mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	In the Verilog backend, only sort modules that we're going to emit.
If you have a large design with a lot of modules and you use the Verilog backend to emit modules one at a time to separate files, performance is very low. The problem is that the Verilog backend calls `design->sort()` every time, which sorts the contents of all modules, and this is slow even when everything is already sorted. We can easily fix this by only sorting the contents of modules that we're actually going to emit.
This commit is contained in:
		
							parent
							
								
									aa1daa7023
								
							
						
					
					
						commit
						f25f8fe7c4
					
				
					 3 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1139,6 +1139,12 @@ void RTLIL::Design::sort()
 | 
			
		|||
		it.second->sort();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RTLIL::Design::sort_modules()
 | 
			
		||||
{
 | 
			
		||||
	scratchpad.sort();
 | 
			
		||||
	modules_.sort(sort_by_id_str());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RTLIL::Design::check()
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1368,6 +1368,7 @@ struct RTLIL::Design
 | 
			
		|||
	std::string scratchpad_get_string(const std::string &varname, const std::string &default_value = std::string()) const;
 | 
			
		||||
 | 
			
		||||
	void sort();
 | 
			
		||||
	void sort_modules();
 | 
			
		||||
	void check();
 | 
			
		||||
	void optimize();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue