mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	rtlil: Speeds up Yosys by 17%
This PR speeds up by roughly 17% across a wide spectrum of designs tested at Google. Particularly for the mux generation pass. Co-authored-by: Rasmus Larsen <rmlarsen@google.com> Signed-off-by: Ethan Mahintorabi <ethanmoon@google.com>
This commit is contained in:
		
							parent
							
								
									c4762d930e
								
							
						
					
					
						commit
						aa06809d64
					
				
					 1 changed files with 9 additions and 5 deletions
				
			
		|  | @ -4031,13 +4031,17 @@ void RTLIL::SigSpec::replace(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec | |||
| 	unpack(); | ||||
| 	other->unpack(); | ||||
| 
 | ||||
| 	dict<RTLIL::SigBit, int> pattern_to_with; | ||||
| 	for (int i = 0; i < GetSize(pattern.bits_); i++) { | ||||
| 		if (pattern.bits_[i].wire != NULL) { | ||||
| 			pattern_to_with.emplace(pattern.bits_[i], i); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	for (int j = 0; j < GetSize(bits_); j++) { | ||||
| 				if (bits_[j] == pattern.bits_[i]) { | ||||
| 					other->bits_[j] = with.bits_[i]; | ||||
| 				} | ||||
| 			} | ||||
| 		auto it = pattern_to_with.find(bits_[j]); | ||||
| 		if (it != pattern_to_with.end()) { | ||||
| 			other->bits_[j] = with.bits_[it->second]; | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue