mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Fix partsel expr bit width handling and add test case
Signed-off-by: Claire Wolf <claire@symbioticeda.com>
This commit is contained in:
		
							parent
							
								
									bfeba9ad11
								
							
						
					
					
						commit
						a7cc4673c3
					
				
					 2 changed files with 10 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -593,13 +593,15 @@ non_opt_range:
 | 
			
		|||
	} |
 | 
			
		||||
	'[' expr TOK_POS_INDEXED expr ']' {
 | 
			
		||||
		$$ = new AstNode(AST_RANGE);
 | 
			
		||||
		$$->children.push_back(new AstNode(AST_SUB, new AstNode(AST_ADD, $2->clone(), $4), AstNode::mkconst_int(1, true)));
 | 
			
		||||
		$$->children.push_back(new AstNode(AST_ADD, $2, AstNode::mkconst_int(0, true)));
 | 
			
		||||
		AstNode *expr = new AstNode(AST_CONCAT, $2);
 | 
			
		||||
		$$->children.push_back(new AstNode(AST_SUB, new AstNode(AST_ADD, expr->clone(), $4), AstNode::mkconst_int(1, true)));
 | 
			
		||||
		$$->children.push_back(new AstNode(AST_ADD, expr, AstNode::mkconst_int(0, true)));
 | 
			
		||||
	} |
 | 
			
		||||
	'[' expr TOK_NEG_INDEXED expr ']' {
 | 
			
		||||
		$$ = new AstNode(AST_RANGE);
 | 
			
		||||
		$$->children.push_back(new AstNode(AST_ADD, $2, AstNode::mkconst_int(0, true)));
 | 
			
		||||
		$$->children.push_back(new AstNode(AST_SUB, new AstNode(AST_ADD, $2->clone(), AstNode::mkconst_int(1, true)), $4));
 | 
			
		||||
		AstNode *expr = new AstNode(AST_CONCAT, $2);
 | 
			
		||||
		$$->children.push_back(new AstNode(AST_ADD, expr, AstNode::mkconst_int(0, true)));
 | 
			
		||||
		$$->children.push_back(new AstNode(AST_SUB, new AstNode(AST_ADD, expr->clone(), AstNode::mkconst_int(1, true)), $4));
 | 
			
		||||
	} |
 | 
			
		||||
	'[' expr ']' {
 | 
			
		||||
		$$ = new AstNode(AST_RANGE);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue