mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-29 18:52:30 +00:00 
			
		
		
		
	Fixed handling of re-declarations of wires in tasks and functions
This commit is contained in:
		
							parent
							
								
									e61c7f887a
								
							
						
					
					
						commit
						c86fbae3d1
					
				
					 1 changed files with 26 additions and 7 deletions
				
			
		|  | @ -1774,6 +1774,7 @@ skip_dynamic_range_lvalue_expansion:; | ||||||
| 		size_t arg_count = 0; | 		size_t arg_count = 0; | ||||||
| 		std::map<std::string, std::string> replace_rules; | 		std::map<std::string, std::string> replace_rules; | ||||||
| 		vector<AstNode*> added_mod_children; | 		vector<AstNode*> added_mod_children; | ||||||
|  | 		dict<std::string, AstNode*> wire_cache; | ||||||
| 
 | 
 | ||||||
| 		if (current_block == NULL) | 		if (current_block == NULL) | ||||||
| 		{ | 		{ | ||||||
|  | @ -1868,13 +1869,31 @@ skip_dynamic_range_lvalue_expansion:; | ||||||
| 		for (auto child : decl->children) | 		for (auto child : decl->children) | ||||||
| 			if (child->type == AST_WIRE || child->type == AST_PARAMETER || child->type == AST_LOCALPARAM) | 			if (child->type == AST_WIRE || child->type == AST_PARAMETER || child->type == AST_LOCALPARAM) | ||||||
| 			{ | 			{ | ||||||
| 				AstNode *wire = child->clone(); | 				AstNode *wire = nullptr; | ||||||
| 				wire->str = prefix + wire->str; | 
 | ||||||
| 				wire->port_id = 0; | 				if (wire_cache.count(child->str)) | ||||||
| 				wire->is_input = false; | 				{ | ||||||
| 				wire->is_output = false; | 					wire = wire_cache.at(child->str); | ||||||
| 				current_ast_mod->children.push_back(wire); | 					if (wire->children.empty()) { | ||||||
| 				added_mod_children.push_back(wire); | 						for (auto c : child->children) | ||||||
|  | 							wire->children.push_back(c->clone()); | ||||||
|  | 					} else { | ||||||
|  | 						if (!child->children.empty()) | ||||||
|  | 							log_error("Incompatible re-declaration of wire %s at %s:%d.\n", child->str.c_str(), filename.c_str(), linenum); | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 				else | ||||||
|  | 				{ | ||||||
|  | 					wire = child->clone(); | ||||||
|  | 					wire->str = prefix + wire->str; | ||||||
|  | 					wire->port_id = 0; | ||||||
|  | 					wire->is_input = false; | ||||||
|  | 					wire->is_output = false; | ||||||
|  | 					wire_cache[child->str] = wire; | ||||||
|  | 
 | ||||||
|  | 					current_ast_mod->children.push_back(wire); | ||||||
|  | 					added_mod_children.push_back(wire); | ||||||
|  | 				} | ||||||
| 
 | 
 | ||||||
| 				if (child->type == AST_WIRE) | 				if (child->type == AST_WIRE) | ||||||
| 					while (wire->simplify(true, false, false, 1, -1, false, false)) { } | 					while (wire->simplify(true, false, false, 1, -1, false, false)) { } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue