mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Merge pull request #1432 from YosysHQ/eddie/fix1427
Refactor peepopt_dffmux and be sensitive to \init when trimming
This commit is contained in:
		
						commit
						cfc181cba9
					
				
					 4 changed files with 155 additions and 60 deletions
				
			
		| 
						 | 
				
			
			@ -2,3 +2,23 @@ read_verilog -sv initval.v
 | 
			
		|||
proc;;
 | 
			
		||||
 | 
			
		||||
sat -seq 10 -prove-asserts
 | 
			
		||||
 | 
			
		||||
read_verilog <<EOT
 | 
			
		||||
module gold(input clk, input i, output reg [1:0] o);
 | 
			
		||||
initial o = 2'b10;
 | 
			
		||||
always @(posedge clk)
 | 
			
		||||
   o[0] <= {i,i};
 | 
			
		||||
endmodule
 | 
			
		||||
 | 
			
		||||
module gate(input clk, input i, output reg [1:0] o);
 | 
			
		||||
initial o = 2'b10;
 | 
			
		||||
always @(posedge clk)
 | 
			
		||||
   o[0] <= i;
 | 
			
		||||
always @*
 | 
			
		||||
   o[1] <= o[0];
 | 
			
		||||
endmodule
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
proc
 | 
			
		||||
miter -equiv -flatten -make_assert -make_outputs gold gate miter
 | 
			
		||||
sat -seq 1 -falsify -prove-asserts -show-ports miter
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -131,8 +131,8 @@ EOT
 | 
			
		|||
proc
 | 
			
		||||
equiv_opt -assert peepopt
 | 
			
		||||
design -load postopt
 | 
			
		||||
select -assert-count 1 t:$dff r:WIDTH=5 %i
 | 
			
		||||
select -assert-count 1 t:$mux r:WIDTH=5 %i
 | 
			
		||||
select -assert-count 1 t:$dff r:WIDTH=4 %i
 | 
			
		||||
select -assert-count 1 t:$mux r:WIDTH=4 %i
 | 
			
		||||
select -assert-count 0 t:$dff t:$mux %% t:* %D
 | 
			
		||||
 | 
			
		||||
####################
 | 
			
		||||
| 
						 | 
				
			
			@ -173,3 +173,41 @@ select -assert-count 1 t:$dff r:WIDTH=2 %i
 | 
			
		|||
select -assert-count 2 t:$mux
 | 
			
		||||
select -assert-count 2 t:$mux r:WIDTH=2 %i
 | 
			
		||||
select -assert-count 0 t:$logic_not t:$dff t:$mux %% t:* %D
 | 
			
		||||
 | 
			
		||||
####################
 | 
			
		||||
 | 
			
		||||
design -reset
 | 
			
		||||
read_verilog <<EOT
 | 
			
		||||
module peepopt_dffmuxext_signed_rst_init(input clk, ce, rstn, input signed [1:0] i, output reg signed [3:0] o);
 | 
			
		||||
    initial o <= 4'b0010;
 | 
			
		||||
    always @(posedge clk) begin
 | 
			
		||||
        if (ce) o <= i;
 | 
			
		||||
        if (!rstn) o <= 4'b1111;
 | 
			
		||||
    end
 | 
			
		||||
endmodule
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
proc
 | 
			
		||||
# NB: equiv_opt uses equiv_induct which covers
 | 
			
		||||
#     only the induction half of temporal induction
 | 
			
		||||
#     --- missing the base-case half
 | 
			
		||||
#     This makes it akin to `sat -tempinduct-inductonly`
 | 
			
		||||
#     instead of `sat -tempinduct-baseonly` or
 | 
			
		||||
#     `sat -tempinduct` which is necessary for this
 | 
			
		||||
#     testcase
 | 
			
		||||
#equiv_opt -assert peepopt
 | 
			
		||||
 | 
			
		||||
design -save gold
 | 
			
		||||
peepopt
 | 
			
		||||
wreduce
 | 
			
		||||
design -stash gate
 | 
			
		||||
design -import gold -as gold
 | 
			
		||||
design -import gate -as gate
 | 
			
		||||
miter -equiv -flatten -make_assert -make_outputs gold gate miter
 | 
			
		||||
sat -tempinduct -verify -prove-asserts -show-ports miter
 | 
			
		||||
 | 
			
		||||
design -load gate
 | 
			
		||||
select -assert-count 1 t:$dff r:WIDTH=4 %i
 | 
			
		||||
select -assert-count 2 t:$mux
 | 
			
		||||
select -assert-count 2 t:$mux r:WIDTH=4 %i
 | 
			
		||||
select -assert-count 0 t:$logic_not t:$dff t:$mux %% t:* %D
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue