mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	ast: cap dynamic range select to size of signal, suppresses warnings
This commit is contained in:
		
							parent
							
								
									5132f4099b
								
							
						
					
					
						commit
						c22fb76664
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -1732,8 +1732,9 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
 | 
				
			||||||
			AstNode *cond = new AstNode(AST_COND, mkconst_int(start_bit, true));
 | 
								AstNode *cond = new AstNode(AST_COND, mkconst_int(start_bit, true));
 | 
				
			||||||
			AstNode *lvalue = children[0]->clone();
 | 
								AstNode *lvalue = children[0]->clone();
 | 
				
			||||||
			lvalue->delete_children();
 | 
								lvalue->delete_children();
 | 
				
			||||||
 | 
								int end_bit = std::min(start_bit+result_width,source_width) - 1;
 | 
				
			||||||
			lvalue->children.push_back(new AstNode(AST_RANGE,
 | 
								lvalue->children.push_back(new AstNode(AST_RANGE,
 | 
				
			||||||
					mkconst_int(start_bit+result_width-1, true), mkconst_int(start_bit, true)));
 | 
										mkconst_int(end_bit, true), mkconst_int(start_bit, true)));
 | 
				
			||||||
			cond->children.push_back(new AstNode(AST_BLOCK, new AstNode(type, lvalue, children[1]->clone())));
 | 
								cond->children.push_back(new AstNode(AST_BLOCK, new AstNode(type, lvalue, children[1]->clone())));
 | 
				
			||||||
			newNode->children.push_back(cond);
 | 
								newNode->children.push_back(cond);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue