mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	fix bug introduced by not taking all of PeterCrozier's changes in 16ea4ea6
				
					
				
			The if(str == node->str) is in fact necessary (otherwise causes generate for in Multiplier_2D in tests/simple/multiplier.v to fail with error message "Right hand side of 3rd expression of generate for-loop is not constant!"). Note: in PeterCrozier's implementation, the break only breaks out of the switch-case, not the outer for loop.
This commit is contained in:
		
							parent
							
								
									8ef5c7d48c
								
							
						
					
					
						commit
						98c6bd7630
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -324,7 +324,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
 | 
				
			||||||
		const_fold = true;
 | 
							const_fold = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// in certain cases a function must be evaluated constant. this is what in_param controls.
 | 
						// in certain cases a function must be evaluated constant. this is what in_param controls.
 | 
				
			||||||
	if (type == AST_PARAMETER || type == AST_LOCALPARAM || type == AST_LOCALPARAM || type == AST_ENUM_ITEM || type == AST_DEFPARAM || type == AST_PARASET || type == AST_PREFIX)
 | 
						if (type == AST_PARAMETER || type == AST_LOCALPARAM || type == AST_ENUM_ITEM || type == AST_DEFPARAM || type == AST_PARASET || type == AST_PREFIX)
 | 
				
			||||||
		in_param = true;
 | 
							in_param = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::map<std::string, AstNode*> backup_scope;
 | 
						std::map<std::string, AstNode*> backup_scope;
 | 
				
			||||||
| 
						 | 
					@ -1089,8 +1089,10 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
 | 
				
			||||||
				case AST_TASK:
 | 
									case AST_TASK:
 | 
				
			||||||
				case AST_DPI_FUNCTION:
 | 
									case AST_DPI_FUNCTION:
 | 
				
			||||||
					//log("found child %s, %s\n", type2str(node->type).c_str(), node->str.c_str());
 | 
										//log("found child %s, %s\n", type2str(node->type).c_str(), node->str.c_str());
 | 
				
			||||||
					log("add %s, type %s to scope\n", str.c_str(), type2str(node->type).c_str());
 | 
										if (str == node->str) {
 | 
				
			||||||
					current_scope[node->str] = node;
 | 
											log("add %s, type %s to scope\n", str.c_str(), type2str(node->type).c_str());
 | 
				
			||||||
 | 
											current_scope[node->str] = node;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case AST_ENUM:
 | 
									case AST_ENUM:
 | 
				
			||||||
					for (auto enum_node : node->children) {
 | 
										for (auto enum_node : node->children) {
 | 
				
			||||||
| 
						 | 
					@ -1327,7 +1329,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (buf->type != AST_CONSTANT)
 | 
								if (buf->type != AST_CONSTANT)
 | 
				
			||||||
				log_file_error(filename, linenum, "Right hand side of 3rd expression of generate for-loop is not constant!\n");
 | 
									log_file_error(filename, linenum, "Right hand side of 3rd expression of generate for-loop is not constant (%s)!\n", type2str(buf->type).c_str());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			delete varbuf->children[0];
 | 
								delete varbuf->children[0];
 | 
				
			||||||
			varbuf->children[0] = buf;
 | 
								varbuf->children[0] = buf;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue