mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Merge pull request #1789 from YosysHQ/eddie/opt_expr_alu
opt_expr: improve performance on $alu and $sub
This commit is contained in:
		
						commit
						e79bc45975
					
				
					 2 changed files with 114 additions and 19 deletions
				
			
		
							
								
								
									
										63
									
								
								tests/opt/opt_expr_alu.ys
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								tests/opt/opt_expr_alu.ys
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,63 @@
 | 
			
		|||
read_verilog <<EOT
 | 
			
		||||
module test(input a, output [1:0] y);
 | 
			
		||||
assign y = {a,1'b0} + 1'b1;
 | 
			
		||||
endmodule
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
alumacc
 | 
			
		||||
equiv_opt opt_expr -fine
 | 
			
		||||
design -load postopt
 | 
			
		||||
select -assert-count 1 t:$pos
 | 
			
		||||
select -assert-count none t:$pos t:* %D
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
design -reset
 | 
			
		||||
read_verilog <<EOT
 | 
			
		||||
module test(input a, output [1:0] y);
 | 
			
		||||
assign y = {a,1'b1} + 1'b1;
 | 
			
		||||
endmodule
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
alumacc
 | 
			
		||||
select -assert-count 1 t:$alu
 | 
			
		||||
select -assert-count none t:$alu t:* %D
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
design -reset
 | 
			
		||||
read_verilog <<EOT
 | 
			
		||||
module test(input a, output [1:0] y);
 | 
			
		||||
assign y = {a,1'b1} - 1'b1;
 | 
			
		||||
endmodule
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
equiv_opt opt_expr -fine
 | 
			
		||||
design -load postopt
 | 
			
		||||
select -assert-count 1 t:$pos
 | 
			
		||||
select -assert-count none t:$pos t:* %D
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
design -reset
 | 
			
		||||
read_verilog <<EOT
 | 
			
		||||
module test(input a, output [3:0] y);
 | 
			
		||||
assign y = {a,3'b101} - 1'b1;
 | 
			
		||||
endmodule
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
equiv_opt opt_expr -fine
 | 
			
		||||
design -load postopt
 | 
			
		||||
select -assert-count 1 t:$pos
 | 
			
		||||
select -assert-count none t:$pos t:* %D
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
design -reset
 | 
			
		||||
read_verilog <<EOT
 | 
			
		||||
module test(input a, output [3:0] y);
 | 
			
		||||
assign y = {a,3'b101} - 1'b1;
 | 
			
		||||
endmodule
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
alumacc
 | 
			
		||||
equiv_opt opt_expr -fine
 | 
			
		||||
design -load postopt
 | 
			
		||||
select -assert-count 1 t:$pos
 | 
			
		||||
select -assert-count none t:$pos t:* %D
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue