mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 19:52:31 +00:00 
			
		
		
		
	fix enum in generate blocks
This commit is contained in:
		
							parent
							
								
									41a0a93dcc
								
							
						
					
					
						commit
						549deb6373
					
				
					 1 changed files with 20 additions and 0 deletions
				
			
		|  | @ -3097,6 +3097,26 @@ void AstNode::expand_genblock(std::string index_var, std::string prefix, std::ma | ||||||
| 				child->str = new_name; | 				child->str = new_name; | ||||||
| 			current_scope[new_name] = child; | 			current_scope[new_name] = child; | ||||||
| 		} | 		} | ||||||
|  | 		if (child->type == AST_ENUM){ | ||||||
|  | 			for (auto enode : child->children){ | ||||||
|  | 				log_assert(enode->type == AST_ENUM_ITEM); | ||||||
|  | 				if (backup_name_map.size() == 0) | ||||||
|  | 					backup_name_map = name_map; | ||||||
|  | 				std::string new_name = prefix[0] == '\\' ? prefix.substr(1) : prefix; | ||||||
|  | 				size_t pos = enode->str.rfind('.'); | ||||||
|  | 				if (pos == std::string::npos) | ||||||
|  | 					pos = enode->str[0] == '\\' && prefix[0] == '\\' ? 1 : 0; | ||||||
|  | 				else | ||||||
|  | 					pos = pos + 1; | ||||||
|  | 				new_name = enode->str.substr(0, pos) + new_name + enode->str.substr(pos); | ||||||
|  | 				if (new_name[0] != '$' && new_name[0] != '\\') | ||||||
|  | 					new_name = prefix[0] + new_name; | ||||||
|  | 				name_map[enode->str] = new_name; | ||||||
|  | 
 | ||||||
|  | 				enode->str = new_name; | ||||||
|  | 				current_scope[new_name] = enode; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	for (size_t i = 0; i < children.size(); i++) { | 	for (size_t i = 0; i < children.size(); i++) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue