mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Fixed sign handling in ternary operator
This commit is contained in:
		
							parent
							
								
									3cd97a205f
								
							
						
					
					
						commit
						ded769c98c
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		|  | @ -1007,8 +1007,8 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint) | ||||||
| 
 | 
 | ||||||
| 			int width = std::max(val1.width, val2.width); | 			int width = std::max(val1.width, val2.width); | ||||||
| 			is_signed = children[1]->is_signed && children[2]->is_signed; | 			is_signed = children[1]->is_signed && children[2]->is_signed; | ||||||
| 			val1.extend(width); | 			val1.extend(width, is_signed); | ||||||
| 			val2.extend(width); | 			val2.extend(width, is_signed); | ||||||
| 
 | 
 | ||||||
| 			return mux2rtlil(this, cond, val1, val2); | 			return mux2rtlil(this, cond, val1, val2); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -57,3 +57,11 @@ module test08(a, b, y); | ||||||
|   assign y = a == ($signed(b) >>> 1); |   assign y = a == ($signed(b) >>> 1); | ||||||
| endmodule | endmodule | ||||||
| 
 | 
 | ||||||
|  | module test09(a, b, c, y); | ||||||
|  |   input a; | ||||||
|  |   input signed [1:0] b; | ||||||
|  |   input signed [2:0] c; | ||||||
|  |   output [3:0] y; | ||||||
|  |   assign y = a ? b : c; | ||||||
|  | endmodule | ||||||
|  | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue