mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-30 19:22:31 +00:00 
			
		
		
		
	
							parent
							
								
									0466c48533
								
							
						
					
					
						commit
						fdcbda195b
					
				
					 2 changed files with 24 additions and 4 deletions
				
			
		|  | @ -83,7 +83,9 @@ struct ExtSigSpec { | |||
| 	bool operator==(const ExtSigSpec &other) const { return is_signed == other.is_signed && sign == other.sign && sig == other.sig && semantics == other.semantics; } | ||||
| }; | ||||
| 
 | ||||
| #define BITWISE_OPS ID($_AND_), ID($_NAND_), ID($_OR_), ID($_NOR_), ID($_XOR_), ID($_XNOR_), ID($_ANDNOT_), ID($_ORNOT_), ID($and), ID($or), ID($xor), ID($xnor) | ||||
| #define FINE_BITWISE_OPS ID($_AND_), ID($_NAND_), ID($_OR_), ID($_NOR_), ID($_XOR_), ID($_XNOR_), ID($_ANDNOT_), ID($_ORNOT_) | ||||
| 
 | ||||
| #define BITWISE_OPS FINE_BITWISE_OPS, ID($and), ID($or), ID($xor), ID($xnor) | ||||
| 
 | ||||
| #define REDUCTION_OPS ID($reduce_and), ID($reduce_or), ID($reduce_xor), ID($reduce_xnor), ID($reduce_bool), ID($reduce_nand) | ||||
| 
 | ||||
|  | @ -250,13 +252,18 @@ void merge_operators(RTLIL::Module *module, RTLIL::Cell *mux, const std::vector< | |||
| 		shared_op->setPort(ID(CO), alu_co.extract(0, conn_width)); | ||||
| 	} | ||||
| 
 | ||||
| 	bool is_fine = shared_op->type.in(FINE_BITWISE_OPS); | ||||
| 
 | ||||
| 	if (!is_fine) | ||||
| 		shared_op->setParam(ID(Y_WIDTH), conn_width); | ||||
| 
 | ||||
| 	if (decode_port(shared_op, ID::A, &assign_map) == operand) { | ||||
| 		shared_op->setPort(ID::B, mux_to_oper); | ||||
| 		if (!is_fine) | ||||
| 			shared_op->setParam(ID(B_WIDTH), max_width); | ||||
| 	} else { | ||||
| 		shared_op->setPort(ID::A, mux_to_oper); | ||||
| 		if (!is_fine) | ||||
| 			shared_op->setParam(ID(A_WIDTH), max_width); | ||||
| 	} | ||||
| } | ||||
|  |  | |||
							
								
								
									
										13
									
								
								tests/opt/bug1525.ys
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								tests/opt/bug1525.ys
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| read_verilog << EOF | ||||
| module top(...); | ||||
| input A1, A2, B, S; | ||||
| output O; | ||||
| 
 | ||||
| assign O = S ? (A1 & B) : (A2 & B); | ||||
| 
 | ||||
| endmodule | ||||
| EOF | ||||
| 
 | ||||
| simplemap | ||||
| opt_share | ||||
| dump | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue